public class Geometry
extends java.lang.Object
Constructor and Description |
---|
Geometry() |
Modifier and Type | Method and Description |
---|---|
static double |
areaOfTriangle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] t)
Calculates the area of the triangle passed.
|
static double[] |
calculateAngles(org.apache.commons.math3.geometry.euclidean.threed.Vector3D kneePosition,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D anklePosition)
calculates with the given coordinates the desired angles for Hip and Knee
the Hip-Coordinates are always (0|0).
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
createXRotation(double angle)
Create a Rotation representing a rotation around the x-axis.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
createYRotation(double angle)
Create a Rotation representing a rotation around the y-axis.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
createZRotation(double angle)
Create a Rotation representing a rotation around the z-axis.
|
static java.lang.String |
format(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector)
Formats the given
Vector3D object to produce a String. |
static java.lang.StringBuffer |
format(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector,
java.lang.StringBuffer buffer,
java.text.FieldPosition pos)
Formats the given
Vector3D object to produce a String, which is
appended to the given StringBuilder at the given position. |
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
getFuturePositions(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D speedVector,
float speedDecay,
int howMany)
Returns an array of future positions as predicted by the speed and
speedDecay.
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
getFuturePositions(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D speedVector,
int howMany)
Returns an array of future positions as predicted by the speed.
|
static Angle |
getHorizontalAngle(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation)
Extract the rotation about the z-axis from a given rotation.
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getInterceptionPoint(org.apache.commons.math3.geometry.euclidean.threed.Vector3D startPosition,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] targetPositions,
double ourSpeed) |
static double |
getLinearFuzzyValue(double x0,
double x1,
boolean ascending,
double x)
Returns a linear interpolation between the two passed points at the passed
x coordinate.
|
static Pose2D |
getPointInterpolation(org.apache.commons.math3.geometry.euclidean.threed.Vector3D source,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D destination,
double distanceFromSource) |
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getPointOnLineAbsoluteEnd(org.apache.commons.math3.geometry.euclidean.threed.Vector3D start,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D end,
double distance)
Calculates a point on the line from start to end that is distance away
from the end point towards the start point.
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getPointOnOrthogonal2D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D start,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D end,
double distanceEnd,
double distanceLeft)
Calculates a point that is orthogonal to the start - end line (in 2D) at
the point that is distanceEnd away from end and distanceLeft away from
start - end
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
getPolygon(double[][] points)
Converts the passed points to a Vector3D array representing a polygon
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
getTopViewOrientation(org.apache.commons.math3.geometry.euclidean.threed.Rotation orientation)
Processes the top view z-normalized orientation.
|
static double |
getTopViewZAngle(org.apache.commons.math3.geometry.euclidean.threed.Rotation orientation)
Processes the top view z-rotation.
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
getVectorAtDistanceAndAngle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector,
double distance,
Angle angle)
Method to calculate the vector at a
distance from
vector at an angle to the norm of the passed
vector |
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] |
intersectionPoint(double x1,
double z1,
double r1,
double x2,
double z2,
double r2)
Calculates intersection Point(s) of two circles.
|
static boolean |
isInsidePolygon(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position,
org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] polygon)
Checks if the passed 2D point is inside the passed polygon
|
static double |
linearInterpolation(double x0,
double y0,
double x1,
double y1,
double x)
Returns the linear interpolation (y value) of the passed points (x0,y0)
and (x1,y1) at the passed coordinate x
|
static void |
printMatrix(double[][] matrix)
Print a matrix.
|
static void |
printRotationMatrix(org.apache.commons.math3.geometry.euclidean.threed.Rotation rot)
Print a rotation matrix.
|
static org.apache.commons.math3.geometry.euclidean.threed.Vector3D |
rotateVectorIn2D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vectorToRotate,
double angleInDegrees,
boolean clockwise)
Method to rotate a vector in 2D by an angle about the origin.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
toRotation(org.apache.commons.math3.linear.RealMatrix matrix)
Transform a given matrix to a rotation.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
xTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation,
double xAngle)
Transforms the given rotation relative to a system that is rotated around
the x-axis by xAngle.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
yTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation,
double yAngle)
Transforms the given rotation relative to a system that is rotated around
the y-axis by yAngle.
|
static org.apache.commons.math3.geometry.euclidean.threed.Rotation |
zTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation,
double zAngle)
Transforms the given rotation relative to a system that is rotated around
the z-axis by zAngle.
|
public static java.lang.String format(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector)
Vector3D
object to produce a String.vector
- the vector to formatpublic static java.lang.StringBuffer format(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector, java.lang.StringBuffer buffer, java.text.FieldPosition pos)
Vector3D
object to produce a String, which is
appended to the given StringBuilder at the given position.vector
- the vector to formatbuffer
- the StringBuffer to which the formated vector should be
appendedpos
- the position in the buffer at which the vector should be
appendedpublic static boolean isInsidePolygon(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] polygon)
position
- the point to check (x,y) (it has to be in the same
coordinate system as the points of the polygonpolygon
- corner points 2D of the polygon in clockwise directionpublic static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] getPolygon(double[][] points)
points
- the corner points (x,y)public static double[] calculateAngles(org.apache.commons.math3.geometry.euclidean.threed.Vector3D kneePosition, org.apache.commons.math3.geometry.euclidean.threed.Vector3D anklePosition)
xKnee
- - x Position of the KneezKnee
- - z Position of the KneexFoot
- - x Position of the Foot (Ankle)zFoot
- - y Position of the Foot (Ankle)public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] intersectionPoint(double x1, double z1, double r1, double x2, double z2, double r2)
x1
- X coordinate of the first circlez1
- Z coordinate of the first circler1
- radius of the first circlex2
- X coordinate of the second circlez2
- Z coordinate of the second circler2
- radius of the second circlepublic static double getLinearFuzzyValue(double x0, double x1, boolean ascending, double x)
x0
- lower x valuex1
- higher x valueascending
- true if the lower x value represents 0 false if it
represents 1x
- the x value for which to get the fuzzy valuepublic static double linearInterpolation(double x0, double y0, double x1, double y1, double x)
x0
- x coordinate of the first pointy0
- y coordinate of the first pointx1
- x coordinate of the second pointy1
- y coordinate of the second pointx
- x coordinate of the point of interestpublic static org.apache.commons.math3.geometry.euclidean.threed.Vector3D rotateVectorIn2D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vectorToRotate, double angleInDegrees, boolean clockwise)
Note: Rotation displaces the polygon
vectorToRotate
- - the vector that has to be rotatedangleInDegrees
- - the angle of rotation in degreesclockwise
- - true if the vector has to be rotated clockwise, false
if anti-clockwisepublic static org.apache.commons.math3.geometry.euclidean.threed.Vector3D getVectorAtDistanceAndAngle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D vector, double distance, Angle angle)
distance
from
vector
at an angle
to the norm of the passed
vectorvector
- - the vector from which to find the displaced and rotated
vectordistance
- - the distance from the vector
angle
- - Angle objectpublic static double areaOfTriangle(org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] t)
t
- - trianglepublic static Pose2D getPointInterpolation(org.apache.commons.math3.geometry.euclidean.threed.Vector3D source, org.apache.commons.math3.geometry.euclidean.threed.Vector3D destination, double distanceFromSource)
source
- source pointdestination
- destination pointdistanceFromSource
- distance from source pointpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation createXRotation(double angle)
angle
- - the turn angle (rad)public static org.apache.commons.math3.geometry.euclidean.threed.Rotation createYRotation(double angle)
angle
- - the turn angle (rad)public static org.apache.commons.math3.geometry.euclidean.threed.Rotation createZRotation(double angle)
angle
- - the turn angle (rad)public static Angle getHorizontalAngle(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation)
rotation
- the rotationpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation toRotation(org.apache.commons.math3.linear.RealMatrix matrix)
matrix
- the matrix containing a rotationpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation xTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation, double xAngle)
rotation
- - the rotation to transformxAngle
- - difference x-angle in radpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation yTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation, double yAngle)
rotation
- - the rotation to transformyAngle
- - difference y-angle in radpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation zTransformRotation(org.apache.commons.math3.geometry.euclidean.threed.Rotation rotation, double zAngle)
rotation
- - the rotation to transformzAngle
- - difference z-angle in radpublic static org.apache.commons.math3.geometry.euclidean.threed.Rotation getTopViewOrientation(org.apache.commons.math3.geometry.euclidean.threed.Rotation orientation)
orientation
- - global orientationpublic static double getTopViewZAngle(org.apache.commons.math3.geometry.euclidean.threed.Rotation orientation)
orientation
- - global orientationpublic static void printRotationMatrix(org.apache.commons.math3.geometry.euclidean.threed.Rotation rot)
rotation
- - the rotation to print.public static void printMatrix(double[][] matrix)
matrix
- the matrix to print.public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D getPointOnLineAbsoluteEnd(org.apache.commons.math3.geometry.euclidean.threed.Vector3D start, org.apache.commons.math3.geometry.euclidean.threed.Vector3D end, double distance)
start
- the start point of the lineend
- the end point of the linedistance
- the distance from end (absolute)public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D getPointOnOrthogonal2D(org.apache.commons.math3.geometry.euclidean.threed.Vector3D start, org.apache.commons.math3.geometry.euclidean.threed.Vector3D end, double distanceEnd, double distanceLeft)
start
- the start point of the lineend
- the end pointdistanceEnd
- the distance from end (absolute) towards startdistanceLeft
- the distance of the point from the linepublic static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] getFuturePositions(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, org.apache.commons.math3.geometry.euclidean.threed.Vector3D speedVector, int howMany)
position
- The current position of the object.speedVector
- The speed vector of the object.howMany
- The number of future positions that should be returnedpublic static org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] getFuturePositions(org.apache.commons.math3.geometry.euclidean.threed.Vector3D position, org.apache.commons.math3.geometry.euclidean.threed.Vector3D speedVector, float speedDecay, int howMany)
position
- The current position of the object.speedVector
- The speed vector of the object.speedDecay
- The decay of the speed vector (0 < speedDecay <=
1).howMany
- The number of future positions that should be returned.public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D getInterceptionPoint(org.apache.commons.math3.geometry.euclidean.threed.Vector3D startPosition, org.apache.commons.math3.geometry.euclidean.threed.Vector3D[] targetPositions, double ourSpeed)
startPosition
- targetPositions
- ourSpeed
-