C# Class HandInput.Util.GeometryUtil

Mostrar archivo Open project: ushadow/handinput

Public Methods

Method Description
Angle ( System.Windows v1, System.Windows v2 ) : float

Angle between two vectors in radians.

BetweenX ( Point p, Point p1, Point p2 ) : bool

Returns true iff p lies somewhere between p1 and p2 on x-coordinate

Center ( this rect ) : Point
ClosestPointToLine ( PointF a, PointF b, PointF p ) : PointF
CrossProduct ( System.Windows v1, System.Windows v2 ) : float

Returns the scalar value of the cross product of two vectors.

Distance ( Point p1, Point p2 ) : double

Returns distance between p1 and p2.

Distance ( PointF p1, PointF p2 ) : double

Returns distance between p1 and p2.

Distance2 ( double x1, double y1, double x2, double y2 ) : double
Distance2 ( Point p1, Point p2 ) : float

Squared Euclidean distance of two 2D points.

Distance2 ( PointF p1, PointF p2 ) : float

Squared Euclidean distance of two 2D points.

DotProduct ( System.Windows v1, System.Windows v2 ) : float
EllipseAxes ( MCvBox2D ellipse ) : System.Drawing.PointF[]

Returns the end points of the major and minor axes of an ellipse.

Extend ( PointF p1, PointF p2, float extension ) : PointF

Extends segment (p1, p2) by certain length. The direction of extension is from p1 to p2. If extension is negative, it is equivalent to shortening the segment. The length of the segment cannot be zero.

GradientInDegree ( Point p1, Point p2 ) : float

Returns the angle in degree of the gradient of the line defined by two points.

IsAngleClockwise ( PointF a, PointF b, PointF c ) : bool

Returns true if the angle from vector bc to vector ba is clockwise.

IsAngleClockwise ( System.Windows v1, System.Windows v2 ) : bool
LineIntersection ( PointF a, PointF b, PointF c, PointF d ) : PointF

Point of intersection between line ab and line cd.

LinePointDistance ( PointF p1, PointF p2, PointF p ) : float

Calculates the signed perpendicular distance from a point to a line. Point on the right side of the vector (P1 -> P2) will be NEGATIVE.

LineSegPointDistance ( Point a, Point b, Point p ) : double

Line segement (a, b) to point p distance.

Midpoint ( DepthImagePoint p1, DepthImagePoint p2 ) : DepthImagePoint
Midpoint ( Point p1, Point p2 ) : Point
Midpoint ( PointF p1, PointF p2 ) : PointF
Offset ( Point p1, System.Windows dir, float len ) : Point

Offsets a point in a particular direction by certian length.

Offset ( PointF p1, System.Windows dir, float len ) : PointF
Perp ( System.Windows v ) : System.Windows.Vector

Returns a new vector which is perpendicular to v.

ProjectionDistance ( PointF a, PointF b, PointF p ) : float

Signed length of projection of (a->p) to vector (a->b).

Rotate ( PointF p, PointF pivot, double theta ) : PointF
SegmentsIntersect ( Point a1, Point a2, Point b1, Point b2 ) : bool

Returns true if segment (a1, a2) intersects with segment (b1, b2) including end points.

SegmentsIntersect ( PointF a1, PointF a2, PointF b1, PointF b2 ) : bool
Sign ( double n ) : int
Slope ( Point p1, Point p2 ) : double
Vector ( PointF a, PointF b ) : System.Windows.Vector

Returns a new Vector from a to b.

Method Details

Angle() public static method

Angle between two vectors in radians.
public static Angle ( System.Windows v1, System.Windows v2 ) : float
v1 System.Windows
v2 System.Windows
return float

BetweenX() public static method

Returns true iff p lies somewhere between p1 and p2 on x-coordinate
public static BetweenX ( Point p, Point p1, Point p2 ) : bool
p Point
p1 Point
p2 Point
return bool

Center() public static method

public static Center ( this rect ) : Point
rect this
return System.Windows.Point

ClosestPointToLine() public static method

public static ClosestPointToLine ( PointF a, PointF b, PointF p ) : PointF
a System.Drawing.PointF
b System.Drawing.PointF
p System.Drawing.PointF
return System.Drawing.PointF

CrossProduct() public static method

Returns the scalar value of the cross product of two vectors.
public static CrossProduct ( System.Windows v1, System.Windows v2 ) : float
v1 System.Windows
v2 System.Windows
return float

Distance() public static method

Returns distance between p1 and p2.
public static Distance ( Point p1, Point p2 ) : double
p1 Point
p2 Point
return double

Distance() public static method

Returns distance between p1 and p2.
public static Distance ( PointF p1, PointF p2 ) : double
p1 System.Drawing.PointF
p2 System.Drawing.PointF
return double

Distance2() public static method

public static Distance2 ( double x1, double y1, double x2, double y2 ) : double
x1 double
y1 double
x2 double
y2 double
return double

Distance2() public static method

Squared Euclidean distance of two 2D points.
public static Distance2 ( Point p1, Point p2 ) : float
p1 Point Point 1.
p2 Point Point 2.
return float

Distance2() public static method

