C# 클래스 RedBlueGames.Tools.Vector2Extensions

Extension methods to Vector2 class
파일 보기 프로젝트 열기: redbluegames/rb-unity-tools

공개 메소드들

메소드 설명
BiasToCardinals ( this vectorToBias, float biasAngle ) : Vector2

If the supplied vector is within the supplied angle of a cardinal direction, this will return the cardinal direction. Otherwise it will just return the same angle.

GetDegreesBetweenVectorsCCW ( Vector2 fromVector, Vector2 toVector ) : float

Returns the angle in degrees from one Vector2 to another. Degrees are signed, with CCW being positive.

IsDirectionWithinArc ( this vector, Vector2 arcBisector, float arcAngle ) : bool

Determines if the direction vector is within the arc specified by a direction bisecting an angle.

IsNormalized ( this vector ) : bool

Determines if the vector is normalized (magnitude of 1)

RotateClockwiseByRadians ( this vector, float angle ) : Vector2

Rotates the vector clockwise by an angle in radius

RoundToCardinals ( this vectorToRound ) : Vector2

Rounds the input vector to the closest cardinal direction and returns the rounded result.

RoundToNearestArc ( this vector, int numArcs, float rotationDegrees = 0.0f ) : Vector2

Rounds to nearest arc (with 4 arcs, all vectors that point from -45 to 45 return (1.0, 0.0))

비공개 메소드들

메소드 설명
GetBisectorForArc ( this vector, int arc, int numArcs, float rotationDegrees = 0.0f ) : Vector2
GetNearestArc ( this vector, int numArcs, float rotationDegrees = 0.0f ) : int

메소드 상세

BiasToCardinals() 공개 정적인 메소드

If the supplied vector is within the supplied angle of a cardinal direction, this will return the cardinal direction. Otherwise it will just return the same angle.
public static BiasToCardinals ( this vectorToBias, float biasAngle ) : Vector2
vectorToBias this Vector to bias.
biasAngle float Bias angle.
리턴 UnityEngine.Vector2

GetDegreesBetweenVectorsCCW() 공개 정적인 메소드

Returns the angle in degrees from one Vector2 to another. Degrees are signed, with CCW being positive.
public static GetDegreesBetweenVectorsCCW ( Vector2 fromVector, Vector2 toVector ) : float
fromVector UnityEngine.Vector2 The from vector
toVector UnityEngine.Vector2 The to vector
리턴 float

IsDirectionWithinArc() 공개 정적인 메소드

Determines if the direction vector is within the arc specified by a direction bisecting an angle.
public static IsDirectionWithinArc ( this vector, Vector2 arcBisector, float arcAngle ) : bool
vector this Source Direction Vector
arcBisector UnityEngine.Vector2 Arc bisector
arcAngle float Arc angle
리턴 bool

IsNormalized() 공개 정적인 메소드

Determines if the vector is normalized (magnitude of 1)
public static IsNormalized ( this vector ) : bool
vector this Vector to test.
리턴 bool

RotateClockwiseByRadians() 공개 정적인 메소드

Rotates the vector clockwise by an angle in radius
public static RotateClockwiseByRadians ( this vector, float angle ) : Vector2
vector this Vector to rotate.
angle float Angle in radians
리턴 UnityEngine.Vector2

RoundToCardinals() 공개 정적인 메소드

Rounds the input vector to the closest cardinal direction and returns the rounded result.
public static RoundToCardinals ( this vectorToRound ) : Vector2
vectorToRound this Vector to round.
리턴 UnityEngine.Vector2

RoundToNearestArc() 공개 정적인 메소드

Rounds to nearest arc (with 4 arcs, all vectors that point from -45 to 45 return (1.0, 0.0))
public static RoundToNearestArc ( this vector, int numArcs, float rotationDegrees = 0.0f ) : Vector2
vector this The vector to convert.
numArcs int The number of arcs to divide the circle into.
rotationDegrees float Optional rotation of arcs
리턴 UnityEngine.Vector2