Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vertices

The 'Vertices' is the class for manipulating sets of vertices

Hierarchy

  • Vertices

Index

Constructors

constructor

Methods

Static area

  • area(vertices: Vector[]): number
  • Returns the area of the given set of vertices.

    Parameters

    Returns number

    The area of the given set of vertices

Static center

  • Returns the centroid of the given set of vertices.

    Parameters

    Returns Vector

    The centroid of the given set of vertices

Static contains

  • Returns true if the given set of vertices contains the given point and false if not.

    Parameters

    Returns boolean

    True if the given set of vertices contains the given point and false if not

Static create

Static decomp

  • decomp(vertices: Vector[], rmCollinearPoints?: boolean, minArea?: number): Vertex[][]

Static hull

  • Returns the convex hull of the given set of vertices.

    Parameters

    Returns Vector[]

    The convex hull of the given set of vertices

Static inertia

  • inertia(vertices: Vector[]): number
  • Returns the inertia of the given set of vertices.

    Parameters

    Returns number

    The inertia of the given set of vertices

Static isConvex

  • isConvex(vertices: Vector[]): undefined | boolean
  • Returns true if the given set of vertices is a convex polygon (vertices must be in the clockwise winding).

    Parameters

    Returns undefined | boolean

    Еrue if the given set of vertices is a convex polygon (vertices must be in the clockwise winding)

Static normals

  • normals(vertices: Vector[], normals?: Vector[], lengths?: number[]): { lengths: number[]; normals: Vector[] }
  • Creates array of normals and lengths of the given set of vertices.

    Parameters

    • vertices: Vector[]
    • normals: Vector[] = []
    • lengths: number[] = []

    Returns { lengths: number[]; normals: Vector[] }

    The object that contains normals and lengths of vertices

    • lengths: number[]
    • normals: Vector[]

Static rotate

  • Rotates the given set of vertices by the given angle around the given point.

    Parameters

    Returns Vector[]

    The vertices

Static scale

Static translate

Generated using TypeDoc