public void GenBFSTreeFromArcLoft() { 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 graph = ModelTopology.GenerateTopologyFromSurfaces(trisurfaces); List <Object> face_objs = trisurfaces.Select(x => x as Object).ToList(); UnfoldTestUtils.GraphHasVertForEachFace(graph, face_objs); var nodereturn = ModelGraph.BFS <EdgeLikeEntity, FaceLikeEntity>(graph); object tree = nodereturn; var casttree = tree as List <GraphVertex <EdgeLikeEntity, FaceLikeEntity> >; UnfoldTestUtils.GraphHasVertForEachFace(casttree, face_objs); UnfoldTestUtils.AssertAllFinishingTimesSet(graph); var sccs = GraphUtilities.TarjansAlgo <EdgeLikeEntity, FaceLikeEntity> .CycleDetect(casttree, GraphUtilities.EdgeType.Tree); UnfoldTestUtils.IsAcylic <EdgeLikeEntity, FaceLikeEntity>(sccs, casttree); }
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); }
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); 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); }
public void UnfoldAndLabel2ArcLofts() { // unfold cube Surface testloft = UnfoldTestUtils.SetupArcLoft(); Surface testloft2 = UnfoldTestUtils.SetupArcLoft(); var surfaces = new List <Surface>() { testloft }; var surfaces2 = new List <Surface>() { testloft }; //handle tesselation here var pointtuples = Tesselation.Tessellate(surfaces, -1, 512); var pointtuples2 = 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(); List <Surface> trisurfaces2 = pointtuples2.Select(x => Surface.ByPerimeterPoints(new List <Point>() { x[0], x[1], x[2] })).ToList(); var unfoldObject1 = PlanarUnfolder.Unfold(trisurfaces); var unfoldObject2 = PlanarUnfolder.Unfold(trisurfaces2); var unfoldsurfaces = unfoldObject1.UnfoldedSurfaceSet.Concat(unfoldObject2.UnfoldedSurfaceSet).ToList(); Console.WriteLine("merging unfolds"); var unfoldObject = PlanarUnfolder.PlanarUnfolding <EdgeLikeEntity, FaceLikeEntity> . MergeUnfoldings(new List <PlanarUnfolder.PlanarUnfolding <EdgeLikeEntity, FaceLikeEntity> >() { unfoldObject1, unfoldObject2 }); AssertMergeHasCorrectNumberOfSurfaces(unfoldObject, trisurfaces.Count * 2); AssertMergeHasCorrectNumberOfMaps(unfoldObject, new List <PlanarUnfolder.PlanarUnfolding <EdgeLikeEntity, FaceLikeEntity> >() { unfoldObject1, unfoldObject2 }); 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); }
public void UnfoldOf300TriSurface() { var surface = UnfoldTestUtils.SetupArcLoft(); var surfaces = new List <Surface>() { surface }; //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(); Assert.DoesNotThrow(() => PlanarUnfolder.Unfold(trisurfaces)); }
// [Test] public void UnfoldCurvedArcLoft() { 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 unfoldsurfaces = PlanarUnfolder.Unfold(trisurfaces).UnfoldedSurfaceSet; UnfoldTestUtils.CheckAllUnfoldedFacesForCorrectUnfold(unfoldsurfaces); }