Hi Everyone,
I was wondering if anyone has any experience with vector maths espicially with J2ME?
Im currently stuck on two problems:
The first probelm is I need to classify if a point is to the front or backside of a 2D Plane.
Ive implemented it this way:
vect = planeOrign - point;
d = dot(vect,planeNormal)
if( d<-error) return PLANE_FRONT
else( d>error) return PLANE_BACKSIDE
return ON_PLANE
But this sometimes fails so i was wondering if there is an more accurate implementation for this problem.
The second problem is the working out a ray intercept with a 2D plane.
Ive implemented the ray intercept in the standard way:
d = -(planeNormal dot planeOrign);
numer = planeNormal dot rayOrign + d;
denom = planeNormal dot rayDirection;
if denom== 0
return -1;
return -(numer/denom);
but I sometimes get funny results, with the rayDirection normalized or not) where the treturned value is passed one when the should be an intercept
Thanks for any help you can give
P.S if this helps the planeNormal was worked out by:
planeNormal= (pointOnPlane1 - pointOntplane2);
Normalise(planeNormal);
planeNormal[x]=-planeNormal[y];
planeNormal[y]= planeNormal[x];