How to get defining parameters for a Geom_Curve

bioan

CAD practitioner
Hello!
I'm very new with OCCT technology and try to find some basic info:
I have an array of Geom_Curve geometry and must cycle on everyone of them and try to find the defining parameters for each of them. For example in the case of Geom_Line (the lines) I need to extract the start point and the end point of the line, for a Geom_TrimmedCurve (which represent the arcs) I need to find center, radius, and start point and end point, for Geom_Circle (the circles) I need to find center, and radius, ands so on.
I can use GeomAdaptor_Curve and try use the resulted gp_Lin / gp_Circle from the original Geom_Curve but I got stuck here, I'm not sure how to retrieve the points.
From official documentation, the gp_Lin class has Location() and Position(). Which one must use to calculate the start and the end points?
Also I need to find the start point and an end point of an arc.

It would be very helpful, if you can point me to the right way to do it.
Ioan
 

Quaoar

Administrator
Staff member
For example in the case of Geom_Line (the lines) I need to extract the start point and the end point of the line...
A line and other basic curve types wouldn't contain the parameter ranges. You can have the first and last parameters at a geometric entity (Geom_TrimmedCurve) or at the level of a topological entity (TopoDS_Edge). It's up to you to decide which approach to use unless it's already defined by the incoming data.

for a Geom_TrimmedCurve (which represent the arcs) I need to find center, radius, and start point and end point
If you have a trimmed curve, you can take its trimming parameters, which, for a circular basis curve, would mean angles. The center and radius are defined from the basis circle then. The start and end point are evaluated from the trimming parameters which you take from Geom_TrimmedCurve.

I can use GeomAdaptor_Curve and try use the resulted gp_Lin / gp_Circle from the original Geom_Curve but I got stuck here, I'm not sure how to retrieve the points.
If you have a parameter value, you can get a point on the curve by evaluating the corresponding curve object. Note that objects like `gp_Circ`, `gp_Line`, etc. are non-shared and they do not really expose a parametric curve interface. Their purpose is to serve as lightweight data structures holding the analytical props of the corresponding curves. To evaluate them, use `ElCLib::Value()` method (there are many variations of it) or use `Geom_` counterparts.
 
Top