Skip to content

Plane3D ​

com.jsmacrosce.jsmacros.api.math.Plane3D

Since1.6.5

Represents three points in 3D space and derives their edge vectors and normal on demand. The public coordinates are writable, so changing them affects subsequent results. The normal is the unnormalized cross product of the first two edges; its direction follows the points' order and its magnitude is twice the triangle's area. Collinear or repeated points yield a zero normal.

Constructors ​

new Plane3D ​

new Plane3D(double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3)Since1.6.5#
Stores three points used to define the plane. Their order determines the direction of getNormalVector(); collinear or repeated points are accepted but yield a zero normal.

Parameters:

  • x1: the x coordinate of the first point
  • y1: the y coordinate of the first point
  • z1: the z coordinate of the first point
  • x2: the x coordinate of the second point
  • y2: the y coordinate of the second point
  • z2: the z coordinate of the second point
  • x3: the x coordinate of the third point
  • y3: the y coordinate of the third point
  • z3: the z coordinate of the third point

Fields ​

x1 ​

x1: double#
The x coordinate of the first point.

x2 ​

x2: double#
The x coordinate of the second point.

x3 ​

x3: double#
The x coordinate of the third point.

y1 ​

y1: double#
The y coordinate of the first point.

y2 ​

y2: double#
The y coordinate of the second point.

y3 ​

y3: double#
The y coordinate of the third point.

z1 ​

z1: double#
The z coordinate of the first point.

z2 ​

z2: double#
The z coordinate of the second point.

z3 ​

z3: double#
The z coordinate of the third point.

Methods ​

equals ​

equals(Object o): boolean#
Compares the ordered coordinates of all three points; this does not compare the infinite planes or treat reordered points as equivalent. Only the exact same runtime class compares equal. Coordinates use Double.compare(double, double) semantics, including equal NaNs and distinct signed zeroes.

Parameters:

  • o: the value to compare
Returns: true for this instance or an instance of the same class with equal ordered coordinates; false for null or any other value

getNormalVector ​

getNormalVector(): Vec3DSince1.6.5#
Returns the cross product of the first and second edges, as a vector from the origin. Its direction follows the right-hand rule for the points' order, and its magnitude is twice the triangle's area. It is not normalized. Collinear or repeated points yield a zero vector; normalizing that vector produces NaN coordinates.
Returns: a new vector from the origin to this plane's normal, parallel to the right hand rule around the three points in the order they were given

getVec12 ​

getVec12(): Vec3DSince1.6.5#
Returns the edge from the first point to the second.
Returns: a new vector from point one to point two

getVec13 ​

getVec13(): Vec3DSince1.6.5#
Returns the segment from the first point to the third.
Returns: a new vector from point one to point three

getVec23 ​

getVec23(): Vec3DSince1.6.5#
Returns the edge from the second point to the third.
Returns: a new vector from point two to point three

hashCode ​

hashCode(): int#
Computes a hash from the current coordinates of all three ordered points. Since the coordinates are mutable, changing them can change the hash; do not assume this is a stable hash key while the coordinates change.
Returns: the hash of the current coordinates