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