BGE/Math/BGE/Math/TriangleOps

Alias: BGE.Math.BGE.Math.TriangleOps


Static Methods

create( points: Array.<BGE.Math.Vector>, rearrangeToLongestFirst?: boolean, ): BGE.Math.Triangle

static

Creates a BGE.Math.Triangle object from 3 points

Parameters

  • points (Array.<BGE.Math.Vector>) — Array of points in counter clockwise winding (i.e. follows right-hand-rule)
  • rearrangeToLongestFirst (boolean, optional, default: false) — if true, the points in the triangle will be rearranged so that the longest side is between points[0] and points[1]

Returns

  • BGE.Math.Triangle

setPoints( tri: BGE.Math.Triangle, points: Array.<BGE.Math.Vector>, rearrangeToLongestFirst?: boolean, ): void

static

Sets the points of a BGE.Math.Triangle and calculates all related properties (lengths, angles, longest side, height, etc). The points should be in counter clockwise winding (i.e. follow right-hand-rule)

Parameters

  • tri (BGE.Math.Triangle)
  • points (Array.<BGE.Math.Vector>)
  • rearrangeToLongestFirst (boolean, optional, default: false)

Returns

  • void

getLongestSide(tri: BGE.Math.Triangle): float

static

Gets the length of the longest side of a triangle

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • float

isObtuse(tri: BGE.Math.Triangle): boolean

static

True if there is any angle greater than 90degrees

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • boolean

isAcute(tri: BGE.Math.Triangle): boolean

static

True if all angles are less than 90degrees

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • boolean

getOriginIndex(tri: BGE.Math.Triangle): integer

static

Gets the index of the origin point (0,0) in the triangle

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • integer — will return -1 if no point is at the origin

getHeightByTangentIndex( tri: BGE.Math.Triangle, tangentIndex: integer, ): float

static

Gets the height of the triangle based on the length of the side at tangentIndex and the angle at tangentIndex

Parameters

  • tri (BGE.Math.Triangle)
  • tangentIndex (integer)

Returns

  • float

nextIndex(currentIndex: integer): integer

static

Gets the next index in the triangle (0,1,2) given a current index

Parameters

  • currentIndex (integer)

Returns

  • integer

previousIndex(currentIndex: integer): integer

static

Gets The previous index in the triangle (0,1,2) given a current index

Parameters

  • currentIndex (integer)

Returns

  • integer

getMidpointOfSide( tri: BGE.Math.Triangle, sideIndex: integer, ): BGE.Math.Vector

static

Gets the midpoint of the side starting at th the given index

Parameters

  • tri (BGE.Math.Triangle)
  • sideIndex (integer)

Returns

  • BGE.Math.Vector

getPerpendicularFootOfHeight(tri: BGE.Math.Triangle): dynamic

static

Gets information related to the the perpendicular foot of the triangle. That is, the point on the largest side that cuts the triangle into 2 right triangles

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • dynamic

getPerpendicularFootFromPoint( linePoint1: BGE.Math.Vector, linePoint2: BGE.Math.Vector, point: BGE.Math.Vector, ): dynamic

static

Parameters

  • linePoint1 (BGE.Math.Vector)
  • linePoint2 (BGE.Math.Vector)
  • point (BGE.Math.Vector)

Returns

  • dynamic

toStr(tri: BGE.Math.Triangle): string

static

Parameters

  • tri (BGE.Math.Triangle)

Returns

  • string

getThirdRightTrianglePoint( aPoint: BGE.Math.Vector, bPoint: BGE.Math.Vector, aAngle: float, ): BGE.Math.Vector

static

Gets third point in triangle

?-----B | / | | / | |a/c | A ----| <--- this point is grid aligned, point "?" could be anywhere

Parameters

  • aPoint (BGE.Math.Vector)
  • bPoint (BGE.Math.Vector)
  • aAngle (float)

Returns

  • BGE.Math.Vector