As shown in the figure below:
I want to calculate the intersections of an u direction iso curve and the boundary of TopoDS_Face in occt,but i don't know how to write the code,anyone who can give some advices or sample code with c++?
Any useful suggestions and codes would be appreciated!
In your question I have several places which are not clear to me. So this is how I understand your question. You have a TopoDS_Face and ISO curve (U direction or V direction). You need to find the gp_Pnt of the intersection between the boundary edges of the given shape and the given ISO curve. Here is the small code snippet to do that.
You can get an ISO curve using the following code snippet.
TopoDS_Face face = ... // the face object
Handle(Geom_Surface) surface = BRep_Tool::Surface(face); // get the surface of the given face
double u = 0.5; // define the u parameter value
Handle(Geom_Curve) curve = surface->UIso(u); // get the ISO curve
TopoDS_Shape edge = BRepBuilderAPI_MakeEdge(curve).Shape(); // Make edge of the given ISO curve
You can find the intersection points of the given edges using the following code. Here assume the face contains multiple edges.
for (TopExp_Explorer exp(face, TopAbs_EDGE); exp.More(); exp.Next()) // explor the shape to get the edge
{
TopoDS_Edge shapeEdge = TopoDS::Edge(exp.Current()); // get the current edge of the face
BRepExtrema_DistShapeShape dist(edge, shapeEdge);
if (dist.IsDone() && dist.NbSolution() > 0) // get the result
{
for (int i = 1; i <= dist.NbSolution(); i++)
{
gp_Pnt point1 = dist.PointOnShape1(i); // point on the iso curve
gp_Pnt point2 = dist.PointOnShape2(i); // point on the edge of the face
// since both these points are same, you can use any of them.
bool check = true;
}
}
}
Hope this is the correct answer you find.