Esempio n. 1
0
        /// <summary>
        /// Construct a lamina solid.
        /// </summary>
        /// <param name="perimeter">The perimeter of the lamina's faces.</param>
        /// <param name="material">The solid's material.</param>
        public static Solid CreateLamina(Vector3[] perimeter, Material material)
        {
            var solid = new Solid(material);
            var loop1 = new Loop();
            var loop2 = new Loop();

            for (var i = 0; i < perimeter.Length; i++)
            {
                var a = solid.AddVertex(perimeter[i]);
                var b = solid.AddVertex(perimeter[i == perimeter.Length - 1 ? 0 : i + 1]);
                var e = solid.AddEdge(a, b);
                loop1.AddEdgeToEnd(e.Left);
                loop2.AddEdgeToStart(e.Right);
            }
            solid.AddFace(loop1);
            solid.AddFace(loop2);
            return(solid);
        }
Esempio n. 2
0
        /// <summary>
        /// Construct a lamina solid.
        /// </summary>
        /// <param name="perimeter">The perimeter of the lamina's faces.</param>
        public static Solid CreateLamina(IList <Vector3> perimeter)
        {
            var solid = new Solid();
            var loop1 = new Loop();
            var loop2 = new Loop();

            for (var i = 0; i < perimeter.Count; i++)
            {
                var a = solid.AddVertex(perimeter[i]);
                var b = solid.AddVertex(perimeter[i == perimeter.Count - 1 ? 0 : i + 1]);
                var e = solid.AddEdge(a, b);
                loop1.AddEdgeToEnd(e.Left);
                loop2.AddEdgeToStart(e.Right);
            }
            solid.AddFace(loop1);
            solid.AddFace(loop2);
            return(solid);
        }