home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Esportes
/
CrossingCup.swf
/
scripts
/
__Packages
/
sandy
/
math
/
PlaneMath.as
< prev
next >
Wrap
Text File
|
2007-12-11
|
1KB
|
46 lines
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.__get__NEGATIVE();
}
if(_loc1_ > 0)
{
return sandy.math.PlaneMath.__get__POSITIVE();
}
return sandy.math.PlaneMath.__get__ON_PLANE();
}
}