Squared Euclidean distance of two 2D points.
public static Distance2 ( PointF p1, PointF p2 ) : float
p1 System.Drawing.PointF Point 1.
p2 System.Drawing.PointF Point 2.
return float

DotProduct() public static method

public static DotProduct ( System.Windows v1, System.Windows v2 ) : float
v1 System.Windows
v2 System.Windows
return float

EllipseAxes() public static method

Returns the end points of the major and minor axes of an ellipse.
public static EllipseAxes ( MCvBox2D ellipse ) : System.Drawing.PointF[]
ellipse MCvBox2D
return System.Drawing.PointF[]

Extend() public static method

Extends segment (p1, p2) by certain length. The direction of extension is from p1 to p2. If extension is negative, it is equivalent to shortening the segment. The length of the segment cannot be zero.
public static Extend ( PointF p1, PointF p2, float extension ) : PointF
p1 System.Drawing.PointF One end of the segment.
p2 System.Drawing.PointF The other end of the segment.
extension float The length of the extension.
return System.Drawing.PointF

GradientInDegree() public static method

Returns the angle in degree of the gradient of the line defined by two points.
public static GradientInDegree ( Point p1, Point p2 ) : float
p1 Point
p2 Point
return float

IsAngleClockwise() public static method

Returns true if the angle from vector bc to vector ba is clockwise.
public static IsAngleClockwise ( PointF a, PointF b, PointF c ) : bool
a System.Drawing.PointF
b System.Drawing.PointF
c System.Drawing.PointF
return bool

IsAngleClockwise() public static method

public static IsAngleClockwise ( System.Windows v1, System.Windows v2 ) : bool
v1 System.Windows
v2 System.Windows
return bool

LineIntersection() public static method

Point of intersection between line ab and line cd.
public static LineIntersection ( PointF a, PointF b, PointF c, PointF d ) : PointF
a System.Drawing.PointF
b System.Drawing.PointF
c System.Drawing.PointF
d System.Drawing.PointF
return System.Drawing.PointF

LinePointDistance() public static method

Calculates the signed perpendicular distance from a point to a line. Point on the right side of the vector (P1 -> P2) will be NEGATIVE.
public static LinePointDistance ( PointF p1, PointF p2, PointF p ) : float
p1 System.Drawing.PointF One end of the line.
p2 System.Drawing.PointF The other end of the line.
p System.Drawing.PointF
return float

LineSegPointDistance() public static method

Line segement (a, b) to point p distance.
public static LineSegPointDistance ( Point a, Point b, Point p ) : double
a Point
b Point
p Point
return double

Midpoint() public static method

public static Midpoint ( DepthImagePoint p1, DepthImagePoint p2 ) : DepthImagePoint
p1 DepthImagePoint
p2 DepthImagePoint
return DepthImagePoint

Midpoint() public static method

public static Midpoint ( Point p1, Point p2 ) : Point
p1 Point
p2 Point
return Point

Midpoint() public static method

public static Midpoint ( PointF p1, PointF p2 ) : PointF
p1 System.Drawing.PointF
p2 System.Drawing.PointF
return System.Drawing.PointF

Offset() public static method

Offsets a point in a particular direction by certian length.
public static Offset ( Point p1, System.Windows dir, float len ) : Point
p1 Point
dir System.Windows
len float
return Point

Offset() public static method

public static Offset ( PointF p1, System.Windows dir, float len ) : PointF
p1 System.Drawing.PointF
dir System.Windows
len float
return System.Drawing.PointF

Perp() public static method

Returns a new vector which is perpendicular to v.
public static Perp ( System.Windows v ) : System.Windows.Vector
v System.Windows The original vector.
return System.Windows.Vector

ProjectionDistance() public static method

Signed length of projection of (a->p) to vector (a->b).
public static ProjectionDistance ( PointF a, PointF b, PointF p ) : float
a System.Drawing.PointF
b System.Drawing.PointF
p System.Drawing.PointF
return float

Rotate() public static method

public static Rotate ( PointF p, PointF pivot, double theta ) : PointF
p System.Drawing.PointF
pivot System.Drawing.PointF
theta double
return System.Drawing.PointF

SegmentsIntersect() public static method

Returns true if segment (a1, a2) intersects with segment (b1, b2) including end points.
public static SegmentsIntersect ( Point a1, Point a2, Point b1, Point b2 ) : bool
a1 Point
a2 Point
b1 Point
b2 Point
return bool

SegmentsIntersect() public static method

public static SegmentsIntersect ( PointF a1, PointF a2, PointF b1, PointF b2 ) : bool
a1 System.Drawing.PointF
a2 System.Drawing.PointF
b1 System.Drawing.PointF
b2 System.Drawing.PointF
return bool

Sign() public static method

public static Sign ( double n ) : int
n double
return int

Slope() public static method

public static Slope ( Point p1, Point p2 ) : double
p1 Point
p2 Point
return double

Vector() public static method

Returns a new Vector from a to b.
public static Vector ( PointF a, PointF b ) : System.Windows.Vector
a System.Drawing.PointF
b System.Drawing.PointF
return System.Windows.Vector