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 |
---|---|
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 's horizontal component (the x coordinate)
does not equal 0. |
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 's vertical component (the y coordinate)
does not equal 0. |
Vector |
rotateCCW(Angle angle)
|
Vector |
rotateCW(Angle angle)
|
Point |
toPoint()
|
java.lang.String |
toString() |
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.Object
Vector
objectpublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
Object.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
Vector
s before calculating the cross product. The resulting
dissimilarity value represents the amount by which two Vector
s
are directionally different. For parallel Vector
s 0 is returned.public Vector getDivided(double factor)
public double getDotProduct(Vector other)
public double getLength()
Vector
.Vector
public Vector getMultiplied(double factor)
public Vector getNormalized()
public Vector getOrthogonalComplement()
Vector
, which is
defined to be (-y, x).Vector
public double getSimilarity(Vector other)
Vector
and the provided one.
The similarity is defined as the absolute value of the dotProduct(). For
orthogonal Vector
s, 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.Object
Object.hashCode()
public boolean isHorizontal()
Vector
's horizontal component (the x coordinate)
does not equal 0.true
if this Vector
's x coordinate does not
equal 0, otherwise false
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 false
public 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
's vertical component (the y coordinate)
does not equal 0.true
if this Vector
's y coordinate does not
equal 0, otherwise false
public Vector rotateCCW(Angle angle)
angle
- the rotation Angle
this
for conveniencepublic Vector rotateCW(Angle angle)
angle
- the rotation Angle
this
for conveniencepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
Copyright (c) 2014 itemis AG, and others. All rights reserved.