* @see ca.eandb.jmist.framework.AbstractGeometry#getTextureCoordinates(ca.eandb.jmist.framework.AbstractGeometry.GeometryIntersection)
*/
@Override
protected Point2 getTextureCoordinates(GeometryIntersection x) {
Point2 facePoint;
Point3 p = x.getPosition();
switch (x.getTag())
{
case BOX_SURFACE_MAX_X:
facePoint = new Point2(
(box.maximumZ() - p.z()) / box.lengthX(),
(box.maximumY() - p.y()) / box.lengthY()
);
break;
case BOX_SURFACE_MIN_X:
facePoint = new Point2(
(p.z() - box.minimumZ()) / box.lengthZ(),
(box.maximumY() - p.y()) / box.lengthY()
);
break;
case BOX_SURFACE_MAX_Y:
facePoint = new Point2(
(p.x() - box.minimumX()) / box.lengthX(),
(p.z() - box.minimumZ()) / box.lengthZ()
);
break;
case BOX_SURFACE_MIN_Y:
facePoint = new Point2(
(p.x() - box.minimumX()) / box.lengthX(),
(box.maximumZ() - p.z()) / box.lengthZ()
);
break;
case BOX_SURFACE_MAX_Z:
facePoint = new Point2(
(p.x() - box.minimumX()) / box.lengthX(),
(box.maximumY() - p.y()) / box.lengthY()
);
break;
case BOX_SURFACE_MIN_Z:
facePoint = new Point2(
(p.x() - box.minimumX()) / box.lengthX(),
(p.y() - box.minimumY()) / box.lengthY()
);
break;
default:
throw new IllegalArgumentException("invalid surface id");
}
return new Point2(
FACE_DOMAIN[x.getTag()].minimumX() + facePoint.x() * FACE_DOMAIN[x.getTag()].lengthX(),
FACE_DOMAIN[x.getTag()].minimumY() + facePoint.y() * FACE_DOMAIN[x.getTag()].lengthY()
);
}