use BRepAlgoAPI_Common to get the intersect of a line and a shape

Hi, everyone, i need the get the intersect points of a line and a complex shape like a staircase, the hit points can more than two. i use the function BRepAlgoAPI_Common but in some case the result is not correct. it looks like i only can get two points in the result or some other reasons, can anyone help me? maybe it's come problem of tolerance setting or BRepAlgoAPI_Common function setting? thx here!

Stephane Routelous's picture

Hi,

I don't really have an answer, but I think the boolean operations are done to work (good)on solids; Other combinations can produce unexpected results.
Try to find another way to compute your points ( like exploding you shape in faces, get the geometrical surfaces ( don't forget the boundaries) , and intersect the line with all the surfaces (BTW, I think it will be faster than the boolean operations) )

p-qiang's picture

thx first. and i have thought to try to use the explored face but like what you said, i didn't add the boundary. i'm a new user of opencascade, and i don't know how to add it. All faces i have are the polygon(plane) from TopoDS_Face, i thing there should are some way to convert the TopoDS_Face(with boundaris) to Geom_Surface(with boundaris) directly?

phil's picture

hi there is a was to ay to convert the TopoDS_Face(with boundaris) to Geom_Surface(with boundaris) directly

Handle(Geom_Surface) aSurface = BRep_Tool::Surface(TopoDS_Face TempFace);

gp_Pln apln;
gp_Dir dirF;
TopoDS_Face TempFace;
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(*TempFace);
if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane))
{
Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface);
apln = aPlane->Pln();
dirF = apln.Axis().Direction();
}
return dirF;

p-qiang's picture

thx first. and i have thought to try to use the explored face but like what you said, i didn't add the boundary. i think i can get the u v bound from breptools::uvbounds, right?

andi's picture

Hi,
i think you can try "BRepExtrema_DistShapeShape". It calculates all minimum distances. All points with dist = 0 are the one you need.
If it is not working try "BRepIntCurveSurface_Inter" or "BRepExtrema_ExtCF".
Take a look in the cdl-files for further explanation.

Hugues's picture

Computing intersections between a line and faces can also be done with a IntCurvesFace_ShapeIntersector object.
As mentionned a BRepIntCurveSurface_Inter object can be used, but I got really faster computations with IntCurvesFace_ShapeIntersector.