Exemple #1
0
 public bool IsParallelTo(Ellipse ellipse)
 {
     return(this.NormalVector.IsParallelTo(ellipse.NormalVector));
 }
Exemple #2
0
        public static Ellipse ConstructFromConjugateDiameters(Point M, Point P, Point Q)
        {
            Ellipse result;

            try
            {
                if (P.DistanceTo(M) > Q.DistanceTo(M))
                {
                    Point point = P.DeepCopy();
                    P = Q.DeepCopy();
                    Q = point.DeepCopy();
                }
                Vector3d vector3d  = new Vector3d(Q - M);
                Vector3d vector3d2 = new Vector3d(P - M);
                if (vector3d2.IsOrthogonalTo(vector3d))
                {
                    result = new Ellipse(M, vector3d, vector3d2);
                }
                else
                {
                    Plane plane = new Plane(M, P, Q);
                    plane.Normalize();
                    Matrix3d rotationMatrix = Matrix3d.RotationArbitraryAxis(plane.NormalVector, 1.5707963267948966);
                    Point    point2         = P.Rotate(M, rotationMatrix);
                    if (Vector3d.Angle(vector3d, new Vector3d(point2 - M)) > 1.5707963267948966)
                    {
                        point2 = -1.0 * (point2 - M) + M;
                    }
                    Point  midPoint = new Edge(point2, Q).MidPoint;
                    Circle circle   = new Circle(midPoint, M.DistanceTo(midPoint), plane.NormalVector);
                    Plane  plane2   = new Plane(midPoint, new Vector3d(point2 - midPoint), plane.NormalVector);
                    plane2.Normalize();
                    Edge   edge = plane2.method_5(circle);
                    double num  = Q.DistanceTo(edge.StartPoint);
                    double num2 = Q.DistanceTo(edge.EndPoint);
                    if (num < num2)
                    {
                        num  = num2;
                        num2 = Q.DistanceTo(edge.StartPoint);
                    }
                    Vector3d vector3d3 = new Vector3d(edge.EndPoint - M);
                    Vector3d vector3d4 = new Vector3d(edge.StartPoint - M);
                    if (vector3d4.Norm > vector3d3.Norm)
                    {
                        vector3d3 = new Vector3d(edge.StartPoint - M);
                        vector3d4 = new Vector3d(edge.EndPoint - M);
                    }
                    vector3d3.Norm = num;
                    vector3d4.Norm = num2;
                    Ellipse ellipse = new Ellipse();
                    ellipse.point_0 = M;
                    if (vector3d3.Norm >= vector3d4.Norm)
                    {
                        ellipse.vector3d_0 = vector3d3;
                        ellipse.vector3d_1 = vector3d4;
                    }
                    else
                    {
                        ellipse.vector3d_0 = vector3d4;
                        ellipse.vector3d_1 = vector3d3;
                    }
                    result = ellipse;
                }
            }
            catch (System.Exception ex)
            {
                throw new ArithmeticException("Rytz construction failed due to numerical problems:\n" + ex.Message);
            }
            return(result);
        }
Exemple #3
0
 public bool IsCoplanarTo(Ellipse ellipse)
 {
     return(this.GetPlane() == ellipse.GetPlane());
 }
Exemple #4
0
 public bool Intersects3d(Ellipse ellipse)
 {
     return(this.method_8(ellipse) != null);
 }
Exemple #5
0
 public bool IsParallelTo(Ellipse ellipse)
 {
     return(this.vector3d_0.IsOrthogonalTo(ellipse.NormalVector));
 }
Exemple #6
0
 public bool IsCoplanarTo(Ellipse ellipse)
 {
     return(Plane.smethod_0(ellipse.Center, ellipse.NormalVector, this.point_0) && ellipse.NormalVector.IsOrthogonalTo(this.vector3d_0));
 }
Exemple #7
0
        public bool Intersects2d(Ellipse ellipse)
        {
            PointSet pointSet = this.method_2(ellipse);

            return(pointSet != null && pointSet.Count != 0);
        }