Class: Plane
Class representing a Plane.
Method: constructor
Create a Plane.
Parameters
origin(Point): The origin point of the plane.
Example
const origin = new Vector(0, 0, 0);
const instance = new Plane();
instance.constructor(origin);
Method: plane
Get the plane.
Returns
The plane.
Example
const instance = new Plane();
instance.plane();
Method: plane
Set the plane.
Parameters
plane: The new plane.
Example
const instance = new Plane();
instance.plane(plane);
Method: type
Get the type of the plane.
Returns
The type of the curve.
Example
const instance = new Plane();
instance.type();
Method: delete
Deletes the plane and performs necessary cleanup operations.
Example
const instance = new Plane();
instance.delete();
Method: clone
Clone the plane.
Returns
A new plane instance.
Example
const instance = new Plane();
instance.clone();
Method: origin
Get the origin of the plane.
Returns
The origin of the plane.
Example
const instance = new Plane();
instance.origin();
Method: setOrigin
Set the origin of the plane.
Parameters
newOrigin(IVector): The new origin of the plane.
Example
const newOrigin = new Vector(1, 1, 1);
const instance = new Plane();
instance.setOrigin(newOrigin);
Method: setOrigin2d
Set the origin of the plane in 2D.
Parameters
x(number): The x coordinate.y(number): The y coordinate.
Example
const x = 0.5;
const y = 0.5;
const instance = new Plane();
instance.setOrigin2d(x, y);
Method: adjust
Adjust the plane with a new normal.
Parameters
newNormal(IVector): The new normal vector.
Returns
A new plane instance.
Example
const newNormal = new Vector(1, 1, 1);
const instance = new Plane();
instance.adjust(newNormal);
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
const origin = new Vector(1, 1, 1);
const pointA = new Vector(0, 0, 0);
const pointB = new Vector(1, 1, 1);
Plane.by3Pnt(origin, pointA, pointB);
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
const line = CurveBuilder.line(new Vector(0, 0, 0), new Vector(1, 1, 1));
const point = new Vector(1, 1, 1);
Plane.byLinePnt(line, point);
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
const lineA = /* specify a lineA */;
const lineB = /* specify a lineB */;
Plane.by2Line(lineA, lineB);
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
const origin = /* specify a origin */;
const normal = /* specify a normal */;
Plane.byNormal(origin, normal);
Method: dump
Dump the plane information.
Returns
The plane information.
Example
const instance = new Plane();
instance.dump();
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
const xFlip = /* specify a xFlip */;
const yFlip = /* specify a yFlip */;
const swap = /* specify a swap */;
const instance = new Plane();
instance.reverse(xFlip, yFlip, swap);
Method: offset
Offset the plane by a distance.
Parameters
distance(number): The distance to offset.
Returns
A new plane instance.
Example
const distance = 0.5;
const instance = new Plane();
instance.offset(distance);
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
const point = /* specify a point */;
const instance = new Plane();
instance.closestPoint(point);
Method: align
Align the plane to a direction.
Parameters
direction(IVector): The direction to align to.
Returns
The aligned plane and angle.
Example
const direction = new Vector(1, 1, 1);
const instance = new Plane();
instance.align(direction);
Method: toLocalCoords
Convert a vector to local coordinates.
Parameters
vec(IVector): The vector.
Returns
The vector in local coordinates.
Example
const vec = new Vector(1, 1, 1);
const instance = new Plane();
instance.toLocalCoords(vec);
Method: toWorldCoords
Convert a point to world coordinates.
Parameters
v(Point): The point.
Returns
The point in world coordinates.
Example
const v = /* specify a v */;
const instance = new Plane();
instance.toWorldCoords(v);
Method: planePlane
Project a plane to another plane.
Parameters
plane: The plane to project to.
Returns
The intersection line between the two planes.
Example
const plane = /* specify a plane */;
const instance = new Plane();
instance.planePlane(plane);