示例#1
0
 public override Polynom GetImplicitPolynomial()
 {
     if (implicitPolynomial == null)
     {
         PolynomVector w = zAxis ^ (location.ToVector() - PolynomVector.xyz);       // the distance of a point to the axis
         Polynom       l = zAxis * PolynomVector.xyz - zAxis * location.ToVector(); // the distance from location along the axis
         //(w*w)/(l*l)==(xAxis*xAxis)/(zAxis*zAxis) == tan(half opening angle)
         implicitPolynomial = (w * w) - ((xAxis * xAxis) / (zAxis * zAxis)) * (l * l);
         double   d1 = implicitPolynomial.Eval(PointAt(new GeoPoint2D(0.5, 0.5)));
         double   d2 = implicitPolynomial.Eval(PointAt(new GeoPoint2D(10, -10)));
         GeoPoint p  = PointAt(new GeoPoint2D(1, 0)) + GetNormal(new GeoPoint2D(1, 0)).Normalized; // a point with distance 1 from the cone
         double   d  = implicitPolynomial.Eval(p);                                                 // this should be 1
         implicitPolynomial = (1 / d) * implicitPolynomial;                                        // OK, this makes a good scaling (but it is not the distance)
     }
     return(implicitPolynomial);
 }
示例#2
0
 public override Polynom GetImplicitPolynomial()
 {
     if (implicitPolynomial == null)
     {
         PolynomVector x = (new GeoVector(center.x, center.y, center.z) - PolynomVector.xyz);
         implicitPolynomial = (x * x) - xAxis * xAxis;
         // we need to scale the implicit polynomial so that it yields the true distance to the surface
         GeoPoint p = center + xAxis + xAxis.Normalized; // a point outside the sphere with distance 1
         double   d = implicitPolynomial.Eval(p);        // this should be 1 when the polynomial is normalized
         if ((xAxis ^ yAxis) * zAxis < 0)
         {
             d = -d;                                        // inverse oriented sphere
         }
         implicitPolynomial = (1 / d) * implicitPolynomial; // normalize the polynomial
     }
     return(implicitPolynomial);
 }
示例#3
0
 public override Polynom GetImplicitPolynomial()
 {
     if (implicitPolynomial == null)
     {
         GeoVector     zNormed = zAxis.Normalized;
         PolynomVector x       = zNormed ^ (new GeoVector(location.x, location.y, location.z) - PolynomVector.xyz);
         implicitPolynomial = (x * x) - xAxis * xAxis;
         // we need to scale the implicit polynomial so that it yields the true distance to the surface
         GeoPoint p = location + xAxis + xAxis.Normalized; // a point outside the cylinder with distance 1
         double   d = implicitPolynomial.Eval(p);          // this should be 1 when the polynomial is normalized
         if ((xAxis ^ yAxis) * zAxis < 0)
         {
             d = -d;                                        // inverse oriented cylinder
         }
         implicitPolynomial = (1 / d) * implicitPolynomial; // normalize the polynomial
     }
     return(implicitPolynomial);
 }