C# Class Nez.Splines.BezierSpline

houses a series of cubic bezier points and provides helper methods to access the bezier
Afficher le fichier Open project: prime31/Nez Class Usage Examples

Méthodes publiques

Méthode Description
addCurve ( Vector2 start, Vector2 firstControlPoint, Vector2 secondControlPoint, Vector2 end ) : void

adds a curve to the bezier

getDirectionAtTime ( float t ) : Vector2

gets the direction (normalized first derivative) of the bezier at time t

getDrawingPoints ( int totalSegments ) : Microsoft.Xna.Framework.Vector2[]

breaks up the spline into totalSegments parts and returns all the points required to draw using lines

getPointAtTime ( float t ) : Vector2

gets the point on the bezier at time t

getVelocityAtTime ( float t ) : Vector2

gets the velocity (first derivative) of the bezier at time t

reset ( ) : void

resets the bezier removing all points

setControlPoint ( int index, Vector2 point ) : void

sets a control point taking into account if this is a shared point and adjusting appropriately if it is

Private Methods

Méthode Description
pointIndexAtTime ( float &t ) : int

helper that gets the bezier point index at time t. t is modified in the process to be in the range of the curve segment.

Method Details

addCurve() public méthode

adds a curve to the bezier
public addCurve ( Vector2 start, Vector2 firstControlPoint, Vector2 secondControlPoint, Vector2 end ) : void
start Microsoft.Xna.Framework.Vector2 Start.
firstControlPoint Microsoft.Xna.Framework.Vector2 First control point.
secondControlPoint Microsoft.Xna.Framework.Vector2 Second control point.
end Microsoft.Xna.Framework.Vector2
Résultat void

getDirectionAtTime() public méthode

gets the direction (normalized first derivative) of the bezier at time t
public getDirectionAtTime ( float t ) : Vector2
t float T.
Résultat Microsoft.Xna.Framework.Vector2

getDrawingPoints() public méthode

breaks up the spline into totalSegments parts and returns all the points required to draw using lines
public getDrawingPoints ( int totalSegments ) : Microsoft.Xna.Framework.Vector2[]
totalSegments int Total segments.
Résultat Microsoft.Xna.Framework.Vector2[]

getPointAtTime() public méthode

gets the point on the bezier at time t
public getPointAtTime ( float t ) : Vector2
t float T.
Résultat Microsoft.Xna.Framework.Vector2

getVelocityAtTime() public méthode

gets the velocity (first derivative) of the bezier at time t
public getVelocityAtTime ( float t ) : Vector2
t float T.
Résultat Microsoft.Xna.Framework.Vector2

reset() public méthode

resets the bezier removing all points
public reset ( ) : void
Résultat void

setControlPoint() public méthode

sets a control point taking into account if this is a shared point and adjusting appropriately if it is
public setControlPoint ( int index, Vector2 point ) : void
index int Index.
point Microsoft.Xna.Framework.Vector2 Point.
Résultat void