C# Class Ensage.Common.Extensions.SharpDX.Vector2Extensions

SharpDX/Vector2 Extensions.
显示文件 Open project: EnsageSharp/Ensage.Common

Public Methods

Method Description
AngleBetween ( this vector2, System.Vector2 toVector2 ) : float

Returns the angle between two vectors.

AngleBetween ( this vector2, System.Vector3 toVector3 ) : float

Returns the angle between two vectors.

AngleBetween ( this vector2, System.Vector4 toVector4 ) : float

Returns the angle between two vectors.

CircleCircleIntersection ( this center1, System.Vector2 center2, float radius1, float radius2 ) : System.Vector2[]

Returns the two intersection points between two circles.

Closest ( this vector2, IEnumerable array ) : System.Vector2

Seeks for the closest Vector2 to the extended Vector2.

Closest ( this vector2, IEnumerable array ) : System.Vector3

Seeks for the closest Vector3 to the extended Vector2.

Closest ( this vector2, IEnumerable array ) : System.Vector4

Seeks for the closest Vector4 to the extended Vector2.

CrossProduct ( this self, System.Vector2 other ) : float

Returns the cross product Z value.

Distance ( this vector2, System.Vector2 toVector2 ) : float

Calculates the distance between the extended Vector2 and a Vector2.

Distance ( this vector2, System.Vector3 toVector3 ) : float

Calculates the distance between the extended Vector2 and a Vector3.

Distance ( this vector2, System.Vector4 toVector4 ) : float

Calculates the distance between the extended Vector2 and a Vector4.

DistanceSquared ( this vector2, System.Vector2 toVector2 ) : float

Calculates the squared distance between two vectors.

DistanceSquared ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd, bool onlyIfOnSegment = false ) : float

Returns the squared distance to the line segment.

DistanceSquared ( this vector2, System.Vector3 toVector3 ) : float

Calculates the squared distance between two vectors.

DistanceSquared ( this vector2, System.Vector4 toVector4 ) : float

Calculates the squared distance between two vectors.

DistanceToLineSegment ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd, bool onlyIfOnSegment = false ) : float

Returns the distance to the line segment.

Extend ( this vector2, System.Vector2 toVector2, float distance ) : System.Vector2

Extends a Vector2 to another Vector2.

Extend ( this vector2, System.Vector3 toVector3, float distance ) : System.Vector2

Extends a Vector2 to a Vector3.

Extend ( this vector2, System.Vector4 toVector4, float distance ) : System.Vector2

Extends a Vector2 to a Vector4.

GetPathLength ( this path ) : float

Gets the total distance of a list of vectors.

Intersection ( this lineSegment1Start, System.Vector2 lineSegment1End, System.Vector2 lineSegment2Start, System.Vector2 lineSegment2End ) : IntersectionResult

Intersects two line segments.

IsOnScreen ( this vector2 ) : bool

Returns if the Vector2 is on the screen.

IsOrthogonal ( this vector2, System.Vector2 toVector2 ) : bool

Returns if the angle is orthogonal.

IsOrthogonal ( this vector2, System.Vector3 toVector3 ) : bool

Returns if the angle is orthogonal.

IsOrthogonal ( this vector2, System.Vector4 toVector4 ) : bool

Returns if the angle is orthogonal.

IsUnderRectangle ( this point, float x, float y, float width, float height ) : bool

Returns true if the point is under the rectangle

IsUnderTurret ( this position, bool enemyTurretsOnly ) : bool

Returns whether the given position is under a turret

IsValid ( this vector2 ) : bool

Checks for if the extended Vector2 is valid.

IsWall ( this vector2 ) : bool

Returns if the Vector2 position is a wall.

Magnitude ( this vector2 ) : float

Returns the calculated magnitude of the given Vector2.

Normalized ( this vector2 ) : System.Vector2

Normalizes a Vector2.

PathLength ( this path ) : float

Returns the total distance of a path.

Perpendicular ( this vector2, int offset ) : System.Vector2

Returns the Perpendicular Vector2 to the Extended Vector2.

Polar ( this vector2 ) : float

Returns the polar for vector angle (in Degrees).

ProjectOn ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd ) : ProjectionInfo

