Plane
A 3D plane defined by the equation ax + by + cz + d = 0.
Every face in SketchUp lies on a plane, and the Plane class
gives you tools to work with that surface mathematically —
computing distances from points, getting the normal direction,
or transforming the plane along with geometry.
The constructor normalizes the coefficients so that
(a, b, c) is always a unit vector (the plane’s normal).
You can also create planes from a point and normal using
Plane.fromPlaneLike(), or fit a plane through a set of
vertices with Plane.fromVertices().
Example
Section titled “Example”let { Plane, Point3d } = SketchUpApi;
// A plane at z = 10 (normal pointing up)let floor = new Plane(0, 0, 1, -10);console.log(floor.normal.to_a);// => [0, 0, 1]console.log(floor.origin.toArray());// => [0, 0, 10]
// Distance from a point to the planelet pt = new Point3d(5, 5, 25);console.log(floor.distance(pt));// => 15SDK 2.16.0 Protocol 1.13.0
Constructor
Section titled “Constructor”Constructor
Section titled “Constructor”new Plane(
a?,b?,c?,d?):Plane
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Returns
Section titled “Returns”Plane
Properties
Section titled “Properties”
readonlya:number=0
readonlyb:number=0
readonlyc:number=0
readonlyd:number=0
Accessors
Section titled “Accessors”normal
Section titled “normal”Get Signature
Section titled “Get Signature”get normal():
Vector3d
A unit vector perpendicular to this plane, pointing in the “front” direction.
SDK 2.17.0
Returns
Section titled “Returns”origin
Section titled “origin”Get Signature
Section titled “Get Signature”get origin():
Point3d
The point on the plane closest to the world origin — i.e.
the perpendicular projection of [0, 0, 0] onto the plane.
SDK 2.25.0
Returns
Section titled “Returns”reverse
Section titled “reverse”Get Signature
Section titled “Get Signature”get reverse():
Plane
A new plane with the normal flipped (same surface, opposite front/back orientation).
SDK 2.25.0
Returns
Section titled “Returns”Plane
Methods
Section titled “Methods”applyTransform()
Section titled “applyTransform()”applyTransform(
transform):Plane
Returns a new plane transformed by the given transformation (rotation, translation, or scale). The original plane is unchanged.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
‐ |
Returns
Section titled “Returns”Plane
distanceToPoint()
Section titled “distanceToPoint()”distanceToPoint(
pointLike):number
The perpendicular distance from a point to this plane, in inches. Always returns a non-negative value.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”number
SDK 2.37.0
projectPoint()
Section titled “projectPoint()”projectPoint(
pointLike):Point3d
Return closest point on this plane to the given point.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”SDK 2.37.0
signedDistanceToPoint()
Section titled “signedDistanceToPoint()”signedDistanceToPoint(
pointLike):number
The perpendicular distance from a point to this plane, in inches.
Positive if the point is “above” the plane, negative otherwise.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”number
SDK 2.37.0
toArray()
Section titled “toArray()”toArray(): [
number,number,number,number]
Returns the coefficients as an [a, b, c, d] tuple.
Returns
Section titled “Returns”[number, number, number, number]
SDK 2.35.0
toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string
create()
Section titled “create()”
staticcreate(input):Plane
Creates a Plane from any PlaneLike value — four
coefficients [a, b, c, d], a [point, normal] pair, or
an existing Plane instance.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”Plane
Example
Section titled “Example”let { Plane } = SketchUpApi;// Simple plane on z = 5let plane = Plane.create([0, 0, 1, -5]);
// Plane(0,0,1,-5)console.log(plane.toString());SDK 2.37.0
fromVertices()
Section titled “fromVertices()”
staticfromVertices(vertices):Plane|undefined
Fits a plane through three or more points using a least-squares
algorithm. Returns undefined if the points are collinear or
don’t all lie on the same plane within tolerance.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
readonly |
at least 3 points |
Returns
Section titled “Returns”Plane | undefined
a plane or undefined (if there is no plane that fits the inputs)
Example
Section titled “Example”let { Plane } = SketchUpApi;let plane = Plane.fromVertices( [ [0, 100, 5], [100, 100, 5], [0, 50, 100] ]);// TODOconsole.log(plane.toString());SDK 2.25.0
Deprecated
Section titled “Deprecated”Get Signature
Section titled “Get Signature”get to_a(): [
number,number,number,number]
Returns
Section titled “Returns”[number, number, number, number]
distance()
Section titled “distance()”distance(
pointLike):number
The perpendicular distance from a point to this plane, in inches. Always returns a non-negative value.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”number
fromPlaneLike()
Section titled “fromPlaneLike()”
staticfromPlaneLike(planeOrArray):Plane
Creates a Plane from any PlaneLike value — four
coefficients [a, b, c, d], a [point, normal] pair, or
an existing Plane instance.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
‐ |
Returns
Section titled “Returns”Plane