- //v.normalize();
- //planeNormal.normalize();
- Vector3d t = new Vector3d();
- t.cross(v,planeNormal);
- t.cross(planeNormal, t);
- return t;
-
+ //v.normalize();
+ //planeNormal.normalize();
+ Vector3d t = new Vector3d();
+ if (planeNormal == X_AXIS) {
+ t.set(0, v.y, v.z);
+ }
+ else if (planeNormal == Y_AXIS) {
+ t.set(v.x, 0, v.z);
+ }
+ else if (planeNormal == Z_AXIS) {
+ t.set(v.x, v.y, 0);
+ }
+ else {
+ t.cross(v,planeNormal);
+ t.cross(planeNormal, t);
+ }
+
+ return t;