示例#1
0
        public FlatShape4D ToFlatShape()
        {
            IList <Point3D> points1 = (IList <Point3D>) new List <Point3D>();

            foreach (List <Vector4D> vector4DList in (IEnumerable <Polyline4D>) this.ilist_0)
            {
                foreach (Vector4D vector4D in vector4DList)
                {
                    points1.Add(vector4D.ToPoint3D());
                    Matrix4D?nullable = PolylineShape4D.smethod_0(points1);
                    if (nullable.HasValue)
                    {
                        Matrix4D transpose = nullable.Value.GetTranspose();
                        Point3D  point3D   = points1[0];
                        return(this.method_0(Transformation4D.Translation((Vector3D)point3D) * nullable.Value, transpose * Transformation4D.Translation(-point3D.X, -point3D.Y, -point3D.Z)));
                    }
                }
            }
            if (points1.Count == 0)
            {
                return(new FlatShape4D(ShapeTool.NullShape, this.IsFilled));
            }
            HashSet <Point3D> point3DSet = new HashSet <Point3D>((IEnumerable <Point3D>)points1);

            if (point3DSet.Count == 1)
            {
                Point3D point3D = points1[0];
                return(this.method_0(Transformation4D.Translation((Vector3D)point3D), Transformation4D.Translation(-point3D.X, -point3D.Y, -point3D.Z)));
            }
            IList <Point3D> points2 = (IList <Point3D>) new List <Point3D>((IEnumerable <Point3D>)point3DSet);
            Vector3D        v       = points2[1] - points2[0];

            v.Normalize();
            if (Vector3D.DotProduct(Vector3D.ZAxis, v) != 0.0)
            {
                Point3D point3D1 = points2[0];
                Point3D point3D2 = points2[0];
                if (point3D1.X != point3D2.X)
                {
                    points2.Add(new Point3D(point3D2.X, point3D2.Y, point3D1.Z));
                }
                else
                {
                    if (point3D1.Y == point3D2.Y)
                    {
                        return(this.method_0(Transformation4D.Translation((Vector3D)point3D1) * Transformation4D.RotateX(System.Math.PI / 2.0), Transformation4D.RotateX(-1.0 * System.Math.PI / 2.0) * Transformation4D.Translation(-point3D1.X, -point3D1.Y, -point3D1.Z)));
                    }
                    points2.Add(new Point3D(point3D2.X, point3D2.Y, point3D1.Z));
                }
                Matrix4D?nullable = PolylineShape4D.smethod_0(points2);
                if (!nullable.HasValue)
                {
                    return(new FlatShape4D(ShapeTool.NullShape, this.IsFilled));
                }
                Matrix4D transpose = nullable.Value.GetTranspose();
                Point3D  point3D3  = points2[0];
                return(this.method_0(Transformation4D.Translation((Vector3D)point3D3) * nullable.Value, transpose * Transformation4D.Translation(-point3D3.X, -point3D3.Y, -point3D3.Z)));
            }
            Point3D point3D4 = points2[0];

            return(this.method_0(Transformation4D.Translation((Vector3D)point3D4), Transformation4D.Translation(-point3D4.X, -point3D4.Y, -point3D4.Z)));
        }