|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.clackrouter.jgraph.utils.MathExtensions
public abstract class MathExtensions
Constructor Summary | |
---|---|
MathExtensions()
|
Method Summary | |
---|---|
static double |
abs(double x,
double y)
Computes the absolute value of a Vector, running from the Point (0;0) to the Point (x;y) . |
static double |
abs(java.awt.geom.Point2D.Double v)
Computes the absolute value of v . |
static double |
angleBetween(java.awt.geom.Point2D.Double v1,
java.awt.geom.Point2D.Double v2)
Calculates the angle between v1 and v2. |
static double |
getEuclideanDistance(java.awt.geom.Point2D.Double p1,
java.awt.geom.Point2D.Double p2)
Returns the euclidean Distance between two Points in a 2D cartesian coordinate system. |
static java.awt.geom.Point2D.Double |
getNormalizedVector(java.awt.geom.Point2D.Double v)
|
static double |
getTransposed(java.awt.geom.Point2D.Double v1,
java.awt.geom.Point2D.Double v2)
Calculates the Transposed of v1 and v2. |
static double |
sgn(double x)
Extracts the leading sign of x. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MathExtensions()
Method Detail |
---|
public static double sgn(double x)
x
- Any double value.
-1.0
, for x = 0.0
here comes 0.0
and if x has a negative the method returns
-1.0
.public static double abs(java.awt.geom.Point2D.Double v)
v
. Assuming v
is a mathematical Vector, pointing from Point Zero to the Point, represented
by x
and y
in v, then this method returns the
length of v.
return sqrt( v.x? + v.y? )
v
- Point the Vector is pointing at, coming from the point
(0;0)
.
public static double abs(double x, double y)
(0;0)
to the Point (x;y)
. This is the length
of that Vector.
return sqrt( v.x? + v.y? )
x
- Length of one Karthese. Between x and y is an Angle of 90?y
- Length of the other Karthese. Between x and y is an Angle of 90?
public static double angleBetween(java.awt.geom.Point2D.Double v1, java.awt.geom.Point2D.Double v2)
(0;0)
to
their coordinates, the angle in (0;0)
is calculated.
return arccos( ( v1.x*v2.x + v1.y*v2.y ) / ( sqrt( v1.x? + v1.y? ) * sqrt( v2.x? + v2.y? ) ) )
v1
- One of two Vectors leading from (0;0)
to
(v1.x;v1.y)
v2
- One of two Vectors leading from (0;0)
to
(v2.x;v2.y)
public static double getTransposed(java.awt.geom.Point2D.Double v1, java.awt.geom.Point2D.Double v2)
(0;0)
to
their coordinates.
return v1.x * v2.x + v1.y * v2.y
v1
- Vector, leading from (0;0)
to the coordinates of
the point.v2
- Vector, leading from (0;0)
to the coordinates of
the point.
public static double getEuclideanDistance(java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
sqrt( (p1.x - p2.x)? + (p1.y - p2.y)? )
p1
- First of two Points, the Distance should be calculated between.p2
- Second of two Points, the Distance should be calculated between.
public static java.awt.geom.Point2D.Double getNormalizedVector(java.awt.geom.Point2D.Double v)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |