Defines a square in two-dimensional coordinates.

Hierarchy

Constructors

Properties

_edges: Line2d[]
_location: Point2d
_vertices: Point2d[]
width: number

Accessors

  • get area(): number
  • Gets the area.

    Returns number

  • get height(): number
  • Returns number

  • set height(value): void
  • Parameters

    • value: number

    Returns void

  • get interiorAngles(): number[]
  • Gets the interior angles.

    Returns number[]

  • get isEquiAngular(): boolean
  • Indicates if the polygon have all corner angles equal.

    Returns boolean

    true if this is the case.

  • get isEquilateral(): boolean
  • Indicates if the polygon have all edges of the same length.

    Returns boolean

    true if this is the case.

  • get perimeter(): number
  • Gets the perimeter.

    Returns number

Methods

  • Checks if the given point is located inside the polygon.

    Parameters

    • point: Point2d

      The reference point.

    Returns boolean

    true if the point is inside the polygon.

  • Checks if the current polygon intersect with the given shape.

    Parameters

    Returns boolean

    true it the two shapes intersect, otherwise false.

  • Checks if the given point is on one edge of the polygon.

    Parameters

    • point: Point2d

      The reference point.

    • threshold: number = 0

      A value used as a threshold / range to check if the point is on one edge.

    Returns boolean

    true if the point is on edge.

  • Rotates the polygon by the given angle in degree, around a point.

    Parameters

    • angle: number

      The rotation angle.

    • origin: Point2d = ...

      The origin from which the rotation is supposed to be done.

    Returns void

Generated using TypeDoc