33 auto a = Vector3::computeDotProduct(edge0, edge0);
34 auto b = Vector3::computeDotProduct(edge0, edge1);
35 auto c = Vector3::computeDotProduct(edge1, edge1);
36 auto d = Vector3::computeDotProduct(edge0, v0Point);
37 auto e = Vector3::computeDotProduct(edge1, v0Point);
38 auto det = a * c - b * b;
39 auto s = b * e - c * d;
40 auto t = b * d - a * e;
45 s = Math::clamp(-d / a, 0.0f, 1.0f);
49 t = Math::clamp(-e / c, 0.0f, 1.0f);
53 t = Math::clamp(-e / c, 0.0f, 1.0f);
55 }
else if (t < 0.0f) {
56 s = Math::clamp(-d / a, 0.0f, 1.0f);
59 auto invDet = 1.0f / det;
68 auto numer = tmp1 - tmp0;
69 auto denom = a - 2 * b + c;
70 s = Math::clamp(numer / denom, 0.0f, 1.0f);
73 t = Math::clamp(-e / c, 0.0f, 1.0f);
76 }
else if (t < 0.0f) {
78 auto numer = c + e - b - d;
79 auto denom = a - 2 * b + c;
80 s = Math::clamp(numer / denom, 0.0f, 1.0f);
83 s = Math::clamp(-e / c, 0.0f, 1.0f);
87 auto numer = c + e - b - d;
88 auto denom = a - 2 * b + c;
89 s = Math::clamp(numer / denom, 0.0f, 1.0f);
Triangle entity, this is not directly connectable with physics engine.
Triangle()
Public constructor.
void computeClosestPointOnBoundingVolume(const Vector3 &point, Vector3 &closestPoint) const
Compute closest point on bounding volume.
vector< Vector3 > vertices
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & add(float scalar)
Adds a scalar.
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.