Usages of

.getPoint(?)
public Vector getNormal(Ray ray, float t) { return (ray.getPoint(t).sub(origin)).normalize(); }
@Override public Hit getHit(Ray ray) { List<Hit> hits = new ArrayList<Hit>(); for (Plane plane : planes) { Hit hit = plane.getHit(ray); if (hit != null) { Vector raypoint = ray.getPoint(hit.getT()); if ((ray.getOrigin().sub(raypoint)).dot(plane.getN()) > -Constants.EPSILON) { hits.add(hit); } } } Hit farthest = null; // farthest hit for (Hit hit : hits) { if(farthest == null){ farthest = hit; }else if (farthest != null && farthest.getT() > hit.getT()) { farthest = hit; } } // now check whether the point is legal if (farthest != null) { Vector raypoint = ray.getPoint(farthest.getT()); if (raypoint.x + Constants.EPSILON >= Math.min(pMin.x, pMax.x) && raypoint.x - Constants.EPSILON <= Math.max(pMin.x, pMax.x) && raypoint.y + Constants.EPSILON >= Math.min(pMin.y, pMax.y) && raypoint.y - Constants.EPSILON <= Math.max(pMin.y, pMax.y) && raypoint.z + Constants.EPSILON >= Math.min(pMin.z, pMax.z) && raypoint.z - Constants.EPSILON <= Math.max(pMin.z, pMax.z)) { return farthest; } } return null; }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes