questions about point on surface

Hey guys, I'm able to obtain a point on a surface of a STEP model by clicking with the mouse. It looks fine when viewed from a distance, but when I zoom in several times, I noticed that the point doesn't completely match the model. Does anyone know why? Here's the code:
double X1, Y1, Z1, Vx, Vy, Vz;
m_view->Convert(myXmin, myYmin, X1, Y1, Z1);
m_view->Proj(Vx, Vy, Vz);

gp_Pnt startPoint(X1, Y1, Z1);
gp_Dir direction(Vx, Vy, Vz);
gp_Lin verticalLine(startPoint, direction);

IntCurvesFace_ShapeIntersector intersector;
intersector.Load(abc, Precision::Confusion());

Standard_Real pInf = -RealLast();
Standard_Real pSup = RealLast();
intersector.PerformNearest(verticalLine, pInf, pSup);
if (intersector.IsDone())
{

const gp_Pnt& intersectionPoint = intersector.Pnt(1);

hascreatedpnt.push_back(intersectionPoint);
TopoDS_Shape aShape = BRepBuilderAPI_MakeVertex(intersectionPoint);
Handle(AIS_Shape) aisShape = new AIS_Shape(aShape);
aisShape->SetColor(Quantity_NOC_BLUE1);
m_context->Display(aisShape, true);
//}
}

gkv311 n's picture

You calculated the intersection point between line and analytical geometry within B-Rep shape (e.g. on exact geometry). At the same time, AIS_Shape displays triangulation - an approximated representation of analytical geometry with some deviation from it. Hense, your point may deviate from displayed triangulation within deflection parameter value, passed to BRepMesh tool - which is expected.

Depending on what you are trying to achieve, you may consider adjusting meshing parameters (if mesh is too rough), projecting point onto triangulation (if you would like to avoid visual artifacts) or remeshing shape considering this specific point (in case if this point indicates some important region of the shape, by putting it as internal vertex to the shape or refining mesh manually).