Wed, 03/12/2008 - 21:09
Forums:
I tried to find intersection of two lines on the same plane. gp_Lin or gp_Lin2d
I wanted to use Geom2dAPI_InterCurveCurve.
This function uses Handle_Geom2d_Curve us input parameters.
Is there any method to change type from gp_Lin for Handle_Geom2d_Curve.
Maybe there is another function to find intersection between two lines?
Paweł
Thu, 03/13/2008 - 13:49
You can create a Geom2d_Line, which is derived from Geom2d_Curve, from a gp_Lin2d.
Fri, 03/14/2008 - 01:04
I tried to do like this:
Handle(Geom2d_Curve) line_angle_geom = Geom2d_Line(line_angle) ;
where line_angle is gp_Lin2d.
I receive message that Geom2d_Line can't be changed to Handle(Geom2d_Curve). How can I do it?
Paweł
Fri, 03/14/2008 - 08:22
>I tried to do like this:
>Handle(Geom2d_Curve) line_angle_geom = Geom2d_Line>(line_angle) ;
>where line_angle is gp_Lin2d.
The syntax is wrong.
Here you are trying to assign the object directly.
Please use the new keyword to create the pointer and then assign to Handle(Geom2d_Curve).
Fri, 03/14/2008 - 22:04
I finally succeeded with code below:
Handle(Geom2d_Curve) line_angle_gc;
Handle(Geom2d_Curve) line_bottom_gc;
Handle(Geom2d_Curve) line_upper_gc;
Handle(Geom2d_Line) line_angle_2d;
Handle(Geom2d_Line) line_bottom_2d;
Handle(Geom2d_Line) line_upper_2d;
Geom2d_Line line_up = Geom2d_Line(line_upper);
Geom2d_Line line_bot = Geom2d_Line(line_bottom);
Geom2d_Line line_ang = Geom2d_Line(line_angle);
line_upper_2d = &line_up;
line_angle_2d = &line_ang;
line_bottom_2d = &line_bot;
line_angle_gc = Handle (Geom2d_Line)::DownCast(line_angle_2d);
line_bottom_gc = Handle (Geom2d_Line)::DownCast(line_bottom_2d);
line_upper_gc = Handle (Geom2d_Line)::DownCast(line_upper_2d);
Geom2dAPI_InterCurveCurve Intersector_1( line_bottom_gc, line_angle_gc, 1.0e-6);
Geom2dAPI_InterCurveCurve Intersector_2( line_upper_gc, line_angle_gc, 1.0e-6);
gp_Pnt2d intersection2d_1 = Intersector_1.Point(1);
gp_Pnt2d intersection2d_2 = Intersector_2.Point(1);
Mon, 12/08/2008 - 17:58
Why not using IntAna2d_AnaIntersection instead?