예제 #1
0
        internal MyPolygon PerformProjection(ProjectionType type)
        {
            var newVertextes = new List <Point3D>();

            foreach (var vertex in vertexes)
            {
                switch (type)
                {
                default:
                case ProjectionType.ORTHOGRAPHIC:
                    newVertextes.Add(Transformations.Orthographic(vertex));
                    break;

                case ProjectionType.OBLIQUE:
                    newVertextes.Add(Transformations.Oblique(vertex));
                    break;

                case ProjectionType.PERSPECTIVE:
                    newVertextes.Add(Transformations.Perspective(vertex));
                    break;
                }
            }

            var newVertexIndexes = vertexIndexes;
            var newPoly          = new Polygon {
                Stroke = Brushes.Black, StrokeThickness = 1, Fill = this.poly.Fill
            };

            newPoly.Points = ShapesHelper.BuildPointCollection(newVertextes);

            return(new MyPolygon(newPoly, newVertextes, newVertexIndexes));
        }
예제 #2
0
        internal void Transition(Axis axis, double value)
        {
            var newVertextes = new List <Point3D>();

            foreach (var vertex in vertexes)
            {
                newVertextes.Add(Transformations.Transition(vertex, axis, value));
            }
            vertexes    = newVertextes;
            poly.Points = ShapesHelper.BuildPointCollection(newVertextes);
        }
예제 #3
0
        internal void Scale(double scaleValue)
        {
            var newVertextes = new List <Point3D>();

            foreach (var vertex in vertexes)
            {
                newVertextes.Add(Transformations.Scale(vertex, scaleValue));
            }
            vertexes    = newVertextes;
            poly.Points = ShapesHelper.BuildPointCollection(newVertextes);
        }
        private void AddPolygonToList(string[] vals)
        {
            int[]          vertexIndexes  = Array.ConvertAll(vals, int.Parse);
            List <Point3D> tempVertexList = new List <Point3D>();

            foreach (var idx in vertexIndexes)
            {
                tempVertexList.Add(vertexList[idx]);
            }

            var poly = new Polygon {
                Stroke = Brushes.Black, StrokeThickness = 1, Fill = Brushes.White
            };

            poly.Points = ShapesHelper.BuildPointCollection(tempVertexList);
            polygonList.Add(new MyPolygon(poly, tempVertexList, vertexIndexes));
        }