AddTriangleStrip() public method

Adds a triangle strip to the mesh.
See http://en.wikipedia.org/wiki/Triangle_strip.
public AddTriangleStrip ( IList stripPositions, IList stripNormals = null, IList stripTextureCoordinates = null ) : void
stripPositions IList /// The points of the triangle strip. ///
stripNormals IList /// The normal vectors of the triangle strip. ///
stripTextureCoordinates IList /// The texture coordinates of the triangle strip. ///
return void
示例#1
0
        /// <summary>
        /// Do the tessellation and return the <see cref="MeshGeometry3D"/>.
        /// </summary>
        /// <returns>A triangular mesh geometry.</returns>
        protected override MeshGeometry3D Tessellate()
        {
            var pts = new List<Point3D>();
            var right = Vector3D.CrossProduct(this.UpVector, this.Normal);
            for (int i = 0; i < this.ThetaDiv; i++)
            {
                double angle = this.StartAngle + ((this.EndAngle - this.StartAngle) * i / (this.ThetaDiv - 1));
                double angleRad = angle / 180 * Math.PI;
                var dir = (right * Math.Cos(angleRad)) + (this.UpVector * Math.Sin(angleRad));
                pts.Add(this.Center + (dir * this.InnerRadius));
                pts.Add(this.Center + (dir * this.OuterRadius));
            }

            var b = new MeshBuilder(false, false);
            b.AddTriangleStrip(pts);
            return b.ToMesh();
        }