JavaCAD
Wedge.java
Go to the documentation of this file.
1 package eu.mihosoft.vrl.v3d;
2 
3 import java.util.List;
4 
5 public class Wedge extends Primitive {
6  double w, h, d;
7 
9  private final PropertyStorage properties = new PropertyStorage();
10 
12  return properties;
13  }
14 
23  public Wedge(double w, double h, double d) {
24  if (w < 0)
25  throw new RuntimeException("w must be positive");
26  if (h < 0)
27  throw new RuntimeException("w must be positive");
28  if (d < 0)
29  throw new RuntimeException("w must be positive");
30  this.w = w;
31  this.h = h;
32  this.d = d;
33  }
34 
35 
36  /*
37  * (non-Javadoc)
38  *
39  * @see eu.mihosoft.vrl.v3d.Primitive#toPolygons()
40  */
41  @Override
42  public List<Polygon> toPolygons() {
43  CSG polygon = Extrude.points(new Vector3d(0, 0, h), // This is the extrusion depth
44  new Vector3d(0, 0), // All values after this are the points in the polygon
45  new Vector3d(d, 0), // Bottom right corner
46  new Vector3d(0, w)// upper right corner
47  ).roty(90).rotz(90);
48  return polygon.getPolygons();
49  }
50 }
List< Polygon > getPolygons()
Definition: CSG.java:698
CSG rotz(Number degreesToRotate)
Definition: CSG.java:550
CSG roty(Number degreesToRotate)
Definition: CSG.java:560
static CSG points(Vector3d dir, List< Vector3d > points)
Definition: Extrude.java:199
PropertyStorage getProperties()
Definition: Wedge.java:11
Wedge(double w, double h, double d)
Definition: Wedge.java:23
List< Polygon > toPolygons()
Definition: Wedge.java:42
final PropertyStorage properties
Definition: Wedge.java:9