Intersection Point

How to find the intesection point of the two circle. and ho to diplay only the intersected points.

Thanks & Regards
Vidhyan

Roman Lygin's picture

Hi Vidhyan,

Intersection can be found with GeomAPI_InterCurveCurve or Geom2dAPI_InterCurveCurve (read Modeling Algorithms User's Guide for details).
Once you get an intersection point (gp_Pnt), you can create a vertex (TopoDS_Vertex) and then display it with AIS_Shape.

Hope this helps.
Roman

---
opencascade.blogspot.com - blog on Open CASCADE

Vidhyan's picture

Thanks a lot Roman Lygin. It helped me a lot

Vidhyan's picture

But GeomAPI_InterCurveCurve is not present in OCC 6.3 only Geom2dAPI_InterCurveCurve was present. So i am converting the curve to 2d and using Geom2dAPI_InterCurveCurve i am able to get only the segments but not the intersecting points.

gp_Pnt pn(-354,122,0);
gp_Pnt pn1(-298,122,0);

gp_Pnt rad_xypos(pn.X(),pn.Y(),pn.Z());
gp_Dir dir(0,0,1);
gp_Ax2 axis(rad_xypos,dir);

gp_Pnt rad_xypos1(pn1.X(),pn1.Y(),pn1.Z());
gp_Dir dir1(0,0,1);
gp_Ax2 axis1(rad_xypos1,dir1);

gp_Circ C1(axis,100);
gp_Circ C2(axis1,100);

Handle(Geom_Circle) Geomcirc1 = new Geom_Circle(C1);
Handle(AIS_Circle) circle1 = new AIS_Circle(Geomcirc1);

Handle(Geom_Circle) Geomcirc2 = new Geom_Circle(C2);
Handle(AIS_Circle) circle2 = new AIS_Circle(Geomcirc2);

Handle(Geom2d_Curve) firstcurve2d ;
firstcurve2d = GeomAPI::To2d(Geomcirc1,PL);
Handle(Geom2d_Curve) secondcurve2d ; secondcurve2d = GeomAPI::To2d(Geomcirc2,PL);

Standard_Real precision = 1.0e-6;

Geom2dAPI_InterCurveCurve Intect1= Geom2dAPI_InterCurveCurve(firstcurve2d,secondcurve2d,precision);
Standard_Real r = Intect1.NbPoints();
gp_Pnt2d Intect11Pt = Intect1.Point(1); // This line is compiling but showing error when running. I debugged it said no intersection points. But the points are intersecting.

//But i am able to get the following segments
Intect1.Segment(1,curve2done,curve2dtwo);
Intect1.Segment(2,curve2dthree,curve2dfour);