Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Helper

A class containing helping mathematical methods

Hierarchy

  • Helper

Index

Methods

Static GetAngleBetweenTwoLine

Static GetCordsFromTwoPoint

  • Get a list of coordinates (step: 1px) between two points

    Parameters

    Returns Point[]

Static GetDistanceBetweenTwoPoint

  • GetDistanceBetweenTwoPoint(point1: Point, point2: Point): number
  • Get the distance between two points

    Parameters

    Returns number

Static GetIntersectBeetwenTwoLine

  • Find the intersection point of two lines

    throws

    Error if the segments are on the same line

    Parameters

    Returns Point

    The intersection point, or "null" if it does not exist

Static GetIntersectBetweenTwoSegment

  • Find the intersection of two lines bounded by a rectangle "rectBorder"

    Parameters

    Returns Point

    The intersection point, or "null" if it does not exist, or it lies outside the rectangle "rectBorder"

Static GetRotatedPoint

  • GetRotatedPoint(transformedPoint: Point, startPoint: Point, angle: number): Point
  • Transform point coordinates to a given angle

    Parameters

    • transformedPoint: Point

      Point to rotate

    • startPoint: Point

      Transformation reference point

    • angle: number

      Rotation angle (in radians)

    Returns Point

    Point coordinates after rotation

Static GetSegmentLength

  • GetSegmentLength(segment: Segment): number
  • Get the length of the line segment

    Parameters

    Returns number

Static LimitPointToCircle

  • LimitPointToCircle(startPoint: Point, radius: number, limitedPoint: Point): Point
  • Limit a point "linePoint" to a given circle centered at point "startPoint" and a given radius

    Parameters

    • startPoint: Point

      Circle center

    • radius: number

      Circle radius

    • limitedPoint: Point

      Сhecked point

    Returns Point

    If "linePoint" enters the circle, then its coordinates are returned. Else will be returned the intersection point between the line ([startPoint, linePoint]) and the circle

Static PointInRect

  • Check for a point in a rectangle

    Parameters

    Returns Point

    If the point enters the rectangle its coordinates will be returned, otherwise - null

Generated using TypeDoc