Class: Plane
Class representing a Plane.
A Plane defines an infinite flat surface in 3D space using an origin point and a normal direction. It's one of the most important coordinate system tools in BeeGraphy - you'll reach for it whenever you need to position, orient, or transform geometry relative to a specific frame of reference.
If you've used workplanes in other CAD tools, this is the same idea. A plane tells BeeGraphy "this is my local coordinate system" - where the origin is, which way is up, and how X and Y axes are oriented.
When to use Plane
- Setting working planes - position geometry on a specific plane instead of the global XY
- Coordinate transforms - convert between local and world coordinates with
toLocalCoords()andtoWorldCoords() - Mirror and symmetry - use a plane as the mirror reference
- Sweep and extrude guides - define cross-section orientations along a path
- Projecting points - find the closest point on a plane with
closestPoint() - Plane-plane intersections - find where two planes meet with
planePlane()
Quick start
Key methods at a glance
| Method | What it does |
|---|---|
origin() | Get the plane's origin point |
setOrigin(v) | Move the plane to a new origin |
adjust(normal) | Reorient the plane with a new normal |
offset(distance) | Shift the plane along its normal |
reverse(x, y, swap) | Flip or swap the plane's axes |
clone() | Create an independent copy |
closestPoint(v) | Nearest point on the plane to a given point |
toLocalCoords(v) | World vector to plane-local coordinates |
toWorldCoords(v) | Plane-local coordinates to world vector |
align(direction) | Align the plane to a direction |
planePlane(plane) | Intersection line between two planes |
Plane.byNormal(o, n) | Create from origin + normal (static) |
Plane.by3Pnt(o, a, b) | Create from three points (static) |
Method: constructor
Create a Plane.
Parameters
origin(Point): The origin point of the plane.
Example
Method: plane
Get the plane.
Returns
The plane.
Example
Method: plane
Set the plane.
Parameters
plane: The new plane.
Example
Method: type
Get the type of the plane.
Returns
The type of the curve.
Example
Method: delete
Deletes the plane and performs necessary cleanup operations.
Example
Method: clone
Clone the plane.
Returns
A new plane instance.
Example
Method: origin
Get the origin of the plane.
Returns
The origin of the plane.
Example
Method: setOrigin
Set the origin of the plane.
Parameters
newOrigin(IVector): The new origin of the plane.
Example
Method: setOrigin2d
Set the origin of the plane in 2D.
Parameters
x(number): The x coordinate.y(number): The y coordinate.
Example
Method: adjust
Adjust the plane with a new normal.
Parameters
newNormal(IVector): The new normal vector.
Returns
A new plane instance.
Example
Static Method: by3Pnt
Create a plane by three points.
Parameters
origin(IVector): The origin point.pointA(IVector): The first point.pointB(IVector): The second point.
Returns
A new plane instance.
Example
Static Method: byLinePnt
Create a plane by a line and a point.
Parameters
line(ICurve): The line.point(IVector): The point.
Returns
A new plane instance.
Example
Static Method: by2Line
Create a plane by two lines.
Parameters
lineA(Curve): The first line.lineB(Curve): The second line.
Returns
A new plane instance.
Example
Static Method: byNormal
Create a plane by a normal vector.
Parameters
origin(Vector): The origin point.normal(Vector): The normal vector.
Returns
A new plane instance.
Example
Method: dump
Dump the plane information.
Returns
The plane information.
Example
Method: reverse
Reverse the plane directions.
Parameters
xFlip(boolean): Whether to flip the x direction.yFlip(boolean): Whether to flip the y direction.swap(boolean): Whether to swap the x and y directions.
Returns
A new plane instance.
Example
Method: offset
Offset the plane by a distance.
Parameters
distance(number): The distance to offset.
Returns
A new plane instance.
Example
Method: closestPoint
Find the closest point on the plane to a given point.
Parameters
point(Vector): The point.
Returns
The closest point, distance, and UV point.
Example
Method: align
Align the plane to a direction.
Parameters
direction(IVector): The direction to align to.
Returns
The aligned plane and angle.
Example
Method: toLocalCoords
Convert a vector to local coordinates.
Parameters
vec(IVector): The vector.
Returns
The vector in local coordinates.
Example
Method: toWorldCoords
Convert a point to world coordinates.
Parameters
v(Point): The point.
Returns
The point in world coordinates.
Example
Method: planePlane
Project a plane to another plane.
Parameters
plane: The plane to project to.
Returns
The intersection line between the two planes.