CornerPoints

Properties

  • topLeft (dynamic)
  • topRight (dynamic)
  • bottomLeft (dynamic)
  • bottomRight (dynamic)

Constructor

new CornerPoints(): CornerPoints

Instance Methods

toArray(): dynamic

Returns the points in the order of topLeft, topRight, bottomLeft, bottomRight

Returns

  • dynamic

toClockwiseOutlineArray(): dynamic

Returns the points in the order of topLeft, topRight, bottomRight, bottomLeft That is, clockwise from the top left corner

Returns

  • dynamic

setPointByIndex(index: integer, newValue: Vector): void

Parameters

  • index (integer)
  • newValue (Vector)

Returns

  • void

getNormal(): Vector

Returns

getAvgWidth(): float

Returns

  • float

getMaxWidth(): float

Returns

  • float

getAvgHeight(): float

Returns

  • float

getMaxHeight(): float

Returns

  • float

getAvgRotation(): float

Returns

  • float

getRotationOfTopLeftBottomRightDiagonal( originalDiagonal?: Vector, ): float

Parameters

  • originalDiagonal (Vector, optional, default: "BGE.Math.VectorOps.create(1, 0, 0)")

Returns

  • float

getRotationOfTopRightBottomLeftDiagonal( originalDiagonal?: Vector, ): float

Parameters

  • originalDiagonal (Vector, optional, default: "BGE.Math.VectorOps.create(1, 0, 0)")

Returns

  • float

computeSideLengths(): dynamic

Returns

  • dynamic

computeDiagonalLengths(): dynamic

Returns

  • dynamic

getCenter(): Vector

Returns

getBounds(): dynamic

Returns

  • dynamic

copy(): CornerPoints

Returns

subtract(vect: Vector): CornerPoints

Parameters

Returns

add(vect: Vector): CornerPoints

Parameters

Returns

toStr(): string

Returns

  • string

isApproximatelyRotatedRectangle( parallelogramTolerance?: float, perpendicularityTolerance?: float, ): boolean

Whether this quad is well-approximated by a rotation plus non-uniform scale of an axis-aligned rectangle anchored at topLeft - i.e. its edges form a parallelogram with perpendicular adjacent sides. True for a billboard rotated only about the axis facing the camera (in-plane rotation, at any angle) or not rotated at all; false once perspective foreshortening skews the quad into a general trapezoid (e.g. a disc tilted away from the camera on another axis). Used by SceneObjectCircle (issue #105) to decide between a cheap rotate+scale blit (Renderer.drawTransformedObjectTo, correct only for the true case) and the exact drawPinnedCorners warp (correct for any quad).

bottom edges, as a fraction of the top edge's length - 0 would require an exact parallelogram the top and left edges - 0 would require them to be exactly perpendicular

Parameters

  • parallelogramTolerance (float, optional, default: 0.03) — max allowed difference between the top and
  • perpendicularityTolerance (float, optional, default: 0.05) — max allowed |cos| of the angle between

Returns

  • boolean