use the tool resolution to determin face position
This commit is contained in:
@@ -742,20 +742,20 @@ cSimTool::cSimTool(const TopoDS_Shape& toolShape, float res){
|
|||||||
// find the face of the tool by checking z points accross the
|
// find the face of the tool by checking z points accross the
|
||||||
// radius to see if the point is inside the shape
|
// radius to see if the point is inside the shape
|
||||||
pnt.x = x * res;
|
pnt.x = x * res;
|
||||||
bool inside = isInside(toolShape, pnt);
|
bool inside = isInside(toolShape, pnt, res);
|
||||||
|
|
||||||
// move down until the point is outside the shape
|
// move down until the point is outside the shape
|
||||||
while(inside && std::abs(pnt.z) < length ){
|
while(inside && std::abs(pnt.z) < length ){
|
||||||
//Base::Console().Log("PathSim::BeginSimulation: Pnt Inside: X Pos %f\n", pnt.x);
|
//Base::Console().Log("PathSim::BeginSimulation: Pnt Inside: X Pos %f\n", pnt.x);
|
||||||
pnt.z -= res;
|
pnt.z -= res;
|
||||||
inside = isInside(toolShape, pnt);
|
inside = isInside(toolShape, pnt, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// move up until the point is first inside the shape and record the position
|
// move up until the point is first inside the shape and record the position
|
||||||
while (!inside && pnt.z < length)
|
while (!inside && pnt.z < length)
|
||||||
{
|
{
|
||||||
pnt.z += res;
|
pnt.z += res;
|
||||||
inside = isInside(toolShape, pnt);
|
inside = isInside(toolShape, pnt, res);
|
||||||
|
|
||||||
if (inside){
|
if (inside){
|
||||||
toolShapePoint shapePoint;
|
toolShapePoint shapePoint;
|
||||||
@@ -789,16 +789,15 @@ float cSimTool::GetToolProfileAt(float pos) // pos is -1..1 location along the
|
|||||||
return it->heightPos;
|
return it->heightPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSimTool::isInside(const TopoDS_Shape& toolShape, Base::Vector3d pnt)
|
bool cSimTool::isInside(const TopoDS_Shape& toolShape, Base::Vector3d pnt, float res)
|
||||||
{
|
{
|
||||||
double tolerance = 0.011;
|
|
||||||
bool checkFace = true;
|
bool checkFace = true;
|
||||||
TopAbs_State stateIn = TopAbs_IN;
|
TopAbs_State stateIn = TopAbs_IN;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
BRepClass3d_SolidClassifier solidClassifier(toolShape);
|
BRepClass3d_SolidClassifier solidClassifier(toolShape);
|
||||||
gp_Pnt vertex = gp_Pnt(pnt.x, pnt.y, pnt.z);
|
gp_Pnt vertex = gp_Pnt(pnt.x, pnt.y, pnt.z);
|
||||||
solidClassifier.Perform(vertex, tolerance);
|
solidClassifier.Perform(vertex, res);
|
||||||
bool inside = (solidClassifier.State() == stateIn);
|
bool inside = (solidClassifier.State() == stateIn);
|
||||||
if (checkFace && solidClassifier.IsOnAFace()){
|
if (checkFace && solidClassifier.IsOnAFace()){
|
||||||
inside = true;
|
inside = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user