CornerPoints
Properties
topLeft(dynamic)topRight(dynamic)bottomLeft(dynamic)bottomRight(dynamic)
Constructor
new CornerPoints(): CornerPointsInstance Methods
toArray(): Array.<Vector>
Returns the points in the order of topLeft, topRight, bottomLeft, bottomRight
Returns
Array.<Vector>
toClockwiseOutlineArray(): Array.<Vector>
Returns the points in the order of topLeft, topRight, bottomRight, bottomLeft That is, clockwise from the top left corner
Returns
Array.<Vector>
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(): Array.<float>
Returns
Array.<float>
computeDiagonalLengths(): Array.<float>
Returns
Array.<float>
getCenter(): Vector
Returns
getBounds(): Array.<Vector>
Returns
Array.<Vector>
copy(): CornerPoints
Returns
subtract(vect: Vector): CornerPoints
Parameters
vect(Vector)
Returns
add(vect: Vector): CornerPoints
Parameters
vect(Vector)
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).
Parameters
parallelogramTolerance(float, optional, default: 0.03) — max allowed difference between the top and bottom edges, as a fraction of the top edge's length - 0 would require an exact parallelogramperpendicularityTolerance(float, optional, default: 0.05) — max allowed |cos| of the angle between the top and left edges - 0 would require them to be exactly perpendicular
Returns
boolean
isMirroredOnCanvas(): boolean
Whether this quad's corners, read as canvas points (y down), are mirrored - its topRight lies clockwise-before its bottomLeft around topLeft instead of after, as it would for an unflipped rectangle. True when exactly one axis has been flipped (e.g. by a negative scale), false for an unflipped quad or one flipped on both axes (which is just a 180 degree rotation).
Returns
boolean