public class Location extends Object implements ILocated, Serializable, Cloneable
Modifier and Type | Class and Description |
---|---|
static class |
Location.PropertyEditor
PropertyEditor for class Location.
|
Modifier and Type | Field and Description |
---|---|
static double |
DISTANCE_ZERO
Zero delta for
Location#equals(Location) . |
static Pattern |
locationPattern
Pattern used to parse
toString() in
Location(String) . |
static Location |
NONE
Location representing NONE.
|
double |
x
X coordinate.
|
double |
y
Y coordinate.
|
double |
z
Z coordinate.
|
static Location |
ZERO
Location(0,0,0).
|
Constructor and Description |
---|
Location(double[] d)
Creates location from array of three doubles.
|
Location(double x,
double y)
Creates location with specified planar coordinates.
|
Location(double x,
double y,
double z)
Creates location with specified coordinates.
|
Location(float[] f)
Creates location from array of three doubles.
|
Location(Location source)
Copy constructor
|
Location(math.geom3d.Point3D p)
Creates location from specified 3D point.
|
Location(String string)
Parses the location from the "string" generated by
toString() . |
Location(javax.vecmath.Tuple3d p)
Creates location from specified 3D point.
|
Modifier and Type | Method and Description |
---|---|
Location |
add(Location l)
Retreives sum of this location and given location.
|
static Location |
add(Location l1,
Location l2)
Retreives sum of two given locations.
|
static Location |
add(Location l,
Velocity v)
Adds given velocity to given location.
|
Location |
add(Velocity v)
Adds given velocity to this location.
|
Location |
addX(double x)
Adds to the X coordinate.
|
Location |
addY(double y)
Adds to the Y coordinate.
|
Location |
addZ(double z)
Adds to the Z coordinate.
|
javax.vecmath.Point3d |
asPoint3d() |
math.geom3d.Point3D |
asPoint3D() |
javax.vecmath.Vector3d |
asVector3d() |
Location |
clone() |
Location |
cross(Location b)
Calculates cross product of this Location and Lcoations b
|
double |
dot(Location b)
Calculates dot product of this Location and Location b
|
double |
dot2D(Location b)
Calculates dot product of this Location and Location b in 2D (x,y coord
only)
|
static boolean |
equal(Location l1,
Location l2)
Tells, whether two given locations equal.
|
static boolean |
equal(Location l1,
Location l2,
double epsilon)
Tells, whether the distance between coordinates of two given locations is
less than or equal to the given epsilon.
|
boolean |
equals(Location l,
double epsilon)
Tells, whether the distance between coordinates of this location and
given location is less than or equal to the given epsilon.
|
boolean |
equals(Object obj)
Tells, whether this location equals to given object.
|
static Location |
getAverage(Collection<Location> locations)
Calculates average of all 'locations'.
|
double |
getDistance(Location l)
Calculates the distance between this and given location.
|
static double |
getDistance(Location l1,
Location l2)
Calculates the distance between two given locations.
|
double |
getDistance2D(Location l)
Calculates the distance between this and given location (ignoring 'z'
coordinate).
|
static double |
getDistance2D(Location l1,
Location l2)
Calculates the distance between two given locations (ignoring 'z'
coordinate).
|
double |
getDistanceL1(Location l)
Calculates the Manhattan distance between this and given location.
|
static double |
getDistanceL1(Location l1,
Location l2)
Calculates the Manhattan distance between two given locations.
|
double |
getDistanceLinf(Location l)
Calculates the Chebyshev distance between this and given location.
|
static double |
getDistanceLinf(Location l1,
Location l2)
Calculates the Chebyshev distance between two given locations.
|
double |
getDistancePlane(Location l)
Calculates the distance between this and given location after being
projected to the (x,y) plane.
|
static double |
getDistancePlane(Location l1,
Location l2)
Calculates the distance between two given locations after being projected
to the (x,y) plane.
|
double |
getDistanceSquare(Location l)
Calculates the square of the distance between this and given location.
|
static double |
getDistanceSquare(Location l1,
Location l2)
Calculates the square of the distance between two given locations.
|
double |
getDistanceZ(Location location)
Returns difference between z-coords (this.z - location.z).
|
double |
getLength()
Calculates length of Location
|
Location |
getLocation()
Retreives the location itself to implement
ILocated . |
Location |
getNormalized()
Normalizes this Location
|
javax.vecmath.Point3d |
getPoint3d()
Retreives javax.vecmath.Point3d representation of the location.
|
Rotation |
getQuatLikeRotationSeq(Rotation.Order order)
WIP not completed yet.
|
Rotation |
getRotation(Rotation.Order order)
Converts Location into Rotation.
|
double |
getX()
X coordinate.
|
double |
getY()
Y coordinate.
|
double |
getZ()
Z coordinate.
|
int |
hashCode()
Generates a hashCode for this Location.
|
Location |
interpolate(Location l,
double d)
Lineary interpolates between this location and given location.
|
static Location |
interpolate(Location l1,
Location l2,
double d)
Linearly interpolates between two given locations.
|
Location |
invert()
Calculates inverse Location
|
Location |
mul(javax.vecmath.Matrix3d matrix)
Projects this Location (vector) using matrix from parameter
|
Location |
scale(double d)
Scales values of all three coordinates by given multiplier.
|
Location |
scaleX(double x)
Scales the X coordinate.
|
Location |
scaleY(double y)
Scales the Y coordinate.
|
Location |
scaleZ(double z)
Scales the Z coordinate.
|
Location |
setX(double x)
Sets the X coordinate.
|
Location |
setY(double y)
Sets the Y coordinate.
|
Location |
setZ(double z)
Sets the Z coordinate.
|
Location |
sub(Location l)
Retreives subtraction of given location from this location.
|
static Location |
sub(Location l1,
Location l2)
Retreives subtraction of two given locations.
|
static Location |
sub(Location l,
Velocity v)
Subtracts given velocity from given location.
|
Location |
sub(Velocity v)
Subtracts given velocity from this location.
|
String |
toString() |
public static final Location NONE
public static final Location ZERO
public final double x
public final double y
public final double z
public static final Pattern locationPattern
toString()
in
Location(String)
.public static final double DISTANCE_ZERO
Location#equals(Location)
.public Location(double x, double y, double z)
x
- X coordinate.y
- Y coordinate.z
- Z coordinate.public Location(double x, double y)
x
- X coordinate.y
- Y coordinate.public Location(Location source)
source
- Location to copypublic Location(String string)
toString()
. If it fails, it throws RuntimeException.string
- public Location(double[] d)
d
- Array of doubles to be used for creation.public Location(float[] f)
f
- Array of to be used for creation.public Location(javax.vecmath.Tuple3d p)
p
- Point in space to be used for creation.public Location(math.geom3d.Point3D p)
p
- Point in space to be used for creation.public javax.vecmath.Vector3d asVector3d()
public javax.vecmath.Point3d asPoint3d()
public math.geom3d.Point3D asPoint3D()
public double getX()
public double getY()
public double getZ()
public Location add(Location l)
l
- Location to be added to this location.public static Location add(Location l1, Location l2)
l1
- First location to be summed.l2
- Second location to be summed.public Location sub(Location l)
l
- Location to be subtracted.public static Location sub(Location l1, Location l2)
l1
- Location to be subtracted from.l2
- Location to be subtracted.public Location add(Velocity v)
v
- Velocity to be added to this location.public static Location add(Location l, Velocity v)
l
- Location to be summed.v
- Velocity to be summed.public Location sub(Velocity v)
v
- Velocity to be subtracted.public static Location sub(Location l, Velocity v)
l
- Location to be subtracted from.v
- Velocity to be subtracted.public Location scale(double d)
d
- Scaling multiplier.public Location interpolate(Location l, double d)
l
- Location to be interpolated to.d
- Interpolation parameter.public static Location interpolate(Location l1, Location l2, double d)
l1
- Location to be interpolated from.l2
- Location to be interpolated to.d
- Interpolation parameter.public int hashCode()
public boolean equals(Object obj)
public static boolean equal(Location l1, Location l2)
l1
- First location to compare.l2
- Second location to compare.public boolean equals(Location l, double epsilon)
l
- Location to compare with.epsilon
- Epsilon to compare with.public static boolean equal(Location l1, Location l2, double epsilon)
l1
- First location to compare.l2
- Second location to compare.epsilon
- Epsilon to compare with.public static Location getAverage(Collection<Location> locations)
locations
- public double getDistance(Location l)
l
- Location to be calculated the distance to.public double getDistance2D(Location l)
l
- Location to be calculated the distance to.public static double getDistance(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public double getDistanceZ(Location location)
location
- public static double getDistance2D(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public double getDistanceSquare(Location l)
l
- Location to be calculated the distance to.public static double getDistanceSquare(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public double getDistanceL1(Location l)
l
- Location to be calculated the distance to.public static double getDistanceL1(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public double getDistanceLinf(Location l)
l
- Location to be calculated the distance to.public static double getDistanceLinf(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public double getDistancePlane(Location l)
l
- Location to be calculated the distance to.public static double getDistancePlane(Location l1, Location l2)
l1
- Location to be calculated the distance from.l2
- Location to be calculated the distance to.public Location getLocation()
ILocated
.getLocation
in interface ILocated
public javax.vecmath.Point3d getPoint3d()
public double dot(Location b)
b
- Location to dot withpublic double dot2D(Location b)
b
- Location to dot withpublic Location cross(Location b)
b
- Location to cross withpublic Rotation getRotation(Rotation.Order order)
order
- tells resulting rotation, which rotation order should it
representpublic Rotation getQuatLikeRotationSeq(Rotation.Order order)
order
- public Location getNormalized()
public double getLength()
public Location mul(javax.vecmath.Matrix3d matrix)
matrix
- projection matrixpublic Location invert()
public Location setX(double x)
public Location setY(double y)
public Location setZ(double z)
public Location addX(double x)
public Location addY(double y)
public Location addZ(double z)
public Location scaleX(double x)
public Location scaleY(double y)
public Location scaleZ(double z)
Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.