コード例 #1
0
        public void TestMediumSizedModel()
        {
            var mdlFileReader = new MdlFilePolygonDataReader(_inputPath + @"\v.mdl");
            var triangles     = Triangle.GetTrianglesFromPts(mdlFileReader.Points);

            XamlWriter.WritePolygonsToXamlFile("", string.Format(@"{0}\InputModel.xaml", _outputPath), mdlFileReader.Points, false);

            var meshGeometryModel = PaulBourkeSmoother.CreateMeshGeometry3DFromTriangles(triangles);

            XamlWriter.SaveMeshGeometryModel(string.Format(@"{0}\InputModelMeshGeometry.xaml", _outputPath), meshGeometryModel, Color.FromRgb(100, 100, 100));

            var smoothPositions = PaulBourkeSmoother.GetSmoothenedPositions(meshGeometryModel.Positions, meshGeometryModel.TriangleIndices, 6);

            XamlWriter.SavePositionsAndTriangleIndicesAsModel(string.Format(@"{0}\Smoothened_{1}_times.xaml", _outputPath, 6),
                                                              smoothPositions, meshGeometryModel.TriangleIndices, Color.FromRgb(100, 100, 100));
        }
コード例 #2
0
        public void TestGetSmoothenedPositions()
        {
            var mdlFileReader = new MdlFilePolygonDataReader(_inputPath + @"\flowerpetals.mdl");
            var triangles     = Triangle.GetTrianglesFromPts(mdlFileReader.Points);

            XamlWriter.WritePolygonsToXamlFile("", string.Format(@"{0}\InputModel.xaml", _outputPath), mdlFileReader.Points, false);

            var meshGeometryModel = PaulBourkeSmoother.CreateMeshGeometry3DFromTriangles(triangles);

            XamlWriter.SaveMeshGeometryModel(string.Format(@"{0}\InputModelMeshGeometry.xaml", _outputPath), meshGeometryModel, Color.FromRgb(100, 100, 100));

            var currentPositions  = meshGeometryModel.Positions;
            var positionNeighbors = PaulBourkeSmoother.GetPositionNeighbors(currentPositions.Count, meshGeometryModel.TriangleIndices);

            for (var ctr = 1; ctr <= 10; ctr++)
            {
                var newPositions = PaulBourkeSmoother.GetSmoothenedPositions(currentPositions, meshGeometryModel.TriangleIndices, positionNeighbors);
                XamlWriter.SavePositionsAndTriangleIndicesAsModel(string.Format(@"{0}\Smoothing_Iteration_{1}.xaml", _outputPath, ctr),
                                                                  newPositions, meshGeometryModel.TriangleIndices, Color.FromRgb(100, 100, 100));
                currentPositions = newPositions;
            }
        }