From 6c3d2eff644edb3131495d0cc43ef753f91e56dc Mon Sep 17 00:00:00 2001 From: Ajinkya Dahale Date: Sat, 23 Nov 2024 19:18:55 +0530 Subject: [PATCH] [Sketcher] Use variable for frequently used static cast in `trim` --- src/Mod/Sketcher/App/SketchObject.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 77e9731482..bbf2d0370b 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -3580,8 +3580,9 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) return 0; } - double firstParam = static_cast(geo)->getFirstParameter(); - double lastParam = static_cast(geo)->getLastParameter(); + const auto* geoAsCurve = static_cast(geo); + double firstParam = geoAsCurve->getFirstParameter(); + double lastParam = geoAsCurve->getLastParameter(); double pointParam, point1Param, point2Param; if (!getIntersectionParameters( geo, point, pointParam, point1, point1Param, point2, point2Param)) { @@ -3594,7 +3595,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) std::vector newIds; std::vector newGeos; std::vector newGeosAsConsts; - bool oldGeoIsConstruction = GeometryFacade::getConstruction(static_cast(geo)); + bool oldGeoIsConstruction = GeometryFacade::getConstruction(geoAsCurve); if (isClosedCurve(geo)) { startPointRemains = false; @@ -3615,7 +3616,7 @@ int SketchObject::trim(int GeoId, const Base::Vector3d& point) } for (auto& [u1, u2] : paramsOfNewGeos) { - auto newGeo = static_cast(geo)->createArc(u1, u2); + auto newGeo = geoAsCurve->createArc(u1, u2); assert(newGeo); newGeos.push_back(newGeo); newGeosAsConsts.push_back(newGeo);