|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vividsolutions.jts.algorithm.VectorMath
public class VectorMath
Functions for performing mathematics on vectors in the 2D plane.
Vectors are represented as single Coordinate
s;
the implied vector is assumed to start at the origin.
Vector arithmetic is useful in computing various geometric constructions.
Constructor Summary | |
---|---|
VectorMath()
|
Method Summary | |
---|---|
static Coordinate |
average(Coordinate v0,
Coordinate v1)
Computes the average of two vectors. |
static Coordinate |
difference(Coordinate v0,
Coordinate v1)
Computes the difference of two vectors [v0 - v1]. |
static double |
dotProduct(Coordinate v1,
Coordinate v2)
Computes the dot-product of two vectors |
static Coordinate |
multiply(double s,
Coordinate v)
Computes the product of a scalar and a vector. |
static Coordinate |
normalize(Coordinate v)
Normalizes a vector to have magnitude 1 |
static void |
normalizeSelf(Coordinate v)
Normalizes a vector to have magnitude 1 in-place |
static Coordinate |
pointAlong(Coordinate v0,
Coordinate v1,
double lengthFraction)
Computes a point a given fraction of length along the line joining the endpoints of two vectors. |
static Coordinate |
rotateByQuarterCircle(Coordinate v,
int numQuarters)
Rotates a vector by a given number of quarter-circles (i.e. |
static Coordinate |
sum(Coordinate v0,
Coordinate v1)
Computes the sum of two vectors. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VectorMath()
Method Detail |
---|
public static Coordinate normalize(Coordinate v)
v
- the vector to normalize
public static void normalizeSelf(Coordinate v)
v
- the vector to normalizepublic static double dotProduct(Coordinate v1, Coordinate v2)
v1
- a vectorv2
- a vector
public static Coordinate average(Coordinate v0, Coordinate v1)
v0
- a vectorv1
- a vector
public static Coordinate multiply(double s, Coordinate v)
s
- a scalar valuev
- a vector
public static Coordinate pointAlong(Coordinate v0, Coordinate v1, double lengthFraction)
This is equivalent to computing the weighted sum of the two vectors:
ws = frac * v0 + (1 - frac) * v1
v0
- a vectorv1
- a vectorlengthFraction
- the fraction of the length
public static Coordinate sum(Coordinate v0, Coordinate v1)
v0
- a vectorv1
- a vector
public static Coordinate difference(Coordinate v0, Coordinate v1)
v0
- a vectorv1
- a vector
public static Coordinate rotateByQuarterCircle(Coordinate v, int numQuarters)
v
- the vector to rotate.numQuarters
- the number of quarter-circles to rotate by
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |