/** issue gl.glVertex() for each of the triangle's points */
public void glVertices(GL gl, Matrix m) {
/** issue gl.glVertex() for each of the triangle's points */
public void glVertices(GL gl, Matrix m) {
- if (m==null) {
- norm().glNormal(gl);
- p1().glVertex(gl);
- p2().glVertex(gl);
- p3().glVertex(gl);
- } else {
- m.times(norm()).glNormal(gl);
- m.times(p1()).glVertex(gl);
- m.times(p2()).glVertex(gl);
- m.times(p3()).glVertex(gl);
- }
+ (m==null ? norm() : m.times(norm())).glNormal(gl);
+ (m==null ? p1() : m.times(p1())).glVertex(gl);
+ (m==null ? p2() : m.times(p2())).glVertex(gl);
+ (m==null ? p3() : m.times(p3())).glVertex(gl);
public float circumcircleRadius() {
double a = p1().distance(p2());
double b = p2().distance(p3());
double c = p3().distance(p1());
return (float)((a*b*c)/Math.sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
}
public float circumcircleRadius() {
double a = p1().distance(p2());
double b = p2().distance(p3());
double c = p3().distance(p1());
return (float)((a*b*c)/Math.sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
}
public float shortestEdgeLength() {
float a = p1().distance(p2());
float b = p2().distance(p3());
float c = p3().distance(p1());
return Math.min(a, Math.min(b,c));
}
public float shortestEdgeLength() {
float a = p1().distance(p2());
float b = p2().distance(p3());
float c = p3().distance(p1());
return Math.min(a, Math.min(b,c));
}
// FIXME: I stole this off the net, and I need to credit whoever wrote it
/** decide if the segment from p1-p2 intersects this triangle */
// FIXME: I stole this off the net, and I need to credit whoever wrote it
/** decide if the segment from p1-p2 intersects this triangle */