From ee541db390b62e90b1087ea74ef62063181a5e7a Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Wed, 29 Apr 2020 21:31:07 +0100 Subject: [PATCH] Remove and silence some debug prints --- src/Mod/Path/PathSimulator/App/VolSim.cpp | 38 +++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/src/Mod/Path/PathSimulator/App/VolSim.cpp b/src/Mod/Path/PathSimulator/App/VolSim.cpp index d6f9281999..fbc32c1915 100644 --- a/src/Mod/Path/PathSimulator/App/VolSim.cpp +++ b/src/Mod/Path/PathSimulator/App/VolSim.cpp @@ -731,8 +731,34 @@ cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res){ pnt.x = 0; pnt.y = 0; pnt.z = 0; - //float res = 0.025; // resolution - Base::Console().Log("PathSim::SetToolShape: res: %f\n", res); + + int radValue = (int)(radius / res) + 1; + + // Measure the performance of the profile extraction + auto start = std::chrono::high_resolution_clock::now(); + + for (int x = 0; x < radValue; x++) + { + // find the face of the tool by checking z points accross the + // radius to see if the point is inside the shape + pnt.x = x * res; + bool inside = isInside(toolShape, pnt); + + // move down until the point is outside the shape + while(inside && std::abs(pnt.z) < length ){ + //Base::Console().Log("PathSim::BeginSimulation: Pnt Inside: X Pos %f\n", pnt.x); + pnt.z -= res; + inside = isInside(toolShape, pnt); + } + + // move up until the point is first inside the shape and record the position + while (!inside && pnt.z < length) + { + pnt.z += res; + inside = isInside(toolShape, pnt); + + if (inside){ + toolShapePoint shapePoint; shapePoint.radiusPos = pnt.x; shapePoint.heightPos = pnt.z; m_toolShape.push_back(shapePoint); @@ -754,11 +780,11 @@ float cSimTool::GetToolProfileAt(float pos) // pos is -1..1 location along the float radPos = std::abs(pos) * radius; toolShapePoint test; test.radiusPos = radPos; auto it = std::lower_bound(m_toolShape.begin(), m_toolShape.end(), test, toolShapePoint::less_than()); - float diff = std::abs(radPos - it->radiusPos); + //float diff = std::abs(radPos - it->radiusPos); - if (diff > 0.05){ - Base::Console().Log("requested pos: %f rad: %f diff: %f\n", radPos, it->radiusPos, diff); - } + //if (diff > 0.05){ + // Base::Console().Log("requested pos: %f rad: %f diff: %f\n", radPos, it->radiusPos, diff); + //} return it->heightPos; }