@studiokeywi/banjo - v0.0.1
    Preparing search index...

    Class Polygon<Sides>

    A polygon is a convex shape constructed with straight line segments

    Type Parameters

    • Sides extends number = number

    Hierarchy

    Index

    Constructors

    • Create a new polygon

      Type Parameters

      • Sides extends number = number

      Parameters

      • position: Vector2 = ...

        The location of the polygon

      • ...vertices: Vector2[] & { length: Sides }

        The vertices of the polygon

      Returns Polygon<Sides>

    Accessors

    • get angle(): number

      The angle of this polygon

      Returns number

    • get calculatedVertices(): Vector2[]

      The calculated vertices of this polygon

      Returns Vector2[]

    • get normals(): Vector2[]

      The normals of each edge of this polygon

      Returns Vector2[]

    • get vertices(): Vector2[]

      The vertices of this polygon

      Returns Vector2[]

    Methods

    • Get the box that contains this polygon

      Returns Box

      The containing box

    • Get the polygonal representation of the box that contains this polygon

      Returns Quad

      The containing quad

    • Get the location of the geometric center of the polygon

      Returns Vector2

      The centroid's location

    • Rotates the polygon by a given angle

      Parameters

      • radians: number

        The angle to rotate

      Returns this

      This for chaining

    • Sets the angle of the polygon

      Parameters

      • radians: number

        The new angle

      Returns this

      This for chaining

    • Sets the offset of the polygon

      Parameters

      Returns this

      This for chaining

    • Sets the vertices of the polygon

      Parameters

      • ...vertices: Vector2[]

        The new vertices

      Returns this

      This for chaining

    • Translates the polygon by a given vector

      Parameters

      • vector: Vector2

        The translation amount

      Returns this