home *** CD-ROM | disk | FTP | other *** search
- class sandy.math.PlaneMath
- {
- function PlaneMath()
- {
- }
- static function get NEGATIVE()
- {
- return -1;
- }
- static function get ON_PLANE()
- {
- return 0;
- }
- static function get POSITIVE()
- {
- return 1;
- }
- static function normalizePlane(plane)
- {
- var _loc2_ = undefined;
- _loc2_ = Math.sqrt(plane.a * plane.a + plane.b * plane.b + plane.c * plane.c);
- plane.a /= _loc2_;
- plane.b /= _loc2_;
- plane.c /= _loc2_;
- plane.d /= _loc2_;
- }
- static function distanceToPoint(plane, pt)
- {
- return plane.a * pt.x + plane.b * pt.y + plane.c * pt.z + plane.d;
- }
- static function classifyPoint(plane, pt)
- {
- var _loc1_ = undefined;
- _loc1_ = sandy.math.PlaneMath.distanceToPoint(plane,pt);
- if(_loc1_ < 0)
- {
- return sandy.math.PlaneMath.NEGATIVE;
- }
- if(_loc1_ > 0)
- {
- return sandy.math.PlaneMath.POSITIVE;
- }
- return sandy.math.PlaneMath.ON_PLANE;
- }
- }
-