14 constexpr float kEpsilon = 1e-6f;
38 const float a = e1.
dot(h);
39 if (a > -kEpsilon && a < kEpsilon) {
43 const float f = 1.0f / a;
45 const float u = f * s.
dot(h);
46 if (u < 0.0f || u > 1.0f) {
52 if (v < 0.0f || u + v > 1.0f) {
56 const float t = f * e2.
dot(q);
68 std::ostringstream stream;
69 stream <<
"[[" << _v0.getX() <<
", " << _v0.getY() <<
", " << _v0.getZ()
70 <<
"], [" << _v1.getX() <<
", " << _v1.getY() <<
", " << _v1.getZ()
71 <<
"], [" << _v2.getX() <<
", " << _v2.getY() <<
", " << _v2.getZ() <<
"]]";
Infinite ray defined by origin and direction for raycasting and picking.
const Vector3 & origin() const
const Vector3 & direction() const
bool intersectsRay(const Ray &ray, Vector3 *point=nullptr) const
const Vector3 & v2() const
std::string toString() const
const Vector3 & v0() const
Tri & set(const Vector3 &v0, const Vector3 &v1, const Vector3 &v2)
const Vector3 & v1() const
3D vector for positions, directions, and normals with multi-backend SIMD acceleration.
Vector3 cross(const Vector3 &other) const
float dot(const Vector3 &other) const