Ejemplo n.º 1
0
        public void CreateInteriorSkeleton()
        {
            Polygon2f polygon = CreatePolygon2.FromBox(new Vector2f(-1), new Vector2f(1));

            var constructor = new HBMeshConstructor <HBVertex2f, HBEdge, HBFace>();

            PolygonSkeleton2.CreateInteriorSkeleton(polygon, constructor);

            var mesh = constructor.PopMesh();

            Assert.AreEqual(5, mesh.Vertices.Count);
            Assert.AreEqual(8, mesh.Edges.Count);
            Assert.AreEqual(0, mesh.Faces.Count);
        }
Ejemplo n.º 2
0
        protected override void OnPolygonComplete(Polygon2f input)
        {
            polygon = input;

            polygon.MakeCCW();
            polygon.BuildIndices();
            polygon.BuildHoleIndices();

            if (polygon.IsSimple)
            {
                var constructor = new HBMeshConstructor <HBVertex2f, HBEdge, HBFace>();
                PolygonSkeleton2.CreateInteriorSkeleton(polygon, constructor);
                var mesh = constructor.PopMesh();

                line = HBMeshConversion.ToIndexableMesh2f(mesh);
            }
            else
            {
                line = null;
            }
        }