Sha256: a185b8753ca7934761dc00ac8e7ad5967e603c3d7a5b00733679cde2b43d7747
Contents?: true
Size: 1010 Bytes
Versions: 11
Compression:
Stored size: 1010 Bytes
Contents
package toxi.geom; /** * * @author tux */ public class BoxIntersector implements Intersector3D { private AABB box; private final IsectData3D isec; /** * * @param box */ public BoxIntersector(AABB box) { this.box = box; this.isec = new IsectData3D(); } /** * @return the box */ public AABB getBox() { return box; } @Override public IsectData3D getIntersectionData() { return isec; } @Override public boolean intersectsRay(Ray3D ray) { final Vec3D pos = box.intersectsRay(ray, 0, Float.MAX_VALUE); isec.pos = pos; isec.isIntersection = pos != null; if (isec.isIntersection) { isec.normal = box.getNormalForPoint(pos); isec.dist = ray.distanceTo(pos); } return isec.isIntersection; } /** * @param box * the box to set */ public void setBox(AABB box) { this.box = box; } }
Version data entries
11 entries across 11 versions & 1 rubygems