public boolean isAcute() { return ((this.getAngle(0)<Math.PI/2 && this.getAngle(1)<Math.PI/2 && this.getAngle(2)<Math.PI/2) && this.isTriangle()); } public boolean isObtuse() { return ((this.getAngle(0)>Math.PI/2 || this.getAngle(1)>Math.PI/2 || this.getAngle(2)<Math.PI/2) && this.isTriangle()); } public boolean isRight() { return ((this.approxEqual(this.getAngle(0),Math.PI/2) || this.approxEqual(this.getAngle(1),Math.PI/2) || this.approxEqual(this.getAngle(2),Math.PI/2)) && this.isTriangle()); }

The approxEqual method:

private boolean approxEqual(double x, double y) { double epsilon = 1E-12; return Math.abs(x - y) <= epsilon; }

And the getAngle method:

public double getAngle(int vertex) { if (this.isTriangle()){ if(vertex == 0) { double angle = Math.acos((-Math.pow(this.getLength(0),2)+Math.pow(this.getLength(1),2)+Math.pow(this.getLength(2),2))/(2*this.getLength(1)*this.getLength(2))); return angle; } else if(vertex == 1) { double angle = Math.acos((Math.pow(this.getLength(0),2)-Math.pow(this.getLength(1),2)+Math.pow(this.getLength(2),2))/(2*this.getLength(0)*this.getLength(2))); return angle; } else { double angle = Math.acos((Math.pow(this.getLength(0),2)+Math.pow(this.getLength(1),2)-Math.pow(this.getLength(2),2))/(2*this.getLength(0)*this.getLength(1))); return angle; } } else { return 0; } }

Any help is appreciated. Thank you very much,

Alic

This post has been edited by **aszecsei**: 26 June 2009 - 12:14 PM