|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.math.Vector2D
public class Vector2D
A 2-dimensional mathematical vector represented by double-precision X and Y components.
Constructor Summary | |
---|---|
Vector2D()
|
|
Vector2D(Coordinate v)
|
|
Vector2D(Coordinate from,
Coordinate to)
|
|
Vector2D(double x,
double y)
|
|
Vector2D(Vector2D v)
|
Method Summary | |
---|---|
Vector2D |
add(Vector2D v)
|
double |
angle()
|
double |
angle(Vector2D v)
|
double |
angleTo(Vector2D v)
|
Vector2D |
average(Vector2D v)
|
java.lang.Object |
clone()
Creates a copy of this vector |
static Vector2D |
create(Coordinate coord)
Creates a vector from a Coordinate . |
static Vector2D |
create(Coordinate from,
Coordinate to)
Creates a vector with the direction and magnitude of the difference between the to and from Coordinate s. |
static Vector2D |
create(double x,
double y)
Creates a new vector with given X and Y components. |
static Vector2D |
create(Vector2D v)
Creates a new vector from an existing one. |
double |
distance(Vector2D v)
Computes the distance between this vector and another one. |
Vector2D |
divide(double d)
Divides the vector by a scalar value. |
double |
dot(Vector2D v)
Computes the dot-product of two vectors |
boolean |
equals(java.lang.Object o)
Tests if a vector o has the same values for the x and y components. |
double |
getComponent(int index)
|
double |
getX()
|
double |
getY()
|
int |
hashCode()
Gets a hashcode for this vector. |
boolean |
isParallel(Vector2D v)
|
double |
length()
|
double |
lengthSquared()
|
Vector2D |
multiply(double d)
Multiplies the vector by a scalar value. |
Vector2D |
negate()
|
Vector2D |
normalize()
|
Vector2D |
rotate(double angle)
|
Vector2D |
rotateByQuarterCircle(int numQuarters)
Rotates a vector by a given number of quarter-circles (i.e. |
Vector2D |
subtract(Vector2D v)
|
Coordinate |
toCoordinate()
|
java.lang.String |
toString()
Gets a string representation of this vector |
Coordinate |
translate(Coordinate coord)
|
Vector2D |
weightedSum(Vector2D v,
double frac)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Vector2D()
public Vector2D(double x, double y)
public Vector2D(Vector2D v)
public Vector2D(Coordinate from, Coordinate to)
public Vector2D(Coordinate v)
Method Detail |
---|
public static Vector2D create(double x, double y)
x
- the x componenty
- the y component
public static Vector2D create(Vector2D v)
v
- the vector to copy
public static Vector2D create(Coordinate coord)
Coordinate
.
coord
- the Coordinate to copy
public static Vector2D create(Coordinate from, Coordinate to)
Coordinate
s.
from
- the origin Coordinateto
- the destination Coordinate
public double getX()
public double getY()
public double getComponent(int index)
public Vector2D add(Vector2D v)
public Vector2D subtract(Vector2D v)
public Vector2D multiply(double d)
d
- the value to multiply by
public Vector2D divide(double d)
d
- the value to divide by
public Vector2D negate()
public double length()
public double lengthSquared()
public Vector2D normalize()
public Vector2D average(Vector2D v)
public Vector2D weightedSum(Vector2D v, double frac)
public double distance(Vector2D v)
v
- a vector
public double dot(Vector2D v)
v
- a vector
public double angle()
public double angle(Vector2D v)
public double angleTo(Vector2D v)
public Vector2D rotate(double angle)
public Vector2D rotateByQuarterCircle(int numQuarters)
numQuarters
- the number of quarter-circles to rotate by
public boolean isParallel(Vector2D v)
public Coordinate translate(Coordinate coord)
public Coordinate toCoordinate()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- a Vector2D with which to do the comparison.
public int hashCode()
hashCode
in class java.lang.Object
|
JTS Topology Suite version 1.12 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |