I have a virtual box that contain 2 of 3DPoint one the minimum (x,y,z) and the second is the maximun (x,y,z)
I have a ray with center point and direction vector
How can I check if the vector has Intersection with this virtual box
(I have all the method of dotProduct, crossProduct, distance etc.) but I don't know how I need to start find if there are intersection s points,
In the attach image I try to show 2 states, one that the ray has intersection and the other without. How can I find it by code
For now I need to find just boolean if there are intersections points, and I don't need to find actually this points.
public class BoundaryVolume {
public Point3D min;
public Point3D max;
....
public boolean boundingIntersection(Ray ray) {
//Point3D p0 = ray.get_POO();
// Vector v = ray.get_direction();
// Vector v1 = min.subtract(p0);
// Vector v2 = max.subtract(p0);
// double s1 = v.dotProduct(v1.crossProduct(v2).normalized());
// if (isZero(s1)) return false;
}
}
Ray:
public class Ray {
private Point3D _POO;
private Vector _direction;
....
}