コード例 #1
0
            public void UnfoldAndLabelCurvedArcLoft()
            {
                Surface testsweep = UnfoldTestUtils.SetupArcLoft();

                var surfaces = new List <Surface>()
                {
                    testsweep
                };
                //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
        //methods for tab generation
        /// <summary>
        /// method for generating tabs on the unfolded surfaces, this method will generate tabs on all
        /// shared edges that were not folded, but only one of each pair. For example, if unfolding a cube,
        /// the corner edges that were split will only have tabs generated on one of the final resulting surface
        /// edges. This single edge in the cube becomes two edges in the unfold, and only one is tabbed.
        /// </summary>
        /// <param name="unfoldingObject"> an unfolding object that represents a single unfold operation</param>
        /// <param name="relativeWidth"> the tab thickness, relative to the distance between the center of the surface
        ///it lies on and the edge it represents, bigger surfaces will have larger tabs</param>
        /// <returns></returns>
        public static List <List <Surface> > GenerateUnfoldedTabs
            (PlanarUnfolder.PlanarUnfolding <EdgeLikeEntity, FaceLikeEntity> unfoldingObject, double relativeWidth = .3)
        {
            var output = new List <List <Surface> >();

            foreach (var entry in TabGeneration.GenerateTabSurfacesFromUnfold(unfoldingObject, relativeWidth))
            {
                output.Add(entry.Value.Select(x => x.AlignedTabSurf).ToList());
            }
            return(output);
        }
コード例 #3
0
            public void UnfoldAndTabCubeFromFaces()
            {
                // unfold cube
                Solid       testcube = UnfoldTestUtils.SetupCube();
                List <Face> faces    = testcube.Faces.ToList();

                var unfoldObject = PlanarUnfolder.Unfold(faces);

                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);
            }