コード例 #1
0
            public void UnfoldAndLabelTallCone()
            {
                // unfold cube
                Solid       testcone = UnfoldTestUtils.SetupTallCone();
                List <Face> faces    = testcone.Faces.ToList();
                var         surfaces = faces.Select(x => x.SurfaceGeometry()).ToList();
                //handle tesselation here
                var pointtuples = Tesselation.Tessellate(surfaces, -1, 512);
                //convert triangles to surfaces
                List <Surface> trisurfaces = pointtuples.Select(x => Surface.ByPerimeterPoints(new List <Point>()
                {
                    x[0], x[1], x[2]
                })).ToList();


                var unfoldObject = PlanarUnfolder.Unfold(trisurfaces);

                Console.WriteLine("generating tabs");

                // generate tabs
                var tabDict  = TabGeneration.GenerateTabSurfacesFromUnfold <EdgeLikeEntity, FaceLikeEntity>(unfoldObject);
                var justTabs = tabDict.Keys.SelectMany(x => tabDict[x]).ToList();

                Console.WriteLine("tabs generated");
                // next check the positions of the translated tab,

                UnfoldTestUtils.AssertTabsGoodFinalLocation <EdgeLikeEntity, FaceLikeEntity>(justTabs, unfoldObject);
            }
コード例 #2
0
            public void UnfoldAndLabelTallCone()
            {
                // unfold cube
                Solid       testcone = UnfoldTestUtils.SetupTallCone();
                List <Face> faces    = testcone.Faces.ToList();
                var         surfaces = faces.Select(x => x.SurfaceGeometry()).ToList();
                //handle tesselation here
                var pointtuples = Tesselation.Tessellate(surfaces, -1, 512);
                //convert triangles to surfaces
                List <Surface> trisurfaces = pointtuples.Select(x => Surface.ByPerimeterPoints(new List <Point>()
                {
                    x[0], x[1], x[2]
                })).ToList();


                var unfoldObject = PlanarUnfolder.Unfold(trisurfaces);

                var unfoldsurfaces = unfoldObject.UnfoldedSurfaceSet;

                Console.WriteLine("generating labels");

                // generate labels
                var labels = unfoldObject.StartingUnfoldableFaces.Select(x =>
                                                                         new PlanarUnfolder.UnfoldableFaceLabel <EdgeLikeEntity, FaceLikeEntity>(x)).ToList();

                UnfoldTestUtils.AssertLabelsGoodStartingLocationAndOrientation(labels);

                // next check the positions of the translated labels

                var transformedGeo = labels.Select(x => PlanarUnfolder.MapGeometryToUnfoldingByID(unfoldObject, x.AlignedLabelGeometry, x.ID)).ToList();

                UnfoldTestUtils.AssertLabelsGoodFinalLocationAndOrientation(labels, transformedGeo, unfoldObject);
            }
コード例 #3
0
            public void FullyUnfoldConeTallFromTriSurfaces()
            {
                Solid          testCone = UnfoldTestUtils.SetupTallCone();
                List <Face>    faces    = testCone.Faces.ToList();
                List <Surface> surfaces = faces.Select(x => x.SurfaceGeometry()).ToList();

                //handle tesselation here
                var pointtuples = Tesselation.Tessellate(surfaces, -1, 512);
                //convert triangles to surfaces
                List <Surface> trisurfaces = pointtuples.Select(x => Surface.ByPerimeterPoints(new List <Point>()
                {
                    x[0], x[1], x[2]
                })).ToList();


                var unfoldsurfaces = PlanarUnfolder.Unfold(trisurfaces).UnfoldedSurfaceSet;

                UnfoldTestUtils.CheckAllUnfoldedFacesForCorrectUnfold(unfoldsurfaces);
            }
コード例 #4
0
            public void UnfoldEachPairOfTriangularSurfacesInAConeTallParentAsRefFace()
            {
                Solid          testCone = UnfoldTestUtils.SetupTallCone();
                List <Face>    faces    = testCone.Faces.ToList();
                List <Surface> surfaces = faces.Select(x => x.SurfaceGeometry()).ToList();

                //handle tesselation here
                var pointtuples = Tesselation.Tessellate(surfaces, -1, 512);
                //convert triangles to surfaces
                List <Surface> trisurfaces = pointtuples.Select(x => Surface.ByPerimeterPoints(new List <Point>()
                {
                    x[0], x[1], x[2]
                })).ToList();

                //generate a graph of the cube
                var graph = ModelTopology.GenerateTopologyFromSurfaces(trisurfaces);


                UnfoldTestUtils.AssertEachFacePairUnfoldsCorrectly(graph);
            }