GetSide() public method

public GetSide ( Vector3D, inPt ) : bool
inPt Vector3D,
return bool
Beispiel #1
0
 public void TestPlaneDistance()
 {
     Random.InitState(123);
     for (int i = 0; i < 1000; i++)
     {
         Vector3  direction  = Random.onUnitSphere;
         float    dist       = Random.Range(-9999, 9999);
         Vector3D directionD = new Vector3D(direction);
         Plane3D  planeD     = new Plane3D(directionD, dist);
         Plane    plane      = new Plane(direction, dist);
         for (int j = 0; j < 10; j++)
         {
             Vector3  pos  = Random.insideUnitSphere * 99999;
             Vector3D posD = new Vector3D(pos);
             double   val1 = plane.GetDistanceToPoint(pos);
             double   val2 = planeD.GetDistanceToPoint(posD);
             Assert.AreEqual(val1, val2, 0.02, "GetDistanceToPoint " + plane);
             Assert.AreEqual(plane.GetSide(pos), planeD.GetSide(posD), "GetSide " + plane);
         }
     }
 }