Skip to content

Commit

Permalink
[Sketcher] Use variable for frequently used static cast in trim
Browse files Browse the repository at this point in the history
  • Loading branch information
AjinkyaDahale committed Nov 23, 2024
1 parent 38f9b65 commit ed0550b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Mod/Sketcher/App/SketchObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3534,8 +3534,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
return 0;
}

double firstParam = static_cast<const Part::GeomCurve*>(geo)->getFirstParameter();
double lastParam = static_cast<const Part::GeomCurve*>(geo)->getLastParameter();
const auto* geoAsCurve = static_cast<const Part::GeomCurve*>(geo);
double firstParam = geoAsCurve->getFirstParameter();
double lastParam = geoAsCurve->getLastParameter();
double pointParam, point1Param, point2Param;
if (!getIntersectionParameters(
geo, point, pointParam, point1, point1Param, point2, point2Param)) {
Expand All @@ -3548,7 +3549,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
std::vector<int> newIds;
std::vector<Part::Geometry*> newGeos;
std::vector<const Part::Geometry*> newGeosAsConsts;
bool oldGeoIsConstruction = GeometryFacade::getConstruction(static_cast<const Part::GeomCurve*>(geo));
bool oldGeoIsConstruction = GeometryFacade::getConstruction(geoAsCurve);

Check warning on line 3552 in src/Mod/Sketcher/App/SketchObject.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

unused variable 'oldGeoIsConstruction' [-Wunused-variable]

if (isClosedCurve(geo)) {
startPointRemains = false;
Expand All @@ -3569,7 +3570,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point)
}

for (auto& [u1, u2] : paramsOfNewGeos) {
auto newGeo = static_cast<const Part::GeomCurve*>(geo)->createArc(u1, u2);
auto newGeo = geoAsCurve->createArc(u1, u2);
assert(newGeo);
newGeos.push_back(newGeo);
newGeosAsConsts.push_back(newGeo);
Expand Down

0 comments on commit ed0550b

Please sign in to comment.