Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
@ -17,8 +17,9 @@ public class SigRenderer implements MouseListener,MouseMotionListener{
}
SigRenderer(JFrame f) {
tri = new Triangle(new Vector3d(),new Vector3d(),new Vector3d());
tri = new Triangle(new Vector3d(-1,-1,0),new Vector3d(1,0,0),new Vector3d(0,2,0));
System.out.println(tri);
System.out.println(tri.getNormal());
Panel p = new Panel();
@ -12,4 +12,15 @@ public class Triangle {
public String toString() {
return "Triangle [A=" + A + ", B=" + B + ", C=" + C + "]";
public Vector3d getNormal() {
Vector3d AB = (Vector3d)A.clone();
AB.sub(B);
Vector3d BC = (Vector3d)B.clone();
BC.sub(C);
Vector3d crossP = new Vector3d();
crossP.cross(AB,BC);
crossP.normalize();
return crossP;