JavaCAD
ChamferedCylinder.java
Go to the documentation of this file.
1 package eu.mihosoft.vrl.v3d;
2 
3 import java.util.List;
4 
5 public class ChamferedCylinder extends Primitive {
6  double r, h, chamferHeight;
7 
9  private final PropertyStorage properties = new PropertyStorage();
10 
12  return properties;
13  }
14 
23  public ChamferedCylinder(double r, double h, double chamferHeight) {
24  this.r = r;
25  this.h = h;
26  this.chamferHeight = chamferHeight;
27  }
28 
29 
30  /*
31  * (non-Javadoc)
32  *
33  * @see eu.mihosoft.vrl.v3d.Primitive#toPolygons()
34  */
35  @Override
36  public List<Polygon> toPolygons() {
37  CSG cube1 = new Cylinder(r - chamferHeight, h).toCSG();
38  CSG cube2 = new Cylinder(r, h - chamferHeight * 2).toCSG().movez(chamferHeight);
39  return cube1.union(cube2).hull().getPolygons();
40  }
41 }
CSG movez(Number howFarToMove)
Definition: CSG.java:439
List< Polygon > getPolygons()
Definition: CSG.java:698
CSG union(CSG csg)
Definition: CSG.java:736
ChamferedCylinder(double r, double h, double chamferHeight)