plane.fromFrame

The plane through a point with a given x direction, its y axis towards a hint vector.

GeometricSince 0.3.0

Usage

TypeScript
Plane.fromFrame(origin: Point3, xDir: Vector3, xyHint: Vector3): Plane | null

Parameters

  • originPoint3

    The plane’s origin. Required. In model.

  • xDirVector3

    The x axis direction; any non-zero length. Required. In model.

  • xyHintVector3

    Any vector in the plane not parallel to xDir; the y axis lies on its side of the x axis. Required. In model.

Returns

A plane with unit axes, x along xDir, z = x × hint normalised; null when xDir has no direction or xyHint is exactly parallel to it (or zero).

Guarantees

  • the axes are orthonormal and right-handed (Vector3.dot of each pair ≈ 0, Vector3.length of each ≈ 1, Vector3.cross(xAxis, yAxis) ≈ zAxis)
  • xAxis points along xDir (Vector3.angleRad(xAxis, xDir) ≈ 0)
  • the y axis is on the hint’s side (Vector3.dot(yAxis, xyHint) > 0)
  • the origin lies on the plane (Plane.signedDistance(plane, origin) === 0)
  • The same result on every machine.

Use instead

  • plane.fromNormal: only the normal matters and any deterministic x axis will do

Example

TypeScript
const p = Plane.fromFrame(Point3.of(0, 0, 5), Vector3.xAxis, Vector3.yAxis)
p.zAxis // → { x: 0, y: 0, z: 1 }
Plane.fromFrame(Point3.origin, Vector3.xAxis, Vector3.of(2, 0, 0)) // → null

See also