/// <summary>
        /// Add a face between the point in position x, y, z=0, the point in the position x, y, offsetZ and positions of two last vertices.
        /// </summary>
        /// <param name="x">Coordinate X.</param>
        /// <param name="y">Coordinate Y.</param>
        /// <param name="offsetZ">The offset od coordinate Z where the second point is located to form the edge.</param>
        /// <param name="polygon">The poligone where the face is to be added.</param>
        /// <param name="addendum"></param>
        /// <param name="initVerticesCount"></param>
        /// <param name="material"></param>
        protected static VerticesPair AddFace(float x, float y, float offsetZ, Polygon polygon, float addendum, int initVerticesCount, Material material = null)
        {
            var pair = new VerticesPair(x, y, offsetZ, addendum);
            polygon.Vertices.Add(pair.Top);
            polygon.Vertices.Add(pair.Base);

            var verticesCount = polygon.Vertices.Count;
            if (verticesCount - initVerticesCount <= 2)
                return pair;
            AddTriangleFace(polygon, material, verticesCount, 3, 2, 1);
            AddTriangleFace(polygon, material, verticesCount, 3, 2, 4);
            return pair;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add a face between the point in position x, y, z=0, the point in the position x, y, offsetZ and positions of two last vertices.
        /// </summary>
        /// <param name="x">Coordinate X.</param>
        /// <param name="y">Coordinate Y.</param>
        /// <param name="offsetZ">The offset od coordinate Z where the second point is located to form the edge.</param>
        /// <param name="polygon">The poligone where the face is to be added.</param>
        /// <param name="addendum"></param>
        /// <param name="initVerticesCount"></param>
        /// <param name="material"></param>
        protected static VerticesPair AddFace(float x, float y, float offsetZ, Polygon polygon, float addendum, int initVerticesCount, Material material = null)
        {
            var pair = new VerticesPair(x, y, offsetZ, addendum);

            polygon.Vertices.Add(pair.Top);
            polygon.Vertices.Add(pair.Base);

            var verticesCount = polygon.Vertices.Count;

            if (verticesCount - initVerticesCount <= 2)
            {
                return(pair);
            }
            AddTriangleFace(polygon, material, verticesCount, 3, 2, 1);
            AddTriangleFace(polygon, material, verticesCount, 3, 2, 4);
            return(pair);
        }
 public void Add(VerticesPair pos2D)
 {
     Vertices.Add(pos2D);
 }
 public void Add(VerticesPair pos2D)
 {
     Vertices.Add(pos2D);
 }