Package com.google.common.geometry
Class R2Vector
- java.lang.Object
-
- com.google.common.geometry.R2Vector
-
public final class R2Vector extends Object
R2Vector represents a vector in the two-dimensional space. It defines the basic geometrical operations for 2D vectors, e.g. cross product, addition, norm, comparison etc.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static R2Vectoradd(R2Vector p1, R2Vector p2)doublecrossProd(R2Vector that)doubledotProd(R2Vector that)static doubledotProd(R2Vector p1, R2Vector p2)booleanequals(Object that)doubleget(int index)inthashCode()Calcualates hashcode based on stored coordinates.booleanlessThan(R2Vector vb)static R2Vectormul(R2Vector p, double m)doublenorm2()StringtoString()doublex()doubley()
-
-
-
Method Detail
-
x
public double x()
-
y
public double y()
-
get
public double get(int index)
-
norm2
public double norm2()
-
dotProd
public double dotProd(R2Vector that)
-
crossProd
public double crossProd(R2Vector that)
-
lessThan
public boolean lessThan(R2Vector vb)
-
hashCode
public int hashCode()
Calcualates hashcode based on stored coordinates. Since we want +0.0 and -0.0 to be treated the same, we ignore the sign of the coordinates.
-
-