intersectLine method
Implementation
Vector3? intersectLine(Line3 line, Vector3 target) {
final direction = line.delta(_vector1);
final denominator = normal.dot(direction);
if (denominator == 0) {
// line is coplanar, return origin
if (distanceToPoint(line.start) == 0) {
return target.setFrom(line.start);
}
// Unsure if this is the correct method to handle this case.
return null;
}
final t = -(line.start.dot(normal) + constant) / denominator;
if (t < 0 || t > 1) {
return null;
}
return target.setFrom(direction).scale(t).add(line.start);
}