Tanoda
UnityEngine.UI.Extensions.BezierPath Class Reference

Public Member Functions

 BezierPath ()
 
void SetControlPoints (List< Vector2 > newControlPoints)
 
void SetControlPoints (Vector2[] newControlPoints)
 
List< Vector2 > GetControlPoints ()
 
void Interpolate (List< Vector2 > segmentPoints, float scale)
 
void SamplePoints (List< Vector2 > sourcePoints, float minSqrDistance, float maxSqrDistance, float scale)
 
Vector2 CalculateBezierPoint (int curveIndex, float t)
 
List< Vector2 > GetDrawingPoints0 ()
 
List< Vector2 > GetDrawingPoints1 ()
 
List< Vector2 > GetDrawingPoints2 ()
 

Public Attributes

int SegmentsPerCurve = 10
 
float MINIMUM_SQR_DISTANCE = 0.01f
 
float DIVISION_THRESHOLD = -0.99f
 

Detailed Description

Class for representing a Bezier path, and methods for getting suitable points to draw the curve with line segments.

Definition at line 25 of file BezierPath.cs.

Constructor & Destructor Documentation

◆ BezierPath()

UnityEngine.UI.Extensions.BezierPath.BezierPath ( )

Constructs a new empty Bezier curve. Use one of these methods to add points: SetControlPoints, Interpolate, SamplePoints.

Definition at line 41 of file BezierPath.cs.

Member Function Documentation

◆ CalculateBezierPoint()

Vector2 UnityEngine.UI.Extensions.BezierPath.CalculateBezierPoint ( int  curveIndex,
float  t 
)

Calculates a point on the path.

Parameters
curveIndexThe index of the curve that the point is on. For example, the second curve (index 1) is the curve with control points 3, 4, 5, and 6.
tThe parameter indicating where on the curve the point is. 0 corresponds to the "left" point, 1 corresponds to the "right" end point.

Definition at line 181 of file BezierPath.cs.

◆ GetControlPoints()

List< Vector2 > UnityEngine.UI.Extensions.BezierPath.GetControlPoints ( )

Returns the control points for this Bezier curve.

Definition at line 68 of file BezierPath.cs.

◆ GetDrawingPoints0()

List< Vector2 > UnityEngine.UI.Extensions.BezierPath.GetDrawingPoints0 ( )

Gets the drawing points. This implementation simply calculates a certain number of points per curve.

Definition at line 197 of file BezierPath.cs.

◆ GetDrawingPoints1()

List< Vector2 > UnityEngine.UI.Extensions.BezierPath.GetDrawingPoints1 ( )

Gets the drawing points. This implementation simply calculates a certain number of points per curve.

This is a slightly different implementation from the one above.

Definition at line 226 of file BezierPath.cs.

◆ GetDrawingPoints2()

List< Vector2 > UnityEngine.UI.Extensions.BezierPath.GetDrawingPoints2 ( )

This gets the drawing points of a bezier curve, using recursive division, which results in less points for the same accuracy as the above implementation.

Definition at line 256 of file BezierPath.cs.

◆ Interpolate()

void UnityEngine.UI.Extensions.BezierPath.Interpolate ( List< Vector2 >  segmentPoints,
float  scale 
)

Calculates a Bezier interpolated path for the given points.

Definition at line 77 of file BezierPath.cs.

◆ SamplePoints()

void UnityEngine.UI.Extensions.BezierPath.SamplePoints ( List< Vector2 >  sourcePoints,
float  minSqrDistance,
float  maxSqrDistance,
float  scale 
)

Sample the given points as a Bezier path.

Definition at line 130 of file BezierPath.cs.

◆ SetControlPoints() [1/2]

void UnityEngine.UI.Extensions.BezierPath.SetControlPoints ( List< Vector2 >  newControlPoints)

Sets the control points of this Bezier path. Points 0-3 forms the first Bezier curve, points 3-6 forms the second curve, etc.

Definition at line 51 of file BezierPath.cs.

◆ SetControlPoints() [2/2]

void UnityEngine.UI.Extensions.BezierPath.SetControlPoints ( Vector2[]  newControlPoints)

Definition at line 58 of file BezierPath.cs.

Member Data Documentation

◆ DIVISION_THRESHOLD

float UnityEngine.UI.Extensions.BezierPath.DIVISION_THRESHOLD = -0.99f

Definition at line 31 of file BezierPath.cs.

◆ MINIMUM_SQR_DISTANCE

float UnityEngine.UI.Extensions.BezierPath.MINIMUM_SQR_DISTANCE = 0.01f

Definition at line 28 of file BezierPath.cs.

◆ SegmentsPerCurve

int UnityEngine.UI.Extensions.BezierPath.SegmentsPerCurve = 10

Definition at line 27 of file BezierPath.cs.


The documentation for this class was generated from the following file: