In the Ge library, planes are represented by OdGePlane objects, which are 3D entities that inherit functionality from the OdGePlanarEnt class.
You can construct a OdGePlane object using the following OdGePlane() constructors:
For example, to construct a plane with the origin at p1 and the normal of v1:
OdGePlane plane(p1,v1);
As an object of the OdGePlanarEnt class, a plane object provides the following methods for working with a plane.
The pointOnPlane() and normal() methods return respectively an arbitrary point lying on the plane and the normal of the plane.
Using the set() method you can set the plane's defining parameters. The get() and getCoefficients() methods get the plane's parameters.
OdGePoint3d uPoint(1.0, 1.0, 1.0), origin(0.0, 0.0, 0.0), vPoint(1.0, 1.0, -1.0);
double a, b, c, d;
OdGePoint3d point1, point2, point3;
plane.set(uPoint, origin, vPoint);
plane.get(point1, point2, point3);
plane.getCoefficients(a, b, c, d);
The getClosestPointTo() method returns the point on the plane closest to the specified point:
p2 = plane1.closestPointTo(p1);
The distanceTo() method calculates the distance to the specified point:
double distance = plane1.distanceTo(p1);
The isParallelTo() method returns a Boolean value that determines if the plane is parallel to a specified plane or line:
if (plane1.isParallelTo(plane2))
if (plane1.isParallelTo(line1))
The isPerpendicularTo() method returns a Boolean value that determines if the plane is perpendicular to the specified plane or line:
if (plane1.isPerpendicularTo(plane2))
if (plane1.isPerpendicularTo(line1))
The isCoplanarTo() method returns a Boolean value that determines if the plane is colinear to the specified plane:
if (plane1.isCoplanarTo(plane2))
The intersectWith() method returns a Boolean value that determines if the plane is intersected by the specified line, and if true, gets the point of the intersection:
if (plane1.intersectWith(line1, p1))
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|