Returns the projection of the Vector2 on the segment.

Rotated ( this vector2, float angle ) : System.Vector2

Rotates the Vector2 to a set angle.

ToVector3 ( this path ) : List

Transforms an extended Vector2 List into a Vector3 List.

ToVector3 ( this vector2, float z = 0f ) : System.Vector3

Transforms an extended Vector2 into a Vector3.

ToVector4 ( this path ) : List

Transforms an extended Vector2 List into a Vector4 List.

ToVector4 ( this vector2, float z = 0f, float w = 1f ) : System.Vector4

Transforms an extended Vector2 into a Vector4.

VectorMovementCollision ( this pointStartA, System.Vector2 pointEndA, float pointVelocityA, System.Vector2 pointB, float pointVelocityB, float delay = 0f ) : MovementCollisionInfo

Calculates movement collision between two vectors points.

VectorMovementCollision ( this pointA, float pointVelocityA, System.Vector2 pointB, float pointVelocityB, float delay = 0f ) : MovementCollisionInfo

Calculates movement collision between two vectors points.

Method Details

AngleBetween() public static method

Returns the angle between two vectors.
public static AngleBetween ( this vector2, System.Vector2 toVector2 ) : float
vector2 this Extended SharpDX Vector2
toVector2 System.Vector2 SharpDX Vector2
return float

AngleBetween() public static method

Returns the angle between two vectors.
public static AngleBetween ( this vector2, System.Vector3 toVector3 ) : float
vector2 this Extended SharpDX Vector2
toVector3 System.Vector3 SharpDX Vector3
return float

AngleBetween() public static method

Returns the angle between two vectors.
public static AngleBetween ( this vector2, System.Vector4 toVector4 ) : float
vector2 this Extended SharpDX Vector2
toVector4 System.Vector4 SharpDX Vector4
return float

CircleCircleIntersection() public static method

Returns the two intersection points between two circles.
public static CircleCircleIntersection ( this center1, System.Vector2 center2, float radius1, float radius2 ) : System.Vector2[]
center1 this Center of Circle 1
center2 System.Vector2 Center of Circle 2
radius1 float Circle 1 Radius
radius2 float Circle 2 Radius
return System.Vector2[]

Closest() public static method

Seeks for the closest Vector2 to the extended Vector2.
public static Closest ( this vector2, IEnumerable array ) : System.Vector2
vector2 this Extended SharpDX Vector2
array IEnumerable Vector2 Collection
return System.Vector2

Closest() public static method

Seeks for the closest Vector3 to the extended Vector2.
public static Closest ( this vector2, IEnumerable array ) : System.Vector3
vector2 this Extended SharpDX Vector2
array IEnumerable Vector3 Collection
return System.Vector3

Closest() public static method

Seeks for the closest Vector4 to the extended Vector2.
public static Closest ( this vector2, IEnumerable array ) : System.Vector4
vector2 this Extended SharpDX Vector2
array IEnumerable Vector4 Collection
return System.Vector4

CrossProduct() public static method

Returns the cross product Z value.
public static CrossProduct ( this self, System.Vector2 other ) : float
self this /// The self Vector2. ///
other System.Vector2 /// The other Vector2. ///
return float

Distance() public static method

Calculates the distance between the extended Vector2 and a Vector2.
public static Distance ( this vector2, System.Vector2 toVector2 ) : float
vector2 this SharpDX Vector2 (From)
toVector2 System.Vector2 SharpDX Vector2 (To)
return float

Distance() public static method

Calculates the distance between the extended Vector2 and a Vector3.
public static Distance ( this vector2, System.Vector3 toVector3 ) : float
vector2 this SharpDX Vector2 (From)
toVector3 System.Vector3 SharpDX Vector3 (To)
return float

Distance() public static method

Calculates the distance between the extended Vector2 and a Vector4.
public static Distance ( this vector2, System.Vector4 toVector4 ) : float
vector2 this SharpDX Vector2 (From)
toVector4 System.Vector4 SharpDX Vector4 (To)
return float

DistanceSquared() public static method

Calculates the squared distance between two vectors.
public static DistanceSquared ( this vector2, System.Vector2 toVector2 ) : float
vector2 this Extended SharpDX Vector2
toVector2 System.Vector2 SharpDX Vector2
return float

