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:
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:
double distance1 = line1.distanceTo(p1);
double distance2 = line1.distanceTo(line2);
The isOn() method is used to determine if the specified point is on the ray:
if (line1.isOn(p1))
The isParallelTo() method is used to determine if the line is parallel to the specified line:
if (line1.isParallelTo(line2))
The isPerpendicularTo() method is used to determine if the line is perpendicular to the specified line:
if (line1.isPerpendicularTo(line2))
The intersectWith() method is used to determine if the line intersects the specified line or plane and finds the intersection point:
if (line1.intersectWith(line2, p1))
if (line1.intersectWith(plane1, p1))
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|