Bounding box of a tetrahedron?
in
Programming Questions
•
2 years ago
Hi, i'm developing a ragdoll simulator using Processing. I have to make the bounding box of a tetrahedron. I have the basic bounding box without rotation, but I need the rotation...can anybdy help me?
I have this code:
I have this code:
- public class Box{
private float ancho,altura,profundo;
private PVector centro;
Sphere xneg,xpos,z,y;
public Box(Sphere xneg,Sphere xpos,Sphere z,Sphere y){
this.xneg=xneg;
this.xpos=xpos;
this.z=z;
this.y=y;
}
public void draw(){
PVector xnegv = xneg.getVector();
PVector xposv = xpos.getVector();
PVector zv = z.getVector();
PVector yv = y.getVector();
println(xnegv);
println(xposv);
println(zv);
println();
centro = xposv.get();
centro.sub(xnegv);
centro.div(2);
centro.add(xnegv);
PVector prof = centro.get();
prof.sub(zv);
profundo = centro.dist(zv);
PVector centroz = zv.get();
centroz.sub(centro);
centroz.div(2);
centro.add(centroz);
PVector alt = centro.get();
alt.sub(yv);
altura = centro.dist(yv);
PVector an = xnegv.get();
an.sub(xposv);
ancho=xnegv.dist(xposv);
translate(centro.x,centro.y,centro.z);
fill(255,0,0);
box(ancho,altura,profundo);
}
}
1