public class SpatialVector
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
SpatialVector()
empty constructor
|
SpatialVector(double x,
double y)
Standard constructor for the 2D SpatialVector class with x and y coordinates provided
|
SpatialVector(double x,
double y,
double z)
constructor specifying initial x, y, and z coordinates
|
SpatialVector(java.awt.geom.Point2D aPoint)
Standard constructor for the 2D SpatialVector class with x and y coordinates provided
|
Modifier and Type | Method and Description |
---|---|
SpatialVector |
applyVector(PolarVector aVector)
Returns the coordinates of the Location after a Move has been applied to it
|
SpatialVector |
applyVector(SpatialVector aVector)
Returns the coordinates of the Location after a Move has been applied to it
|
boolean |
checkLatLong()
assures that coordinates are latitude and longitude
|
java.lang.Object |
clone()
clone the object
|
SpatialVector |
copy(SpatialVector v)
copy other vector into this one
|
SpatialVector |
cross(SpatialVector v)
Calculates the cross product of this vector and the one passed to it.
|
double |
dot(SpatialVector vec)
Calculates the dot product of this vector and another
|
boolean |
equals(SpatialVector v)
Tests whether or not two vectors are identical in respect
to x,y,z coordinates.
|
java.util.Vector<SpatialVector> |
getCircleLineIntersections(MoveVector mVec,
double radius)
Returns the intersection points between a circle and a line segment
|
java.util.Vector<SpatialVector> |
getCircleLineIntersections(SpatialVector A,
SpatialVector B,
double radius)
Returns the intersection points between a circle and a line
|
java.util.Vector<SpatialVector> |
getCircleLinesegmentIntersections(MoveVector mVec,
double radius)
Returns the intersection points between a circle and a line segment
|
java.util.Vector<SpatialVector> |
getCircleLinesegmentIntersections(SpatialVector A,
SpatialVector B,
double radius)
Returns the intersection points between a circle and a line segment
|
boolean |
getConnect()
sets whether the move should be visually connected
|
double |
getDistanceToLinesegment(MoveVector theMove) |
double |
getDistanceToLinesegment(SpatialVector vecA,
SpatialVector vecB) |
double |
getEuclidianDistance(SpatialVector theOtherLocation)
Returns the straight-line distance between two points
|
double |
getLength()
Reports the magnitude of this vector
|
double |
getLengthSquared()
Reports the magnitude of this vector squared
|
double |
getManhattanDistance(SpatialVector theOtherLocation)
Returns the straight-line distance between two points
|
double |
getManhattanLength()
Reports the magnitude of this vector
|
PolarVector |
getPolarVector(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
java.awt.Point |
getScaledPoint(GridSpace3D visualSpace)
Scales a single location to a frame's x and y scale values
|
SpatialVector |
getSpatialVector(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
double |
getSquaredEuclidianDistance(SpatialVector theOtherLocation)
Returns the straight-line distance between two points
|
double |
getStraightnessIndex(double LongDeg,
double LatDeg)
obtains the straightness across two line segments which meet with a specific angle
|
double |
getVolume(double hWidth,
double vWidth)
obtains the volume of a space with width and height around the Vector
|
double |
getX()
retrieves the x component
|
java.awt.geom.Point2D.Double |
getXY()
Scales a single location to a frame's x and y scale values
|
double |
getXYDeg()
Return the XY heading in degrees.
|
double |
getXYDeg(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
double |
getXYRad()
Return the latitudinal heading in radians.
|
double |
getXYRad(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
double |
getXZDeg()
Return the latitudinal heading in radians.
|
double |
getXZDeg(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
double |
getXZRad()
Return the longitudinal heading in radians.
|
double |
getXZRad(SpatialVector theOtherLocation)
Returns the angle in degrees to another point.
|
double |
getY()
retrieves the y component
|
double |
getZ()
retrieves the z component
|
boolean |
isLatLong()
checks whether the CaptureVariable contains latitude/longitude coordinates
|
void |
list()
lists the SpatialVector as a String
|
void |
listValues()
lists the SpatialVector as a String
|
SpatialVector |
minus(SpatialVector v)
Subtracts a vector from this one and returns the result.
|
void |
negate()
negate the SpatialVector
|
void |
negateX()
negate the x axis of the SpatialVector
|
void |
negateY()
negate the y axis of the SpatialVector
|
void |
negateZ()
negate the z axis of the SpatialVector
|
SpatialVector |
plus(SpatialVector v)
Adds another vector to this vector.
|
SpatialVector |
remapLatLongToDistanceCoords(SpatialVector theOrigin)
returns a latitude/longitude Capture remapped into a real distance
|
SpatialVector |
reverseDirection()
reverses the direction of the vector
|
SpatialVector |
rotate(double xyAngle,
double xzAngle)
Rotate vector in XYZ
|
SpatialVector |
rotate(SpatialVector aVector)
Rotate vector in XYZ
|
SpatialVector |
rotateXY(double r)
Rotate vector in XY
|
SpatialVector |
rotateXZ(double r)
Rotate vector in XY
|
SpatialVector |
scale(double dScalar)
Multiplies this vector by a scalar and keeps the result.
|
void |
setConnect(boolean con)
Returns whether the move should be visually connected
|
void |
setLatLong(boolean isLatLong)
sets the SpatialVector as a latitude longitude coordinate type
|
SpatialVector |
setLength(double newLength)
Scales the vector to a particular length
|
void |
setX(double dNewX)
sets x component
|
void |
setY(double dNewY)
sets y component
|
void |
setZ(double dNewZ)
sets z component
|
void |
subtract(SpatialVector v)
Subtracts argument vector from this vector.
|
SpatialVector |
times(double dScalar)
Multiplies this vector by a scalar and returns the result.
|
java.lang.String |
toFileString()
returns the SpatialVector as a String for writing the Coordinates to a file/screen
|
java.awt.Point |
toPoint()
returns the vector as a point
|
PolarVector |
toPolarVector()
returns the vector as vector defined by measures of longitude, latitude, length
|
SpatialVector |
toSpatialVector()
returns the vector as vector defined by measures of longitude, latitude, length
|
java.lang.String |
toString()
Returns a string representation of the vector.
|
void |
unitLength()
Normalizes vector to unit length
|
public SpatialVector(double x, double y, double z)
x
- x coordinatey
- y coordinatez
- z coordinatepublic SpatialVector(double x, double y)
x
- the x coordinate of the locationy
- the y coordinate of the locationpublic SpatialVector(java.awt.geom.Point2D aPoint)
aPoint
- the coordinates as a Pointpublic SpatialVector()
public java.lang.Object clone()
clone
in class java.lang.Object
public void setLatLong(boolean isLatLong)
isLatLong
- is this a variable with captures defined by latitude and longitudepublic boolean isLatLong()
public double getX()
public double getY()
public double getZ()
public void setX(double dNewX)
dNewX
- the nex x extentpublic void setY(double dNewY)
dNewY
- the nex y extentpublic void setZ(double dNewZ)
dNewZ
- the nex z extentpublic void setConnect(boolean con)
con
- should the SpatialVector be connected with the previous vector?public boolean getConnect()
public SpatialVector copy(SpatialVector v)
v
- a SpatialVectorpublic SpatialVector plus(SpatialVector v)
v
- a SpatialVectorpublic SpatialVector minus(SpatialVector v)
v
- a SpatialVectorpublic SpatialVector times(double dScalar)
dScalar
- a scalar (double) to multiply withpublic double dot(SpatialVector vec)
vec
- a SpatialVector to dot withpublic SpatialVector cross(SpatialVector v)
v
- a SpatialVector to cross withpublic double getXYRad()
public double getXZRad()
public double getXYDeg()
public double getXZDeg()
public double getXYDeg(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic double getXZDeg(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic double getXYRad(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic double getXZRad(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic SpatialVector scale(double dScalar)
dScalar
- a scalar to multiplypublic SpatialVector reverseDirection()
public SpatialVector setLength(double newLength)
newLength
- the desired length or the vectorpublic SpatialVector rotate(SpatialVector aVector)
aVector
- the SpatialVector around which to rotatepublic SpatialVector rotateXY(double r)
r
- the angle (in radians) to rotate in the xy planepublic SpatialVector rotateXZ(double r)
r
- the angle to rotate in the xz planepublic SpatialVector rotate(double xyAngle, double xzAngle)
xyAngle
- the angle to rotate in the xy planexzAngle
- the angle to rotate in the xz planepublic void negate()
public void negateX()
public void negateY()
public void negateZ()
public void unitLength()
public double getLength()
public double getLengthSquared()
public double getManhattanLength()
public boolean equals(SpatialVector v)
v
- another SpatialVectorpublic void subtract(SpatialVector v)
v
- a SpatialVectorpublic java.awt.geom.Point2D.Double getXY()
public java.awt.Point getScaledPoint(GridSpace3D visualSpace)
visualSpace
- the visual space in which x,y will be scaledpublic double getEuclidianDistance(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic java.util.Vector<SpatialVector> getCircleLinesegmentIntersections(MoveVector mVec, double radius)
mVec
- defines points A and B of lineradius
- radius of circlepublic java.util.Vector<SpatialVector> getCircleLinesegmentIntersections(SpatialVector A, SpatialVector B, double radius)
A
- defines point A of lineB
- defines point B of lineradius
- radius of circlepublic java.util.Vector<SpatialVector> getCircleLineIntersections(MoveVector mVec, double radius)
mVec
- defines points A and B of lineradius
- radius of circlepublic java.util.Vector<SpatialVector> getCircleLineIntersections(SpatialVector A, SpatialVector B, double radius)
A
- defines point A of lineA
- defines point B of lineradius
- radius of circlepublic double getDistanceToLinesegment(MoveVector theMove)
public double getDistanceToLinesegment(SpatialVector vecA, SpatialVector vecB)
public double getSquaredEuclidianDistance(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic double getManhattanDistance(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic double getStraightnessIndex(double LongDeg, double LatDeg) throws java.lang.Exception
java.lang.Exception
public double getVolume(double hWidth, double vWidth) throws java.lang.Exception
java.lang.Exception
public SpatialVector remapLatLongToDistanceCoords(SpatialVector theOrigin) throws java.lang.Exception
java.lang.Exception
public SpatialVector getSpatialVector(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic PolarVector getPolarVector(SpatialVector theOtherLocation)
theOtherLocation
- the other locationpublic SpatialVector applyVector(SpatialVector aVector)
aVector
- the vector to applypublic SpatialVector applyVector(PolarVector aVector)
aVector
- the vector to applypublic PolarVector toPolarVector()
public SpatialVector toSpatialVector()
public java.lang.String toString()
toString
in class java.lang.Object
public void list()
public void listValues()
public java.lang.String toFileString()
public java.awt.Point toPoint()
public boolean checkLatLong() throws java.lang.Exception
java.lang.Exception
RH, 2017