Package org.pathvisio.libgpml.util
Class LinAlg
java.lang.Object
org.pathvisio.libgpml.util.LinAlg
public class LinAlg
extends java.lang.Object
Helper class for rotation calculations.
- Author:
- unknown
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LinAlg.Point
Point, pair of doubles. -
Constructor Summary
Constructors Constructor Description LinAlg()
-
Method Summary
Modifier and Type Method Description static double
angle(LinAlg.Point p1, LinAlg.Point p2)
Determines angle between two vectors defined by p1 and p2 Both vectors start at 0.0static double
direction(LinAlg.Point p1, LinAlg.Point p2)
negative: ccw positive: cwstatic double
distance(LinAlg.Point p1, LinAlg.Point p2)
private static double
dot(LinAlg.Point v1, LinAlg.Point v2)
static LinAlg.Point
project(LinAlg.Point p1, LinAlg.Point p2)
Projection of p1 on p2: p1.p2 ----- .static LinAlg.Point
project(LinAlg.Point p, LinAlg.Point q, LinAlg.Point v)
Projection of point q on a line through p with direction vector v If p is 0,0, it's the same as the two-argument function with the same name.static LinAlg.Point
rotate(LinAlg.Point p, double angle)
static double
toLineCoordinates(LinAlg.Point start, LinAlg.Point end, LinAlg.Point p)
Convert a 2-D point to 1-D line coordinates (relative position on the line, range {0,1})Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LinAlg
public LinAlg()
-
-
Method Details
-
angle
Determines angle between two vectors defined by p1 and p2 Both vectors start at 0.0- Parameters:
p1
- start point of vectorp2
- end point of vector- Returns:
- angle in radians
-
direction
negative: ccw positive: cw -
dot
-
project
Projection of point q on a line through p with direction vector v If p is 0,0, it's the same as the two-argument function with the same name. -
toLineCoordinates
Convert a 2-D point to 1-D line coordinates (relative position on the line, range {0,1}) -
project
Projection of p1 on p2: p1.p2 ----- . p2 p2.p2 -
distance
-
rotate
-