Method for SpotLight

I hope it can be useful to somebody…



/**

    * <code>intersectsPoint</code> determines  if the given  point is in the cone of the SpotLight. Returns true if the point is in the cone, false otherwise.

    * @param point The point to be intersected.

    */



public boolean intersectsPoint(Vector3f point){

Ray r = new Ray(this.getLocation(),this.getDirection());

float distanceFromAxis = Distance.distance(point,r);

float distanceFromOrigin = Distance.distance(point,r.getOrigin());

float angle = FastMath.asin(distanceFromAxis/distanceFromOrigin)*FastMath.RAD_TO_DEG;

if(this.getAngle()>angle)

return true;

else

return false;

}





Maybe it's stupid, but it's my first code post  XD

Actually, this is a pretty useful method. It could very well make it in soon. :wink:

Thanks  :smiley: