JavaCAD
Isosceles.java
Go to the documentation of this file.
1 package eu.mihosoft.vrl.v3d;
2 
3 import java.util.List;
4 
5 public class Isosceles extends Primitive {
6  double w, h, d;
7 
9  private final PropertyStorage properties = new PropertyStorage();
10 
12  return properties;
13  }
14 
23  public Isosceles(double w, double h, double d) {
24  this.w = w;
25  this.h = h;
26  this.d = d;
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  if(w<=0)
38  throw new NumberFormatException("w can not be negative");
39  if(h<=0)
40  throw new NumberFormatException("h can not be negative");
41  if(d<=0)
42  throw new NumberFormatException("d can not be negative");
43  CSG polygon = Extrude.points(new Vector3d(0, 0, w),// This is the extrusion depth
44  new Vector3d(0,0),// All values after this are the points in the polygon
45  new Vector3d(0,-h/2),// upper right corner
46  new Vector3d(d,0),// Bottom right corner
47  new Vector3d(0,h/2)// upper right corner
48  ).roty(90)
49  .rotz(180);
50  return polygon.getPolygons();
51  }
52 
53 }
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
List< Polygon > toPolygons()
Definition: Isosceles.java:36
final PropertyStorage properties
Definition: Isosceles.java:9
PropertyStorage getProperties()
Definition: Isosceles.java:11
Isosceles(double w, double h, double d)
Definition: Isosceles.java:23