C# Класс Nez.Splines.BezierSpline

houses a series of cubic bezier points and provides helper methods to access the bezier
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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

Приватные методы

Метод Описание
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.

Описание методов

addCurve() публичный Метод

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
Результат void

getDirectionAtTime() публичный Метод

gets the direction (normalized first derivative) of the bezier at time t
public getDirectionAtTime ( float t ) : Vector2
t float T.
Результат Microsoft.Xna.Framework.Vector2

getDrawingPoints() публичный Метод

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.
Результат Microsoft.Xna.Framework.Vector2[]

getPointAtTime() публичный Метод

gets the point on the bezier at time t
public getPointAtTime ( float t ) : Vector2
t float T.
Результат Microsoft.Xna.Framework.Vector2

getVelocityAtTime() публичный Метод

gets the velocity (first derivative) of the bezier at time t
public getVelocityAtTime ( float t ) : Vector2
t float T.
Результат Microsoft.Xna.Framework.Vector2

reset() публичный Метод

resets the bezier removing all points
public reset ( ) : void
Результат void

setControlPoint() публичный Метод

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.
Результат void