Line objects are represented by the OdGeLine2d and OdGeLine3d classes and inherit functionality of the OdGeLinearEnt2d
and OdGeLinearEnt3d classes respectively. This topic demonstrates the most common operations with lines as an object of
the OdGeLine3d class. The functionality of 2D line objects is similar.
For creation of a line object, you can use one of the OdGeLine3d() constructors:
OdGeLine3d() — Default constructor. Creates an infinite line with the start point of (0,0,0) and the direction of (0,0,0).
OdGeLine3d(const OdGeLine3d& source) — Creates a line cloned from the source line object.
OdGeLine3d(const OdGePoint3d& point, const OdGeVector3d& vect) — Creates an infinite line passing through the point with the direction of vect.
OdGeLine3d(const OdGePoint3d& point1, const OdGePoint3d& point2) — Creates an infinite line passing through the non-coincident point1 and point2.
The pointOnLine() method returns the arbitrary point of the line:
OdGePoint3d p1 = line.pointOnLine();
The direction() method returns the direction vector of the line:
OdGeVector3d v = line.direction();
The distanceTo() method finds the distance to the point on the line closest to the specified point or curve: