public class Vector
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Vector within 2-dimensional Euclidean space.| Modifier and Type | Field and Description |
|---|---|
static Vector |
NULL
The (0,0) vector.
|
double |
x
The x coordinate of this
Vector. |
double |
y
The y coordinate of this
Vector. |
| Constructor and Description |
|---|
Vector(double x,
double y)
Constructs a
Vector that points in the specified direction. |
Vector(Point p)
|
Vector(Point start,
Point end)
|
Vector(Vector start,
Vector end)
|
| Modifier and Type | Method and Description |
|---|---|
Vector |
clone()
|
boolean |
equals(java.lang.Object obj) |
Vector |
getAdded(Vector other)
|
Angle |
getAngle(Vector other)
|
Angle |
getAngleCCW(Vector other)
|
Angle |
getAngleCW(Vector other)
|
Vector |
getAveraged(Vector other)
|
Vector |
getCopy()
Returns a copy of this
Vector object. |
double |
getCrossProduct(Vector other)
|
double |
getDissimilarity(Vector other)
|
Vector |
getDivided(double factor)
|
double |
getDotProduct(Vector other)
|
double |
getLength()
Returns the length of this
Vector. |
Vector |
getMultiplied(double factor)
|
Vector |
getNormalized()
|
Vector |
getOrthogonalComplement()
Returns the orthogonal complement of this
Vector, which is
defined to be (-y, x). |
Vector |
getRotatedCCW(Angle angle)
|
Vector |
getRotatedCW(Angle angle)
|
double |
getSimilarity(Vector other)
Calculates the similarity of this
Vector and the provided one. |
Vector |
getSubtracted(Vector other)
|
int |
hashCode() |
boolean |
isHorizontal()
Checks if this
Vector is horizontal, i.e. whether its horizontal
component (the x coordinate) does not equal 0, while its vertical
component (the y coordinate) does. |
boolean |
isNull()
Checks if this
Vector's x and y coordinates are equal to 0. |
boolean |
isOrthogonalTo(Vector other)
Checks if this
Vector and the provided one are orthogonal to each
other. |
boolean |
isParallelTo(Vector other)
Checks if this
Vector and the provided one are parallel to each
other. |
boolean |
isVertical()
Checks if this
Vector is vertical, i.e. whether its vertical
component (the x coordinate) does not equal 0, while its horizontal
component (the y coordinate) does. |
Vector |
rotateCCW(Angle angle)
|
Vector |
rotateCW(Angle angle)
|
Point |
toPoint()
|
java.lang.String |
toString() |
public static final Vector NULL
public double x
Vector.public double y
Vector.public Vector(double x,
double y)
Vector that points in the specified direction.x - x coordinatey - y coordinatepublic Vector clone()
clone in class java.lang.ObjectVector objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(Object)public Vector getCopy()
Vector object.Vector objectpublic double getCrossProduct(Vector other)
public double getDissimilarity(Vector other)
Vector with
the given other Vector. This method normalizes both
Vectors before calculating the cross product. The resulting
dissimilarity value represents the amount by which two Vectors
are directionally different. For parallel Vectors 0 is returned.public Vector getDivided(double factor)
public double getDotProduct(Vector other)
public double getLength()
Vector.Vectorpublic Vector getMultiplied(double factor)
public Vector getNormalized()
public Vector getOrthogonalComplement()
Vector, which is
defined to be (-y, x).Vectorpublic double getSimilarity(Vector other)
Vector and the provided one.
The similarity is defined as the absolute value of the dotProduct(). For
orthogonal Vectors, 0 is returned.other - the Vector for which the similarity to this
Vector is calculatedVector and the provided onegetDissimilarity(Vector)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public boolean isHorizontal()
Vector is horizontal, i.e. whether its horizontal
component (the x coordinate) does not equal 0, while its vertical
component (the y coordinate) does.public boolean isNull()
Vector's x and y coordinates are equal to 0.true if this Vector's x and y coordinates
are equal to 0, otherwise falsepublic boolean isOrthogonalTo(Vector other)
Vector and the provided one are orthogonal to each
other.public boolean isParallelTo(Vector other)
Vector and the provided one are parallel to each
other.public boolean isVertical()
Vector is vertical, i.e. whether its vertical
component (the x coordinate) does not equal 0, while its horizontal
component (the y coordinate) does.public Vector rotateCCW(Angle angle)
angle - the rotation Anglethis for conveniencepublic Vector rotateCW(Angle angle)
angle - the rotation Anglethis for conveniencepublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()Copyright (c) 2014 itemis AG, and others. All rights reserved.