예제 #1
0
        public Ellipse TransformCoordinates(CoordinateSystem actualCS, CoordinateSystem newCS)
        {
            Ellipse ellipse = this.ToEllipse();
            Point   point   = new Point(ellipse.Center.X + ellipse.SemimajorAxisVector.X, ellipse.Center.Y + ellipse.SemimajorAxisVector.Y, ellipse.Center.Z + ellipse.SemimajorAxisVector.Z);
            Point   point2  = new Point(ellipse.Center.X + ellipse.SemiminorAxisVector.X, ellipse.Center.Y + ellipse.SemiminorAxisVector.Y, ellipse.Center.Z + ellipse.SemiminorAxisVector.Z);

            ellipse.Center = ellipse.Center.TransformCoordinates(actualCS, newCS);
            point          = point.TransformCoordinates(actualCS, newCS);
            point2         = point2.TransformCoordinates(actualCS, newCS);
            return(Ellipse.ConstructFromConjugateDiameters(ellipse.Center, point, point2));
        }
예제 #2
0
        public Ellipse TransformCoordinates(CoordinateSystem actualCS, CoordinateSystem newCS)
        {
            Point point  = this.Center;
            Point point2 = point + this.vector3d_0.ToPoint();
            Point point3 = point + this.vector3d_1.ToPoint();

            point  = point.TransformCoordinates(actualCS, newCS);
            point2 = point2.TransformCoordinates(actualCS, newCS);
            point3 = point3.TransformCoordinates(actualCS, newCS);
            return(Ellipse.ConstructFromConjugateDiameters(point, point2, point3));
        }
예제 #3
0
        public Ellipse Scale(Point center, double scaleX, double scaleY, double scaleZ)
        {
            Ellipse ellipse = this.ToEllipse();
            Point   m       = ellipse.Center.Scale(center, scaleX, scaleY, scaleZ);
            Edge    edge    = ellipse.MajorAxis.Scale(center, scaleX, scaleY, scaleZ);
            Edge    edge2   = ellipse.MinorAxis.Scale(center, scaleX, scaleY, scaleZ);

            if (edge.Length < Global.AbsoluteEpsilon | edge2.Length < Global.AbsoluteEpsilon)
            {
                throw new ArgumentException("Can not construct ellipse: scale factor is too small!");
            }
            if (edge.IsCollinearTo(edge2))
            {
                throw new ArgumentException("Can not construct ellipse: scale factor is too small!");
            }
            return(Ellipse.ConstructFromConjugateDiameters(m, edge.EndPoint, edge2.EndPoint));
        }
예제 #4
0
        public Ellipse ProjectParallelOn(Plane plane, Vector3d viewDirection)
        {
            if (viewDirection.IsOrthogonalTo(plane.NormalVector))
            {
                throw new ArgumentException("View direction parallel to projection plane!");
            }
            if (viewDirection.IsOrthogonalTo(this.NormalVector))
            {
                throw new ArgumentException("View direction parallel to circle!");
            }
            Point point  = this.point_0 + this.SemimajorAxisVector.ToPoint();
            Point point2 = this.Center + this.SemiminorAxisVector.ToPoint();
            Point p      = point.ProjectParallelOn(plane, viewDirection);
            Point q      = point2.ProjectParallelOn(plane, viewDirection);
            Point m      = this.Center.ProjectParallelOn(plane, viewDirection);

            return(Ellipse.ConstructFromConjugateDiameters(m, p, q));
        }
예제 #5
0
        public static List <Ellipse> TransformCoordinates(List <Ellipse> ellipses, CoordinateSystem actualCS, CoordinateSystem newCS)
        {
            Matrix3d       basisVectorMatrix  = actualCS.BasisVectorMatrix;
            Matrix3d       basisVectorMatrix2 = newCS.BasisVectorMatrix;
            Point          b     = actualCS.Origin - newCS.Origin;
            Matrix3d       a     = basisVectorMatrix2.Invert() * basisVectorMatrix;
            Point          right = basisVectorMatrix2.Invert() * b;
            List <Ellipse> list  = new List <Ellipse>(ellipses.Count);

            for (int i = 0; i < ellipses.Count; i++)
            {
                Point point  = ellipses[i].point_0;
                Point point2 = point + ellipses[i].vector3d_0.ToPoint();
                Point point3 = point + ellipses[i].vector3d_1.ToPoint();
                point  = a * point + right;
                point2 = a * point2 + right;
                point3 = a * point3 + right;
                list.Add(Ellipse.ConstructFromConjugateDiameters(point, point2, point3));
            }
            return(list);
        }