Checks to see if two objects are equal. Only two Vectors can ever return true. This method uses a fuzzy match to account for floating point errors. The epsilon can be retrieved with epsilon.
(Object obj)
| 723 | * with epsilon. |
| 724 | */ |
| 725 | @Override |
| 726 | public boolean equals(Object obj) { |
| 727 | if (!(obj instanceof Vector)) { |
| 728 | return false; |
| 729 | } |
| 730 | |
| 731 | Vector other = (Vector) obj; |
| 732 | |
| 733 | return Math.abs(x - other.x) < epsilon && Math.abs(y - other.y) < epsilon && Math.abs(z - other.z) < epsilon && (this.getClass().equals(obj.getClass())); |
| 734 | } |
| 735 | |
| 736 | /** |
| 737 | * Returns a hash code for this vector |