@@ -0,0 +1,2351 @@
+// HPyramid based on vertices by Simon Greenwold.%0A// See https://processing.org/examples/vertices.html%0A// Can be used to generate pyramids, cylinders or cones...%0A%0Apackage hype;%0A %0Aimport processing.core.PConstants;%0Aimport processing.core.PGraphics;%0Aimport static processing.core.PApplet.cos;%0Aimport static processing.core.PApplet.sin;%0A%0Apublic class HPyramid extends HDrawable3D %7B%0A    private int sides; %0A    private float topRadius;%0A %0A  public HPyramid() %7B%0A  //four sided pyramid by default%0A  sides = 4;%0A  topRadius=0;%0A  %7D%0A    %0A  public HPyramid sides(int s) %7B%0A    sides=4;%0A    s = Math.abs(s);%0A    if(s%3E3)%0A    %7B%0A    sides = s;%0A    %7D%0A    return this;%0A  %7D%0A%0A  public int sides() %7B%0A    return sides;%0A  %7D%0A%0A  public float topRadius() %7B%0A    return topRadius;%0A  %7D%0A  %0A  public HPyramid topRadius(float tr) %0A  %7B%0A  topRadius = Math.abs(tr);%0A    if(topRadius%3Edepth)%0A    %7B%0A      topRadius=depth;%0A    %7D%0A  return this;%0A  %7D%0A%0A  @Override%0A    public HDrawable createCopy() %7B%0A    HPyramid copy = new HPyramid();%0A    copy.copyPropertiesFrom(this);%0A    copy.depth = depth;%0A    copy.topRadius = topRadius;%0A    copy.sides = sides;%0A    copy.anchorW = anchorW;%0A    return copy;%0A  %7D%0A%0A  @Override%0A    public void draw(PGraphics g, boolean usesZ, float drawX, float drawY, float currAlphaPc) %7B%0A%0A    applyStyle(g, currAlphaPc);%0A    g.pushMatrix();%0A    g.translate(drawX, drawY-(Math.abs(height)/2), -anchorZ());%0A%0A    float angle = 0;%0A    float angleIncrement = PConstants.TWO_PI / sides;%0A%0A    //draw bottom%0A    angle = 0;%0A    g.beginShape(); %0A    for (int i = 0; i %3C sides + 1; i++) %7B%0A      g.vertex(Math.abs(depth) * cos(angle), Math.abs(height), Math.abs(depth) * sin(angle)); %0A      angle += angleIncrement;%0A    %7D%0A    g.endShape(PConstants.CLOSE);%0A    %0A    // draw top%0A  if (topRadius != 0) %7B%0A    angle = 0;%0A    g.beginShape();%0A    for (int i = 0; i %3C sides + 1; i++) %7B%0A      g.vertex(topRadius * cos(angle), 0, topRadius * sin(angle));%0A      angle += angleIncrement;%0A    %7D%0A    g.endShape();%0A  %7D%0A%0A   //draw sides%0A    g.beginShape(PConstants.QUAD_STRIP);%0A    if(sides%3E8) g.noStroke();%0A    for (int i = 0; i %3C sides + 1; ++i) %7B%0A      g.vertex(topRadius*cos(angle), 0, topRadius*sin(angle));%0A      g.vertex(Math.abs(depth)*cos(angle), Math.abs(height), Math.abs(depth)*sin(angle)); %0A      angle += angleIncrement;%0A    %7D%0A    g.endShape(PConstants.CLOSE);%0A%0A    g.popMatrix();%0A  %7D%0A%7D%0A

Create HPyramid.java