HelixToolkit.Wpf.MeshBuilder.AddCylinder C# (CSharp) Method

AddCylinder() public method

Adds a cylinder to the mesh.
See http://en.wikipedia.org/wiki/Cylinder_(geometry).
public AddCylinder ( System.Windows.Media.Media3D.Point3D p1, System.Windows.Media.Media3D.Point3D p2, double diameter, int thetaDiv ) : void
p1 System.Windows.Media.Media3D.Point3D /// The first point. ///
p2 System.Windows.Media.Media3D.Point3D /// The second point. ///
diameter double /// The diameters. ///
thetaDiv int /// The number of divisions around the cylinder. ///
return void
        public void AddCylinder(Point3D p1, Point3D p2, double diameter, int thetaDiv)
        {
            Vector3D n = p2 - p1;
            double l = n.Length;
            n.Normalize();
            this.AddCone(p1, n, diameter / 2, diameter / 2, l, false, false, thetaDiv);
        }

Usage Example

示例#1
3
 public MainViewModel()
 {
     var gm = new MeshBuilder();
     gm.AddBox(new Point3D(0, 0, 0.5), 1, 1, 1);
     gm.AddCylinder(new Point3D(5, 0, 0), new Point3D(5, 0, 5), 1, 36);
     this.Model = new GeometryModel3D(gm.ToMesh(true), Materials.Blue);
     this.Model.Freeze();
 }
All Usage Examples Of HelixToolkit.Wpf.MeshBuilder::AddCylinder