C# Class Loyc.Geometry.PointMath

显示文件 Open project: qwertie/ecsharp Class Usage Examples

Public Methods

Method Description
Abs ( this v ) : Vector

Gets the absolute value of the vector's individual components.

Abs ( this v ) : System.Vector3

Gets the absolute value of the vector's individual components.

Add ( this a, System.Point b ) : System.Point
Add ( this a, Vector b ) : System.Point
Add ( this a, Point3 b ) : Point3
Add ( this a, System.Vector3 b ) : Point3
Add ( this a, Vector b ) : Vector
Add ( this a, System.Vector3 b ) : System.Vector3
Angle ( this v ) : double

Gets the angle from 0 to 2*PI of the vector, where (1,0) has angle 0 and (0,1) has angle PI/2.

AngleDeg ( this v ) : double

Gets the angle from 0 to 360 of the vector, where (1,0) has angle 0 and (0,1) has angle 90.

ComputeConvexHull ( IEnumerable points ) : IListSource

Computes the convex hull of a polygon, in clockwise order in a Y-up coordinate system (counterclockwise in a Y-down coordinate system).

Uses the Monotone Chain algorithm, a.k.a. Andrew's Algorithm.

ComputeConvexHull ( List points, bool sortInPlace ) : IListSource
Cross ( this a, Vector b ) : T

Computes the "cross product" of a pair of 2D vectors.

This is not a general cross product, as cross product is only a 3D concept, but this operator acts as though the two points were in the Z=0 plane and returns the Z coordinate of the cross product: b.X * a.Y - b.Y * a.X. This value is zero if the vectors are parallel; it is a.Length * b.Length or -a.Length * b.Length if the vectors are perpendicular. One use of cross product is to determine whether the angle between two lines is greater or less than 180 degrees, corresponding to return values less or greater than zero.

Cross ( this a, System.Vector3 b ) : System.Vector3

Computes the cross product of a pair of 3D vectors.

Div ( this p, T factor ) : System.Point
Div ( this p, T factor ) : Point3
Div ( this p, T factor ) : Vector
Div ( this p, T factor ) : System.Vector3
Dot ( this a, Vector b ) : T

Dot product. a*b equals lhs.Length*rhs.Length*Cos(theta) if theta is the angle between two vectors.

Dot ( this a, System.Vector3 b ) : T
Length ( this v ) : T

Gets the length of the vector.

Mul ( this p, T factor ) : System.Point
Mul ( this p, T factor ) : Point3
Mul ( this p, T factor ) : Vector
Mul ( this p, T factor ) : System.Vector3
MulDiv ( this v, T mul, T div ) : Vector
MulDiv ( this v, T mul, T div ) : System.Vector3
Neg ( this a ) : Vector

Reverses a vector.

Neg ( this a ) : System.Vector3

Reverses a vector.

Normalized ( this v ) : Vector
Normalized ( this v ) : System.Vector3
PolarToPoint ( T magnitude, double radians ) : Point
PolarToVector ( T magnitude, double radians ) : Vector
Quadrance ( this v ) : T

Gets the square of the length of the vector.

Rot90 ( this a ) : Vector

Rotates a vector 90 degrees.

Rotatation is clockwise if increasing Y goes downward, counter- clockwise if increasing Y goes upward. If the vector represents the direction of a line, the result also represents the coefficients (a,b) of the implicit line equation aX + bY + c = 0.

Shl ( this p, int amt ) : System.Point
Shl ( this p, int amt ) : Point3
Shl ( this p, int amt ) : Vector
Shl ( this p, int amt ) : System.Vector3
Shr ( this p, int amt ) : System.Point
Shr ( this p, int amt ) : Point3
Shr ( this p, int amt ) : Vector
Shr ( this p, int amt ) : System.Vector3
Sub ( this a, Vector b ) : System.Point
Sub ( this a, System.Point b ) : Vector
Sub ( this a, Vector b ) : Vector
Sub ( this a, Point3 b ) : System.Vector3
Sub ( this a, System.Vector3 b ) : System.Vector3
Vector ( this seg ) : Vector

Returns seg.B - seg.A.

Method Details

Abs() public static method

Gets the absolute value of the vector's individual components.
public static Abs ( this v ) : Vector
v this
return Vector

Abs() public static method

Gets the absolute value of the vector's individual components.
public static Abs ( this v ) : System.Vector3
v this
return System.Vector3

Add() public static method

public static Add ( this a, System.Point b ) : System.Point
a this
b System.Point
return System.Point

Add() public static method

public static Add ( this a, Vector b ) : System.Point
a this
b Vector
return System.Point

Add() public static method

public static Add ( this a, Point3 b ) : Point3
a this
b Point3
return Point3

Add() public static method

public static Add ( this a, System.Vector3 b ) : Point3
a this
b System.Vector3
return Point3

Add() public static method

public static Add ( this a, Vector b ) : Vector
a this
b Vector
return Vector

Add() public static method

public static Add ( this a, System.Vector3 b ) : System.Vector3
a this
b System.Vector3
return System.Vector3

Angle() public static method

Gets the angle from 0 to 2*PI of the vector, where (1,0) has angle 0 and (0,1) has angle PI/2.
public static Angle ( this v ) : double
v this
return double

AngleDeg() public static method

Gets the angle from 0 to 360 of the vector, where (1,0) has angle 0 and (0,1) has angle 90.
public static AngleDeg ( this v ) : double
v this
return double

