Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Space

Contains methods to do operations on points.

Index

Functions

Const area

  • Calculates the area of the triangle determined by three vertices when projected onto a specific plane. Uses Gauss' shoelace formula.

    Parameters

    • a: Point

      The first triangle vertex.

    • b: Point

      The second triangle vertex.

    • c: Point

      The third triangle vertex.

    • j: number

      The first coordinate of the projection plane.

    • k: number

      The second coordinate of the projection plane.

    Returns number

    The area of the triangle when projected onto the plane.

Const collinear

  • Checks if three points are "approximately" collinear.

    Parameters

    Returns boolean

    Whether the angle between b - a and c - a is straight to a given precision.

Const distance

  • Calculates the Euclidean distance between two points.

    Parameters

    Returns number

    The distance between a and b.

Const distanceSq

  • Calculates the squared Euclidean distance between two points. For when you don't need that last square root.

    Parameters

    Returns number

    The squared distance between a and b.

Const intersect

  • Calculates the intersection of two segments. Assumes that these segments are coplanar, but not collinear. Ignores the intersection if it lies outside of the segments, or "too close" to the endpoints.

    Parameters

    • a: Point

      The first endpoint of the first segment.

    • b: Point

      The second endpoint of the first segment.

    • c: Point

      The first endpoint of the second segment.

    • d: Point

      The second endpoint of the second segment.

    Returns Point | null

    The intersection point of segments ab and cd, or null if there's none.

Const sameSlope

  • sameSlope(a: number, b: number, c: number, d: number): boolean
  • Checks if two lines are "approximately" parallel.

    Parameters

    • a: number

      The first coordinate.

    • b: number

      The second coordinate.

    • c: number

      The third coordinate.

    • d: number

      The fourth coordinate.

    Returns boolean

    Whether the line from (0, 0) to (a, b) and the line from (0, 0) to (c, d) have neglibly different slopes.

Generated using TypeDoc, the 1/31/2021 at 6:18:55 AM