コード例 #1
0
        public static IVertexSource Transform(this IVertexSource source, Matrix4X4 matrix)
        {
            RectangleDouble bounds = RectangleDouble.ZeroIntersection;

            var output = new VertexStorage();

            foreach (var vertex in source.Vertices())
            {
                var position = new Vector3(vertex.X, vertex.Y, 0);
                position = position.Transform(matrix);
                output.Add(position.X, position.Y, vertex.command);
            }

            return(output);
        }
コード例 #2
0
        public static void Load(VertexStorage vertexSource, string pathAndFileName)
        {
            vertexSource.remove_all();
            string[] allLines = File.ReadAllLines(pathAndFileName);
            foreach (string line in allLines)
            {
                string[] elements = line.Split(',');
                double   x        = double.Parse(elements[0]);
                double   y        = double.Parse(elements[1]);
                ShapePath.FlagsAndCommand flagsAndCommand = (ShapePath.FlagsAndCommand)System.Enum.Parse(typeof(ShapePath.FlagsAndCommand), elements[2].Trim());
                for (int i = 3; i < elements.Length; i++)
                {
                    flagsAndCommand |= (ShapePath.FlagsAndCommand)System.Enum.Parse(typeof(ShapePath.FlagsAndCommand), elements[i].Trim());
                }

                vertexSource.Add(x, y, flagsAndCommand);
            }
        }