DistanceSquared() public static method

Returns the squared distance to the line segment.
public static DistanceSquared ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd, bool onlyIfOnSegment = false ) : float
point this Extended SharpDX Vector2
segmentStart System.Vector2 Vector2 Segment Start
segmentEnd System.Vector2 Vector2 Segment End
onlyIfOnSegment bool Only if Segment
return float

DistanceSquared() public static method

Calculates the squared distance between two vectors.
public static DistanceSquared ( this vector2, System.Vector3 toVector3 ) : float
vector2 this Extended SharpDX Vector2
toVector3 System.Vector3 SharpDX Vector3
return float

DistanceSquared() public static method

Calculates the squared distance between two vectors.
public static DistanceSquared ( this vector2, System.Vector4 toVector4 ) : float
vector2 this Extended SharpDX Vector2
toVector4 System.Vector4 SharpDX Vector4
return float

DistanceToLineSegment() public static method

Returns the distance to the line segment.
public static DistanceToLineSegment ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd, bool onlyIfOnSegment = false ) : float
point this Extended SharpDX Vector2
segmentStart System.Vector2 Vector2 Segment Start
segmentEnd System.Vector2 Vector2 Segment End
onlyIfOnSegment bool Only if Segment
return float

Extend() public static method

Extends a Vector2 to another Vector2.
public static Extend ( this vector2, System.Vector2 toVector2, float distance ) : System.Vector2
vector2 this Extended SharpDX Vector2 (From)
toVector2 System.Vector2 SharpDX Vector2 (To)
distance float Distance (float units)
return System.Vector2

Extend() public static method

Extends a Vector2 to a Vector3.
public static Extend ( this vector2, System.Vector3 toVector3, float distance ) : System.Vector2
vector2 this Extended SharpDX Vector2 (From)
toVector3 System.Vector3 SharpDX Vector3 (To)
distance float Distance (float units)
return System.Vector2

Extend() public static method

Extends a Vector2 to a Vector4.
public static Extend ( this vector2, System.Vector4 toVector4, float distance ) : System.Vector2
vector2 this Extended SharpDX Vector2 (From)
toVector4 System.Vector4 SharpDX Vector4 (To)
distance float Distance (float units)
return System.Vector2

GetPathLength() public static method

Gets the total distance of a list of vectors.
public static GetPathLength ( this path ) : float
path this The path
return float

Intersection() public static method

Intersects two line segments.
public static Intersection ( this lineSegment1Start, System.Vector2 lineSegment1End, System.Vector2 lineSegment2Start, System.Vector2 lineSegment2End ) : IntersectionResult
lineSegment1Start this Line Segment 1 (Start)
lineSegment1End System.Vector2 Line Segment 1 (End)
lineSegment2Start System.Vector2 Line Segment 2 (Start)>
lineSegment2End System.Vector2 Line Segment 2 (End)
return IntersectionResult

IsOnScreen() public static method

Returns if the Vector2 is on the screen.
public static IsOnScreen ( this vector2 ) : bool
vector2 this Extended SharpDX Vector2
return bool

IsOrthogonal() public static method

Returns if the angle is orthogonal.
public static IsOrthogonal ( this vector2, System.Vector2 toVector2 ) : bool
vector2 this Extended SharpDX Vector2
toVector2 System.Vector2 SharpDX Vector2
return bool

IsOrthogonal() public static method

Returns if the angle is orthogonal.
public static IsOrthogonal ( this vector2, System.Vector3 toVector3 ) : bool
vector2 this Extended SharpDX Vector2
toVector3 System.Vector3 SharpDX Vector3
return bool

IsOrthogonal() public static method

Returns if the angle is orthogonal.
public static IsOrthogonal ( this vector2, System.Vector4 toVector4 ) : bool
vector2 this Extended SharpDX Vector2
toVector4 System.Vector4 SharpDX Vector2
return bool

IsUnderRectangle() public static method

Returns true if the point is under the rectangle
public static IsUnderRectangle ( this point, float x, float y, float width, float height ) : bool
point this /// Extended SharpDX Vector2 ///
x float /// Rectangle X-axis ///
y float /// Rectangle Y-axis ///
width float /// Rectangle width ///
height float /// Rectangle height ///
return bool