ComputeConvexHull() public static method

Computes the convex hull of a polygon, in clockwise order in a Y-up coordinate system (counterclockwise in a Y-down coordinate system).
Uses the Monotone Chain algorithm, a.k.a. Andrew's Algorithm.
public static ComputeConvexHull ( IEnumerable points ) : IListSource
points IEnumerable
return IListSource

ComputeConvexHull() public static method

public static ComputeConvexHull ( List points, bool sortInPlace ) : IListSource
points List
sortInPlace bool
return IListSource

Cross() public static method

Computes the "cross product" of a pair of 2D vectors.
This is not a general cross product, as cross product is only a 3D concept, but this operator acts as though the two points were in the Z=0 plane and returns the Z coordinate of the cross product: b.X * a.Y - b.Y * a.X. This value is zero if the vectors are parallel; it is a.Length * b.Length or -a.Length * b.Length if the vectors are perpendicular. One use of cross product is to determine whether the angle between two lines is greater or less than 180 degrees, corresponding to return values less or greater than zero.
public static Cross ( this a, Vector b ) : T
a this
b Vector
return T

Cross() public static method

Computes the cross product of a pair of 3D vectors.
public static Cross ( this a, System.Vector3 b ) : System.Vector3
a this
b System.Vector3
return System.Vector3

Div() public static method

public static Div ( this p, T factor ) : System.Point
p this
factor T
return System.Point

Div() public static method

public static Div ( this p, T factor ) : Point3
p this
factor T
return Point3

Div() public static method

public static Div ( this p, T factor ) : Vector
p this
factor T
return Vector

Div() public static method

public static Div ( this p, T factor ) : System.Vector3
p this
factor T
return System.Vector3

Dot() public static method

Dot product. a*b equals lhs.Length*rhs.Length*Cos(theta) if theta is the angle between two vectors.
public static Dot ( this a, Vector b ) : T
a this
b Vector
return T

Dot() public static method

public static Dot ( this a, System.Vector3 b ) : T
a this
b System.Vector3
return T

Length() public static method

Gets the length of the vector.
public static Length ( this v ) : T
v this
return T

Mul() public static method

public static Mul ( this p, T factor ) : System.Point
p this
factor T
return System.Point

Mul() public static method

public static Mul ( this p, T factor ) : Point3
p this
factor T
return Point3

Mul() public static method

public static Mul ( this p, T factor ) : Vector
p this
factor T
return Vector

Mul() public static method

public static Mul ( this p, T factor ) : System.Vector3
p this
factor T
return System.Vector3

MulDiv() public static method

public static MulDiv ( this v, T mul, T div ) : Vector
v this
mul T
div T
return Vector

MulDiv() public static method

public static MulDiv ( this v, T mul, T div ) : System.Vector3
v this
mul T
div T
return System.Vector3

Neg() public static method

Reverses a vector.
public static Neg ( this a ) : Vector
a this
return Vector

Neg() public static method

Reverses a vector.
public static Neg ( this a ) : System.Vector3
a this
return System.Vector3

Normalized() public static method

public static Normalized ( this v ) : Vector
v this
return Vector

Normalized() public static method

public static Normalized ( this v ) : System.Vector3
v this
return System.Vector3

PolarToPoint() public static method

public static PolarToPoint ( T magnitude, double radians ) : Point
magnitude T
radians double
return Point

PolarToVector() public static method

public static PolarToVector ( T magnitude, double radians ) : Vector
magnitude T
radians double
return Vector

Quadrance() public static method

Gets the square of the length of the vector.
public static Quadrance ( this v ) : T
v this
return T

Rot90() public static method

Rotates a vector 90 degrees.
Rotatation is clockwise if increasing Y goes downward, counter- clockwise if increasing Y goes upward. If the vector represents the direction of a line, the result also represents the coefficients (a,b) of the implicit line equation aX + bY + c = 0.
public static Rot90 ( this a ) : Vector
a this
return Vector

Shl() public static method

public static Shl ( this p, int amt ) : System.Point
p this
amt int
return System.Point

Shl() public static method

public static Shl ( this p, int amt ) : Point3
p this
amt int
return Point3

Shl() public static method

public static Shl ( this p, int amt ) : Vector
p this
amt int
return Vector

Shl() public static method

public static Shl ( this p, int amt ) : System.Vector3
p this
amt int
return System.Vector3

Shr() public static method

public static Shr ( this p, int amt ) : System.Point
p this
amt int
return System.Point

Shr() public static method

public static Shr ( this p, int amt ) : Point3
p this
amt int
return Point3

Shr() public static method

public static Shr ( this p, int amt ) : Vector
p this
amt int
return Vector

Shr() public static method

public static Shr ( this p, int amt ) : System.Vector3
p this
amt int
return System.Vector3

Sub() public static method

public static Sub ( this a, Vector b ) : System.Point
a this
b Vector
return System.Point

Sub() public static method

public static Sub ( this a, System.Point b ) : Vector
a this
b System.Point
return Vector

Sub() public static method

public static Sub ( this a, Vector b ) : Vector
a this
b Vector
return Vector

Sub() public static method

public static Sub ( this a, Point3 b ) : System.Vector3
a this
b Point3
return System.Vector3

Sub() public static method

public static Sub ( this a, System.Vector3 b ) : System.Vector3
a this
b System.Vector3
return System.Vector3

Vector() public static method

Returns seg.B - seg.A.
public static Vector ( this seg ) : Vector
seg this
return Vector