Trigon

Home

A Trigon is the building block of a Mesh and contains data for one-sided triangles in 3D space.

See also: Mesh, Vector, Fragment

Constructors

Trigon(v0: Vector, v1: Vector, v2: Vector): Trigon Initializes with the given values for the three points of the triangle.

Variables

Public Variables

v0: Vector The first point of the triangle. See also: Vector
v1: Vector The second point of the triangle. See also: Vector
v2: Vector The third point of the triangle. See also: Vector

Functions

Public Functions

applyTransform(transform: Urbject): Trigon Transforms the Trigon to be in the spacial domain of the given Urbject and returns this. Note: This is NOT the same as transform().

See also: Urbject
copy(): Trigon Returns a copy of the Trigon.
getCenter(): Vector Returns the calculated average of all points in the triangle. See also: Vector
getNormal(): Vector Returns the calculated normal vector of the triangle's face according to the Right-hand Rule. See also: Vector
inverseNormal(): Trigon Inverses the Trigon by swapping the first and second Vector and returns this.
qRotate(q: Quaternion): Trigon Shorthand for quaternionRotate()
quaternionRotate(q: Quaternion): Trigon Rotates the Trigon by the given quaternion and returns this. See also: Quaternion
rotateAxis(axis: number | Vector, angle: number): Trigon Rotates the Trigon around the axis specified by the given angle in radians and returns this. One of the following number constants can also be given as the axis: (Vector.X_AXIS, Vector.Y_AXIS, Vector.Z_AXIS). See also: Vector
rotateX(angle: number): Trigon Rotates the Trigon around the X-Axis by the given angle in radians and returns this.
rotateY(angle: number): Trigon Rotates the Trigon around the Y-Axis by the given angle in radians and returns this.
rotateZ(angle: number): Trigon Rotates the Trigon around the Z-Axis by the given angle in radians and returns this.
transform(M: Array<Array<number>>): Trigon Transforms the Trigon by the given 3 or 4 dimensional transformation matrix and returns this.
translate(v: Vector): Trigon Translates the Trigon by the given vector and returns this. See also: Vector

Static Functions

Trigon.applyTransform(t: Trigon, transform: Urbject): Trigon Transforms a copy of the the given Trigon to be in the spacial domain of the given Urbject and returns the new Trigon. Note: This is NOT the same as Trigon.transform().

See also: Urbject
Trigon.copy(t: Trigon): Trigon Returns a copy of the given Trigon or a new Trigon from an object with all public attributes from the Trigon class.
Trigon.getCenter(t: Trigon): Vector Returns the calculated average of all points in the given Trigon. See also: Vector
Trigon.getNormal(t: Trigon): Vector Returns the calculated normal vector of the triangle's face according to the Right-hand Rule. See also: Vector
Trigon.inverseNormal(t: Trigon): Trigon Copies the Trigon and inverses the normal by swapping the first and second Vector and returns the new Trigon.
Trigon.qRotate(t: Trigon, q: Quaternion): Trigon Shorthand for Trigon.quaternionRotate()
Trigon.quaternionRotate(t: Trigon, q: Quaternion): Trigon Rotates a copy of the Trigon by the given quaternion and returns the new Trigon. See also: Quaternion
Trigon.rotateAxis(t: Trigon, axis: number | Vector, angle: number): Trigon Rotates a copy of the given Trigon around the axis specified by the given angle in radians and returns the new Trigon. One of the following number constants can also be given as the axis: (Vector.X_AXIS, Vector.Y_AXIS, Vector.Z_AXIS). See also: Vector
Trigon.rotateX(t: Trigon, angle: number): Trigon Rotates a copy of the Trigon around the X-Axis by the given angle in radians and returns the new Trigon.
Trigon.rotateY(t: Trigon, angle: number): Trigon Rotates a copy of the Trigon around the Y-Axis by the given angle in radians and returns the new Trigon.
Trigon.rotateZ(t: Trigon, angle: number): Trigon Rotates a copy of the Trigon around the Z-Axis by the given angle in radians and returns the new Trigon.
Trigon.transform(t: Trigon, M: Array<Array<number>>): Trigon Transforms a copy of the Trigon by the given 3 or 4 dimensional transformation matrix and returns the new Trigon.
Trigon.translate(t: Trigon, v: Vector): Trigon Translates a copy of the Trigon by the given vector and returns the new Trigon. See also: Vector

Home

Copyright © 2020 Trevor Richard