IsUnderTurret() public static method

Returns whether the given position is under a turret
public static IsUnderTurret ( this position, bool enemyTurretsOnly ) : bool
position this Extended SharpDX Vector2
enemyTurretsOnly bool Include Enemy Turret Only
return bool

IsValid() public static method

Checks for if the extended Vector2 is valid.
public static IsValid ( this vector2 ) : bool
vector2 this SharpDX Vector2
return bool

IsWall() public static method

Returns if the Vector2 position is a wall.
public static IsWall ( this vector2 ) : bool
vector2 this Extended SharpDX Vector2
return bool

Magnitude() public static method

Returns the calculated magnitude of the given Vector2.
public static Magnitude ( this vector2 ) : float
vector2 this Extended SharpDX Vector2
return float

Normalized() public static method

Normalizes a Vector2.
public static Normalized ( this vector2 ) : System.Vector2
vector2 this SharpDX Vector2
return System.Vector2

PathLength() public static method

Returns the total distance of a path.
public static PathLength ( this path ) : float
path this /// The path. ///
return float

Perpendicular() public static method

Returns the Perpendicular Vector2 to the Extended Vector2.
public static Perpendicular ( this vector2, int offset ) : System.Vector2
vector2 this Extended SharpDX Vector2
offset int Axis Offset (0 = X, 1 = Y)
return System.Vector2

Polar() public static method

Returns the polar for vector angle (in Degrees).
public static Polar ( this vector2 ) : float
vector2 this Extended SharpDX Vector2
return float

ProjectOn() public static method

Returns the projection of the Vector2 on the segment.
public static ProjectOn ( this point, System.Vector2 segmentStart, System.Vector2 segmentEnd ) : ProjectionInfo
point this The Point
segmentStart System.Vector2 Start of Segment
segmentEnd System.Vector2 End of Segment
return ProjectionInfo

Rotated() public static method

Rotates the Vector2 to a set angle.
public static Rotated ( this vector2, float angle ) : System.Vector2
vector2 this Extended SharpDX Vector2
angle float Angle (in radians)
return System.Vector2

ToVector3() public static method

Transforms an extended Vector2 List into a Vector3 List.
public static ToVector3 ( this path ) : List
path this /// The path. ///
return List

ToVector3() public static method

Transforms an extended Vector2 into a Vector3.
public static ToVector3 ( this vector2, float z = 0f ) : System.Vector3
vector2 this SharpDX Vector2
z float Float Z-axis (default = 0f)
return System.Vector3

ToVector4() public static method

Transforms an extended Vector2 List into a Vector4 List.
public static ToVector4 ( this path ) : List
path this /// The path. ///
return List

ToVector4() public static method

Transforms an extended Vector2 into a Vector4.
public static ToVector4 ( this vector2, float z = 0f, float w = 1f ) : System.Vector4
vector2 this SharpDX Vector2
z float Float Z-axis (default = 0f)
w float Float W-axis (default = 0f)
return System.Vector4

VectorMovementCollision() public static method

Calculates movement collision between two vectors points.
public static VectorMovementCollision ( this pointStartA, System.Vector2 pointEndA, float pointVelocityA, System.Vector2 pointB, float pointVelocityB, float delay = 0f ) : MovementCollisionInfo
pointStartA this /// Point A Start. ///
pointEndA System.Vector2 /// Point A End. ///
pointVelocityA float /// Point A Velocity. ///
pointB System.Vector2 /// Point B. ///
pointVelocityB float /// Point B Velocity. ///
delay float /// Additional Delay. ///
return MovementCollisionInfo

VectorMovementCollision() public static method

Calculates movement collision between two vectors points.
public static VectorMovementCollision ( this pointA, float pointVelocityA, System.Vector2 pointB, float pointVelocityB, float delay = 0f ) : MovementCollisionInfo
pointA this /// Point A. ///
pointVelocityA float /// Point A Velocity. ///
pointB System.Vector2 /// Point B. ///
pointVelocityB float /// Point B Velocity. ///
delay float /// Additional Delay. ///
return MovementCollisionInfo