A triangle.
Creates a new Tri object.
Optional
The first 3-dimensional vector.
The second 3-dimensional vector.
The third 3-dimensional vector.
const v0 = new pc.Vec3(1, 0, 0);const v1 = new pc.Vec3(0, 1, 0);const v2 = new pc.Vec3(2, 2, 1);const t = new pc.Tri(v0, v1, v2); Copy
const v0 = new pc.Vec3(1, 0, 0);const v1 = new pc.Vec3(0, 1, 0);const v2 = new pc.Vec3(2, 2, 1);const t = new pc.Tri(v0, v1, v2);
The first 3-dimensional vector of the triangle.
The second 3-dimensional vector of the triangle.
The third 3-dimensional vector of the triangle.
Test if a ray intersects with the triangle.
Ray to test against (direction must be normalized).
If there is an intersection, the intersection point will be copied into here.
True if there is an intersection.
Sets the specified triangle to the supplied 3-dimensional vectors.
The value set on the first 3-dimensional vector of the triangle.
The value set on the second 3-dimensional vector of the triangle.
The value set on the third 3-dimensional vector of the triangle.
Self for chaining
const t = new pc.Tri(pc.Vec3.UP, pc.Vec3.RIGHT, pc.Vec3.BACK);const v0 = new pc.Vec3(1, 0, 0);const v1 = new pc.Vec3(0, 1, 0);const v2 = new pc.Vec3(2, 2, 1);t.set(v0, v1, v2);// Outputs [[1, 0, 0], [0, 1, 0], [2, 2, 1]]console.log("The result of the triangle set is: " + t.toString()); Copy
const t = new pc.Tri(pc.Vec3.UP, pc.Vec3.RIGHT, pc.Vec3.BACK);const v0 = new pc.Vec3(1, 0, 0);const v1 = new pc.Vec3(0, 1, 0);const v2 = new pc.Vec3(2, 2, 1);t.set(v0, v1, v2);// Outputs [[1, 0, 0], [0, 1, 0], [2, 2, 1]]console.log("The result of the triangle set is: " + t.toString());
Converts the specified triangle to string form.
The triangle in string form.
const t = new pc.Tri(pc.Vec3.UP, pc.Vec3.RIGHT, pc.Vec3.BACK);// Outputs [[0, 1, 0], [1, 0, 0], [0, 0, 1]]console.log(t.toString()); Copy
const t = new pc.Tri(pc.Vec3.UP, pc.Vec3.RIGHT, pc.Vec3.BACK);// Outputs [[0, 1, 0], [1, 0, 0], [0, 0, 1]]console.log(t.toString());
A triangle.