Usages of

model.Ray.getDirection()

public IntersectionContext trace (Ray ray) { Point3d rayOrigin = toLocal(ray.getOrigin()); Vector3d rayDirection = toLocal(ray.getDirection()); Vector3d normal = new Vector3d(this.normal); double differenceY = -rayOrigin.y; double normalY = 1; double t = differenceY/rayDirection.y; if (normalY*rayDirection.y > 0) { normal.negate(); } if (t > EPS) { Vector3d displacement = new Vector3d(rayDirection); displacement.scale(t); Point3d hitPoint = new Point3d(rayOrigin); hitPoint.add(displacement); Point2d uv = getUVCoordinates(hitPoint); return new IntersectionContext(t, normal, ray, true, uv.x, uv.y); } else return IntersectionContext.noHit(); }
Back to Search Results
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes