Kernel SDK Developer's Guide > Working with the Ge Library > Working with Planes
Working with Planes

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:

  • OdGePlane::OdGePlane() — The default plane constructor. Creates the XY-plane.
  • OdGePlane::OdGePlane(const OdGePlane& plane) — Creates a plane cloned from a specified OdGePlane object.
  • OdGePlane::OdGePlane(const OdGePoint3d& origin, const OdGeVector3d& normal) — Creates a plane through the plane's origin point, with the specified normal vector.
  • OdGePlane::OdGePlane(const OdGePoint3d& uPnt, const OdGePoint3d& origin, const OdGePoint3d& vPnt) — Creates a plane by a specified plane's origin point and U- and V-axis end points.
  • OdGePlane::OdGePlane(const OdGePoint3d& origin, const OdGeVector3d& uAxis, const OdGeVector3d& vAxis) — Creates a plane by a specified plane's origin point and U- and V-axis vectors.
  • OdGePlane::OdGePlane(double a, double b, double c, double d) — Creates a plane by coefficients of a plane's equation: a*x + b*y + c*z + d = 0.

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.