|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.geometry.xy.XyVector
public class XyVector
A mathematical vector in (x, y) space. Vectors represent displacements and can be used in lieu of slopes in parameterized line and curve drawing. Oh, and to do vector algebra.
Everyone loves vector algebra.
Copyright 2007 Partner Software, Inc.
| Constructor Summary | |
|---|---|
XyVector(double deltaX,
double deltaY)
Creates a vector with the given deltaX and deltaY. |
|
XyVector(double radius,
XyDirection direction)
Creates a vector equivalent for the given polar coordinates. |
|
XyVector(XyPoint point)
Creates a vector equivalent for the given point. |
|
XyVector(XyPoint start,
XyPoint end)
Creates a vector difference between the two points. |
|
| Method Summary | |
|---|---|
double |
dot(XyVector nother)
Returns the dot-product of this vector with the one given. |
boolean |
equals(java.lang.Object nother)
|
double |
getDeltaX()
Offset on the X axis. |
double |
getDeltaY()
Offset on the Y axis. |
XyDirection |
getDirection()
Returns the direction this vector points. |
XyVector |
getLeftPerpendicular()
Returns the vector with the same length that is perpendicular to this one and lies on the "left" side (visualized as if you are facing the direction this vector points). |
double |
getLength()
Returns the length, or magnitude, of this vector. |
double |
getLengthSquared()
Returns the square of the length, or magnitude, of this vector. |
XyVector |
getReversedVector()
Returns the reversed, or opposite vector, to this one. |
XyVector |
getRightPerpendicular()
Returns the vector with the same length that is perpendicular to this one and lies on the "right" side (visualized as if you are facing the direction this vector points). |
double |
getThetaRadians()
Returns the direction of the vector in theta radians. |
int |
hashCode()
|
XyVector |
minus(XyVector nother)
Subtracts the given vector from this one and returns the resultant. |
XyVector |
plus(XyVector nother)
Adds this vector to the given vector and returns the resultant vector. |
XyVector |
reversed()
Returns a modified version of this vector with that goes in the opposite direction. |
XyVector |
times(double factor)
Multiplies this vector by the given factor and returns the result. |
XyLine |
toLine()
Returns the line containing this vector. |
XyLineSegment |
toLineSegment()
Returns the line segment equivalent of this vector. |
XyPoint |
toPoint()
Returns the (x, y) point that this is a positional vector for. |
XyPolar |
toPolar()
Returns a polar coordinate representation of this vector. |
java.lang.String |
toString()
|
XyVector |
toUnitVector()
Returns an equivalent vector to this whose length is 1.0. |
XyVector |
withDeltaX(double newDeltaX)
Returns a modified version of this vector with the given deltaX. |
XyVector |
withDeltaY(double newDeltaY)
Returns a modified version of this vector with the given deltaY. |
XyVector |
withDirection(XyDirection newDirection)
Returns a modified version of this vector with the given direction. |
XyVector |
withLength(double newLength)
Returns a modified version of this vector with the given length. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XyVector(double deltaX,
double deltaY)
public XyVector(XyPoint point)
point - input point
public XyVector(XyPoint start,
XyPoint end)
start - starting or origin pointend - ending or destination point
public XyVector(double radius,
XyDirection direction)
| Method Detail |
|---|
public XyVector withDeltaX(double newDeltaX)
public XyVector withDeltaY(double newDeltaY)
public XyVector withLength(double newLength)
newLength -
public XyVector withDirection(XyDirection newDirection)
public XyVector reversed()
public XyPoint toPoint()
public XyPolar toPolar()
public XyLine toLine()
public XyLineSegment toLineSegment()
public XyVector toUnitVector()
public XyVector plus(XyVector nother)
nother - vector to add
public XyVector minus(XyVector nother)
nother - vector to subtract
public XyVector times(double factor)
factor - multiplication factor
public double dot(XyVector nother)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic double getDeltaX()
public double getDeltaY()
public XyDirection getDirection()
public double getLength()
public double getLengthSquared()
public XyVector getReversedVector()
public XyVector getLeftPerpendicular()
public XyVector getRightPerpendicular()
public double getThetaRadians()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||