Defines a triangle in two-dimensional coordinates.

Hierarchy

Constructors

Properties

_edges: Line2d[]
_vertices: Point2d[]

Accessors

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

    Returns number

  • get centroid(): Point2d
  • Gets the center point of the triangle. The intersection of the medians is the centroid.

    Returns Point2d

  • get circumCenter(): Point2d
  • Gets the circumcenter point of the triangle. The circumcenter is the center of a circle passing through the three vertices of the triangle.

    Returns Point2d

  • 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 isIsoceles(): boolean
  • Indicates if the triangle is isoceles.

    Returns boolean

    true if this is the case.

  • get isRight(): boolean
  • Indicates if the triangle is right.

    Returns boolean

    true if this is the case.

  • get orthoCenter(): Point2d
  • Gets the orthocenter point of the triangle. The intersection of the altitudes is the orthocenter.

    Returns Point2d

  • 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.

  • Makes the lines starting from the same point, and go in the same direction.

    Parameters

    Returns Line2d[]

    New set of lines.

  • 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

  • Translates the polygon using the given vector for direction.

    Parameters

    • vector: Vector2d

      The vector defining the direction.

    Returns void

Generated using TypeDoc