Enhanced C#
Language of your choice: library documentation

Documentation moved to ecsharp.net

GitHub doesn't support HTTP redirects, so you'll be redirected in 3 seconds.

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Static Public Member Functions | List of all members
Loyc.Geometry.PointExt Class Reference

Contains methods for manipulating points in generic code. More...


Source file:

Remarks

Contains methods for manipulating points in generic code.

Using PointMath extension methods is easier. These methods may be faster but they require a "math" structure (see Maths{T}).

Static Public Member Functions

static Point Add< Point, T, M > (this M m, Point a, Point b)
 Returns the sum of two vectors. More...
 
static IPoint< T > Subtract< T, M > (this M m, IPoint< T > a, IPoint< T > b)
 Returns the difference between two points or vectors. More...
 
static IPoint< T > Multiply< T, M > (this M m, IPoint< T > a, T factor)
 Returns a point or vector multiplied by a scaling factor. More...
 
static IPoint< T > Divide< T, M > (this M m, IPoint< T > a, T factor)
 Returns a point or vector divided by a scaling factor. More...
 
static IPoint< T > ShiftLeft< T, M > (this M m, IPoint< T > a, int amount)
 Returns a point or vector scaled up by a power of two. More...
 
static IPoint< T > ShiftRight< T, M > (this M m, IPoint< T > a, int amount)
 Returns a point or vector scaled down by a power of two. More...
 
static IPoint< T > MulDiv< T, M > (this M m, IPoint< T > a, T mulBy, T divBy)
 Returns a point or vector by a factor, then divides by another factor. More...
 
static T Dot< T, M > (this M m, IPoint< T > a, IPoint< T > b)
 Gets the dot product of two vectors. More...
 
static T Cross< T, M > (this M m, IPoint< T > a, IPoint< T > b)
 Gets the cross product of two vectors. More...
 
static IPoint< T > Rot90< T, M > (this M m, IPoint< T > p)
 Returns a vector rotated 90 degrees. More...
 
static IPoint< T > Negate< T, M > (this M m, IPoint< T > p)
 Returns a vector with its direction reversed. More...
 
static T Quadrance< T, M > (this M m, IPoint< T > p)
 Gets the square of the length of a vector. More...
 
static T Length< T, M > (this M m, IPoint< T > p)
 Gets the length of a vector. More...
 
static T Angle< T, M > (this M m, IPoint< T > p)
 Gets the angle from 0 to 2*PI of the vector, where (1,0) has angle 0 and (0,1) has angle PI/2. More...
 

Member Function Documentation

static Point Loyc.Geometry.PointExt.Add< Point, T, M > ( this M  m,
Point  a,
Point  b 
)
inlinestatic

Returns the sum of two vectors.

Type Constraints
Point :IPointBase<T> 
Point :INewPoint 
Point :Point 
Point :T 
M :IAdditionGroup<T> 
static T Loyc.Geometry.PointExt.Angle< T, M > ( this M  m,
IPoint< T >  p 
)
inlinestatic

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

Type Constraints
M :IFloatMath<T> 
static T Loyc.Geometry.PointExt.Cross< T, M > ( this M  m,
IPoint< T >  a,
IPoint< T >  b 
)
inlinestatic

Gets the cross product of two vectors.

Type Constraints
M :IRing<T> 
static IPoint<T> Loyc.Geometry.PointExt.Divide< T, M > ( this M  m,
IPoint< T >  a,
factor 
)
inlinestatic

Returns a point or vector divided by a scaling factor.

Type Constraints
M :IField<T> 
static T Loyc.Geometry.PointExt.Dot< T, M > ( this M  m,
IPoint< T >  a,
IPoint< T >  b 
)
inlinestatic

Gets the dot product of two vectors.

Type Constraints
M :IField<T> 
static T Loyc.Geometry.PointExt.Length< T, M > ( this M  m,
IPoint< T >  p 
)
inlinestatic

Gets the length of a vector.

Type Constraints
M :IMath<T> 
static IPoint<T> Loyc.Geometry.PointExt.MulDiv< T, M > ( this M  m,
IPoint< T >  a,
mulBy,
divBy 
)
inlinestatic

Returns a point or vector by a factor, then divides by another factor.

Type Constraints
M :IField<T> 
static IPoint<T> Loyc.Geometry.PointExt.Multiply< T, M > ( this M  m,
IPoint< T >  a,
factor 
)
inlinestatic

Returns a point or vector multiplied by a scaling factor.

Type Constraints
M :IMultiplicationGroup<T> 
static IPoint<T> Loyc.Geometry.PointExt.Negate< T, M > ( this M  m,
IPoint< T >  p 
)
inlinestatic

Returns a vector with its direction reversed.

Type Constraints
M :ISignedMath<T> 
static T Loyc.Geometry.PointExt.Quadrance< T, M > ( this M  m,
IPoint< T >  p 
)
inlinestatic

Gets the square of the length of a vector.

Type Constraints
M :IMath<T> 
static IPoint<T> Loyc.Geometry.PointExt.Rot90< T, M > ( this M  m,
IPoint< T >  p 
)
inlinestatic

Returns a vector rotated 90 degrees.

Rotatation is clockwise if increasing Y goes downward, counter- clockwise if increasing Y goes upward.

Type Constraints
M :ISignedMath<T> 
static IPoint<T> Loyc.Geometry.PointExt.ShiftLeft< T, M > ( this M  m,
IPoint< T >  a,
int  amount 
)
inlinestatic

Returns a point or vector scaled up by a power of two.

Type Constraints
M :IField<T> 
static IPoint<T> Loyc.Geometry.PointExt.ShiftRight< T, M > ( this M  m,
IPoint< T >  a,
int  amount 
)
inlinestatic

Returns a point or vector scaled down by a power of two.

Type Constraints
M :IField<T> 
static IPoint<T> Loyc.Geometry.PointExt.Subtract< T, M > ( this M  m,
IPoint< T >  a,
IPoint< T >  b 
)
inlinestatic

Returns the difference between two points or vectors.

Type Constraints
M :IAdditionGroup<T>