Class VectorUtils
Provides various tools to work with vector graphics.
Namespace: Unity.VectorGraphics
Syntax
public static class VectorUtilsFields
Epsilon
A small value used everywhere by the vector graphics package.
Declaration
public static readonly float EpsilonField Value
| Type | Description | 
|---|---|
| Single | 
Methods
ApproximateSceneNodeBounds(SceneNode)
Computes a rough approximation of the node hierarchy bounds.
Declaration
public static Rect ApproximateSceneNodeBounds(SceneNode root)Parameters
| Type | Name | Description | 
|---|---|---|
| SceneNode | root | The root node of the hierarchy to computes the bounds from | 
Returns
| Type | Description | 
|---|---|
| Rect | An approximation of the root hierarchy axis-aligned bounding-box | 
Remarks
This will use the control point positions as a rough estimate of the bounds for the paths and shapes.
BezierSegmentsToPath(BezierSegment[])
Converts an array of BezierSegments into a connected path.
Declaration
public static BezierPathSegment[] BezierSegmentsToPath(BezierSegment[] segments)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment[] | segments | An array of BezierSegment | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | An array of path segments | 
Remarks
If two consecutive segments are disconnected, a straight line will be added between the two endpoints.
BezierSegmentToPath(BezierSegment)
Convert a segments into a path.
Declaration
public static BezierPathSegment[] BezierSegmentToPath(BezierSegment segment)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The BezierSegment | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | An array of two path segments | 
Remarks
The second path segment will hold the ending position of the curve.
Bounds(IEnumerable<Vector2>)
Computes the bounds of a list of vertices.
Declaration
public static Rect Bounds(IEnumerable<Vector2> vertices)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<Vector2> | vertices | The list of vertices to compute the bounds from | 
Returns
| Type | Description | 
|---|---|
| Rect | A Rect containing the axis-aligned bounding-box of the vertices | 
Bounds(BezierPathSegment[])
Computes the bounds of a bezier path.
Declaration
public static Rect Bounds(BezierPathSegment[] path)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierPathSegment[] | path | The path to compute the bounds from | 
Returns
| Type | Description | 
|---|---|
| Rect | A Rect containing the axis-aligned bounding-box of the contour | 
Bounds(BezierSegment, out Vector2, out Vector2)
Computes the bounds of a segment.
Declaration
public static void Bounds(BezierSegment segment, out Vector2 min, out Vector2 max)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The segment to flip | 
| Vector2 | min | The output min value of the segment | 
| Vector2 | max | The output max value of the segment | 
BuildRectangleContour(Rect, Vector2, Vector2, Vector2, Vector2)
Builds a BezierContour from a Rectangle.
Declaration
public static BezierContour BuildRectangleContour(Rect rect, Vector2 radiusTL, Vector2 radiusTR, Vector2 radiusBR, Vector2 radiusBL)Parameters
| Type | Name | Description | 
|---|---|---|
| Rect | rect | The rectangle to build the contour from | 
| Vector2 | radiusTL | The top-left radius of the rectangle | 
| Vector2 | radiusTR | The top-right radius of the rectangle | 
| Vector2 | radiusBR | The bottom-right radius of the rectangle | 
| Vector2 | radiusBL | The bottom-left radius of the rectangle | 
Returns
| Type | Description | 
|---|---|
| BezierContour | A BezierContour that follows the rectangle contour | 
BuildRectangleContour(Rectangle)
Builds a BezierContour from a Rectangle.
Declaration
[Obsolete("Use BuildRectangleContour(Rect,Vector2,Vector2,Vector2,Vector2) instead")]
public static BezierContour BuildRectangleContour(Rectangle rect)Parameters
| Type | Name | Description | 
|---|---|---|
| Rectangle | rect | The rectangle to build the contour from | 
Returns
| Type | Description | 
|---|---|
| BezierContour | A BezierContour that follows the rectangle contour | 
BuildSprite(List<VectorUtils.Geometry>, Rect, Single, VectorUtils.Alignment, Vector2, UInt16, Boolean)
Builds a sprite asset from a scene tessellation.
Declaration
public static Sprite BuildSprite(List<VectorUtils.Geometry> geoms, Rect rect, float svgPixelsPerUnit, VectorUtils.Alignment alignment, Vector2 customPivot, ushort gradientResolution, bool flipYAxis = false)Parameters
| Type | Name | Description | 
|---|---|---|
| List<VectorUtils.Geometry> | geoms | The list of tessellated Geometry instances | 
| Rect | rect | The position and size of the sprite geometry | 
| Single | svgPixelsPerUnit | How many SVG "pixels" map into a Unity unit | 
| VectorUtils.Alignment | alignment | The position of the sprite origin | 
| Vector2 | customPivot | If alignment is Custom, customPivot is used to compute the sprite origin | 
| UInt16 | gradientResolution | The maximum size of the texture holding gradient data | 
| Boolean | flipYAxis | True to have the positive Y axis to go downward. | 
Returns
| Type | Description | 
|---|---|
| Sprite | A new Sprite containing the provided geometry. The Sprite may have a texture if the geometry has any texture and/or gradients | 
BuildSprite(List<VectorUtils.Geometry>, Single, VectorUtils.Alignment, Vector2, UInt16, Boolean)
Builds a sprite asset from a scene tessellation.
Declaration
public static Sprite BuildSprite(List<VectorUtils.Geometry> geoms, float svgPixelsPerUnit, VectorUtils.Alignment alignment, Vector2 customPivot, ushort gradientResolution, bool flipYAxis = false)Parameters
| Type | Name | Description | 
|---|---|---|
| List<VectorUtils.Geometry> | geoms | The list of tessellated Geometry instances | 
| Single | svgPixelsPerUnit | How many SVG "pixels" map into a Unity unit | 
| VectorUtils.Alignment | alignment | The position of the sprite origin | 
| Vector2 | customPivot | If alignment is Custom, customPivot is used to compute the sprite origin | 
| UInt16 | gradientResolution | The maximum size of the texture holding gradient data | 
| Boolean | flipYAxis | True to have the positive Y axis to go downward. | 
Returns
| Type | Description | 
|---|---|
| Sprite | A new Sprite containing the provided geometry. The Sprite may have a texture if the geometry has any texture and/or gradients | 
Eval(BezierSegment, Single)
Evaluates the position on a curve segment.
Declaration
public static Vector2 Eval(BezierSegment segment, float t)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the position | 
| Single | t | The parametric location on the curve | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The position on the curve at parametric location "t" | 
EvalFull(BezierSegment, Single, out Vector2)
Evalutes both the position and tangent on a curve segment.
Declaration
public static Vector2 EvalFull(BezierSegment segment, float t, out Vector2 tangent)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the normal | 
| Single | t | The parametric location on the curve | 
| Vector2 | tangent | The output tangent at parametric location "t" | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The position on the curve at parametric location "t" | 
Remarks
This is more efficient than calling "Eval" and "EvalTangent" successively.
EvalFull(BezierSegment, Single, out Vector2, out Vector2)
Evalutes the position, tangent and normal on a curve segment.
Declaration
public static Vector2 EvalFull(BezierSegment segment, float t, out Vector2 tangent, out Vector2 normal)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the normal | 
| Single | t | The parametric location on the curve | 
| Vector2 | tangent | The output tangent at parametric location "t" | 
| Vector2 | normal | The output normal at parametric location "t" | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The position on the curve at parametric location "t" | 
Remarks
This is more efficient than calling "Eval", "EvalTangent" and "EvalNormal" successively.
EvalNormal(BezierSegment, Single)
Evalutes the normal on a curve segment.
Declaration
public static Vector2 EvalNormal(BezierSegment segment, float t)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the normal | 
| Single | t | The parametric location on the curve | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The normal of the curve at parametric location "t" | 
Remarks
A positive normal at a point on the bezier curve is always on the right side of the forward direction (tangent) of the curve at that point.
EvalTangent(BezierSegment, Single)
Evaluates the tangent on a curve segment.
Declaration
public static Vector2 EvalTangent(BezierSegment segment, float t)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the tangent | 
| Single | t | The parametric location on the curve | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The tangent of the curve at parametric location "t" | 
FillMesh(Mesh, List<VectorUtils.Geometry>, Single, Boolean)
Fills a mesh geometry from a scene tessellation.
Declaration
public static void FillMesh(Mesh mesh, List<VectorUtils.Geometry> geoms, float svgPixelsPerUnit, bool flipYAxis = false)Parameters
| Type | Name | Description | 
|---|---|---|
| Mesh | mesh | The mesh object to fill | 
| List<VectorUtils.Geometry> | geoms | The list of tessellated Geometry instances, generated by TessellateNodeHierarchy | 
| Single | svgPixelsPerUnit | How many SVG "pixels" map into a Unity unit | 
| Boolean | flipYAxis | Set to "true" to have the positive Y axis to go downward. | 
FillUVs(IEnumerable<VectorUtils.Geometry>, VectorUtils.TextureAtlas)
Fill the UVs of the geometry using the provided texture atlas.
Declaration
public static void FillUVs(IEnumerable<VectorUtils.Geometry> geoms, VectorUtils.TextureAtlas texAtlas)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<VectorUtils.Geometry> | geoms | The geometry that will have its UVs filled | 
| VectorUtils.TextureAtlas | texAtlas | The texture atlas used for the UV generation | 
FindBezierLineIntersections(BezierSegment, Vector2, Vector2)
Find the intersections (up to three) between a line and a curve segment.
Declaration
public static float[] FindBezierLineIntersections(BezierSegment segment, Vector2 p0, Vector2 p1)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment | 
| Vector2 | p0 | The first point | 
| Vector2 | p1 | The second point | 
Returns
| Type | Description | 
|---|---|
| Single[] | Returns the Bezier's 't' parametric values where the line p0-p1 intersects the segment, up to 3 values | 
FlipSegment(BezierSegment)
Flips a segment direction.
Declaration
public static BezierSegment FlipSegment(BezierSegment segment)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The segment to flip | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | The flipped segment | 
FlipVerticesInBounds(IList<Vector2>, Rect)
Flip the vertices (in-place) inside their axis-aligned bounding-box.
Declaration
public static void FlipVerticesInBounds(IList<Vector2> vertices, Rect bounds)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Vector2> | vertices | The vertices to realign | 
| Rect | bounds | The bounds into which the vertices will be realigned | 
GenerateAtlas(IEnumerable<VectorUtils.Geometry>, UInt32)
Generates a Texture2D atlas containing the textures and gradients for the vector geometry.
Declaration
public static VectorUtils.TextureAtlas GenerateAtlas(IEnumerable<VectorUtils.Geometry> geoms, uint rasterSize)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<VectorUtils.Geometry> | geoms | The list of Geometry objects, probably created with TessellateNodeHierarchy | 
| UInt32 | rasterSize | Maximum size of the generated texture | 
Returns
| Type | Description | 
|---|---|
| VectorUtils.TextureAtlas | The generated texture atlas | 
GenerateAtlasAndFillUVs(IEnumerable<VectorUtils.Geometry>, UInt32)
Generates a Texture2D atlas containing the textures and gradients for the vector geometry, and fill the UVs of the geometry.
Declaration
public static VectorUtils.TextureAtlas GenerateAtlasAndFillUVs(IEnumerable<VectorUtils.Geometry> geoms, uint rasterSize)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<VectorUtils.Geometry> | geoms | The list of Geometry objects, probably created with TessellateNodeHierarchy | 
| UInt32 | rasterSize | Maximum size of the generated texture | 
Returns
| Type | Description | 
|---|---|
| VectorUtils.TextureAtlas | The generated texture atlas | 
IntersectLines(Vector2, Vector2, Vector2, Vector2)
Finds the intersection between two infinite lines
Declaration
public static Vector2 IntersectLines(Vector2 line1Pt1, Vector2 line1Pt2, Vector2 line2Pt1, Vector2 line2Pt2)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | line1Pt1 | The first point of the first line | 
| Vector2 | line1Pt2 | The second point of the first line | 
| Vector2 | line2Pt1 | The first point of the second line | 
| Vector2 | line2Pt2 | The second point of the second line | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The intersection point, or (float.PositiveInfinity, float.PositiveInfinity) if the lines are parallel | 
IntersectLineSegments(Vector2, Vector2, Vector2, Vector2)
Finds the intersection between two line segments
Declaration
public static Vector2 IntersectLineSegments(Vector2 line1Pt1, Vector2 line1Pt2, Vector2 line2Pt1, Vector2 line2Pt2)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | line1Pt1 | The first point of the first line | 
| Vector2 | line1Pt2 | The second point of the first line | 
| Vector2 | line2Pt1 | The first point of the second line | 
| Vector2 | line2Pt2 | The second point of the second line | 
Returns
| Type | Description | 
|---|---|
| Vector2 | The intersection point, or (float.PositiveInfinity, float.PositiveInfinity) if the lines are parallel | 
MakeArc(Vector2, Single, Single, Single)
Approximates a circle arc with up to 4 segments.
Declaration
public static BezierPathSegment[] MakeArc(Vector2 center, float startAngleRads, float sweepAngleRads, float radius)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | center | The center of the arc | 
| Single | startAngleRads | The starting angle of the arc, in radians | 
| Single | sweepAngleRads | The "length" of the arc, in radians | 
| Single | radius | The radius of the arc | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | An array of up to four BezierSegments holding the arc | 
MakeCircle(Vector2, Single)
Builds a rounded rectangle in a circle shape.
Declaration
[Obsolete("Use MakeCircleShape instead")]
public static Rectangle MakeCircle(Vector2 pos, float radius)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | pos | The position of the circle, relative to its center. | 
| Single | radius | The radius of the circle. | 
Returns
| Type | Description | 
|---|---|
| Rectangle | A rectangle object with rounded corners to form a circle | 
MakeCircleShape(Shape, Vector2, Single)
Builds a circle shape.
Declaration
public static void MakeCircleShape(Shape circleShape, Vector2 pos, float radius)Parameters
| Type | Name | Description | 
|---|---|---|
| Shape | circleShape | The shape object that will be filled with a circle. | 
| Vector2 | pos | The position of the circle, relative to its center. | 
| Single | radius | The radius of the circle. | 
MakeEllipse(Vector2, Single, Single)
Builds a rounded rectangle in an ellipse shape.
Declaration
[Obsolete("Use MakeEllipseShape instead")]
public static Rectangle MakeEllipse(Vector2 pos, float radiusX, float radiusY)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | pos | The position of the ellipse, relative to its center. | 
| Single | radiusX | The X axis of the ellipse. | 
| Single | radiusY | The Y axis of the ellipse. | 
Returns
| Type | Description | 
|---|---|
| Rectangle | A rectangle object with rounded corners to form an ellipse | 
MakeEllipseShape(Shape, Vector2, Single, Single)
Builds an ellipse shape.
Declaration
public static void MakeEllipseShape(Shape ellipseShape, Vector2 pos, float radiusX, float radiusY)Parameters
| Type | Name | Description | 
|---|---|---|
| Shape | ellipseShape | The shape object that will be filled with an ellipse. | 
| Vector2 | pos | The position of the circle, relative to its center. | 
| Single | radiusX | The x component of the radius of the circle. | 
| Single | radiusY | The y component of the radius of the circle. | 
MakeLine(Vector2, Vector2)
Builds a line segment.
Declaration
public static BezierSegment MakeLine(Vector2 from, Vector2 to)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | from | The starting position of the line segment | 
| Vector2 | to | The ending position of the line segment | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | A straight line BezierSegment | 
Remarks
The control points are spaced out equally to maintain a constant speed on t
MakePathLine(Vector2, Vector2)
Builds a line path segment.
Declaration
public static BezierPathSegment[] MakePathLine(Vector2 from, Vector2 to)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | from | The starting position of the line segment | 
| Vector2 | to | The ending position of the line segment | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | A BezierPathSegment array of two elements, configured in a straight line | 
Remarks
The control points are spaced out equally to maintain a constant speed on t
MakeRectangleShape(Shape, Rect)
Builds a rectangle shape.
Declaration
public static void MakeRectangleShape(Shape rectShape, Rect rect)Parameters
| Type | Name | Description | 
|---|---|---|
| Shape | rectShape | The shape object that will be filled with a rectangle. | 
| Rect | rect | The position and dimensions of the rectangle. | 
MakeRectangleShape(Shape, Rect, Vector2, Vector2, Vector2, Vector2)
Builds a rectangle shape.
Declaration
public static void MakeRectangleShape(Shape rectShape, Rect rect, Vector2 radiusTL, Vector2 radiusTR, Vector2 radiusBR, Vector2 radiusBL)Parameters
| Type | Name | Description | 
|---|---|---|
| Shape | rectShape | The shape object that will be filled with a rectangle. | 
| Rect | rect | The position and dimensions of the rectangle. | 
| Vector2 | radiusTL | The top-left radius of the rectangle | 
| Vector2 | radiusTR | The top-right radius of the rectangle | 
| Vector2 | radiusBR | The bottom-right radius of the rectangle | 
| Vector2 | radiusBL | The bottom-left radius of the rectangle | 
PathEndsPerfectlyMatch(IList<BezierPathSegment>)
Checks if the two ends of a BezierPathSegment chain are at the same location.
Declaration
public static bool PathEndsPerfectlyMatch(IList<BezierPathSegment> path)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<BezierPathSegment> | path | The chain of BezierPathSegments | 
Returns
| Type | Description | 
|---|---|
| Boolean | True if the two ends of the chain are at the same location, false otherwise | 
PathSegmentAtIndex(IList<BezierPathSegment>, Int32)
Computes the BezierSegment at a given index from a list of BezierPathSegments.
Declaration
public static BezierSegment PathSegmentAtIndex(IList<BezierPathSegment> path, int index)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<BezierPathSegment> | path | The chain of BezierPathSegments | 
| Int32 | index | The segment index | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | The BezierSegment at the given index | 
QuadraticToCubic(Vector2, Vector2, Vector2)
Converts a quadratic bezier to a cubic bezier
Declaration
public static BezierSegment QuadraticToCubic(Vector2 p0, Vector2 p1, Vector2 p2)Parameters
| Type | Name | Description | 
|---|---|---|
| Vector2 | p0 | The starting position of the quadratic segment | 
| Vector2 | p1 | The control position of the quadratic segment | 
| Vector2 | p2 | The ending position of the quadratic segment | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | The resulting BezierSegment | 
RealignVerticesInBounds(IList<Vector2>, Rect, Boolean)
Realigns the vertices (in-place) inside their axis-aligned bounding-box.
Declaration
public static void RealignVerticesInBounds(IList<Vector2> vertices, Rect bounds, bool flip)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Vector2> | vertices | The vertices to realign | 
| Rect | bounds | The bounds into which the vertices will be realigned | 
| Boolean | flip | A boolean indicating whether to flip the coordinates on the Y axis | 
RealignVerticesInBounds(IList<Vector2>, Boolean)
Realigns the vertices inside their axis-aligned bounding-box.
Declaration
[Obsolete("Please use RealignVerticesInBounds(IList<Vector2>, Rect, bool) instead")]
public static Rect RealignVerticesInBounds(IList<Vector2> vertices, bool flip)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<Vector2> | vertices | The vertices to realign | 
| Boolean | flip | A boolean indicating whether to flip the coordinates on the Y axis | 
Returns
| Type | Description | 
|---|---|
| Rect | The axis-aligned bounding-box of the original vertices | 
RenderSprite(Sprite, Material, Boolean)
Draws a vector sprite using the provided material.
Declaration
public static void RenderSprite(Sprite sprite, Material mat, bool clear = true)Parameters
| Type | Name | Description | 
|---|---|---|
| Sprite | sprite | The sprite to render | 
| Material | mat | The material used for rendering | 
| Boolean | clear | If true, clear the render target before rendering | 
RenderSpriteToTexture2D(Sprite, Int32, Int32, Material, Int32, Boolean)
Renders a vector sprite to Texture2D.
Declaration
public static Texture2D RenderSpriteToTexture2D(Sprite sprite, int width, int height, Material mat, int antiAliasing = 1, bool expandEdges = false)Parameters
| Type | Name | Description | 
|---|---|---|
| Sprite | sprite | The sprite to render | 
| Int32 | width | The desired width of the resulting texture | 
| Int32 | height | The desired height of the resulting texture | 
| Material | mat | The material used to render the sprite | 
| Int32 | antiAliasing | The number of samples per pixel for anti-aliasing | 
| Boolean | expandEdges | When true, expand the edges to avoid a dark banding effect caused by filtering. This is slower to render and uses more graphics memory. | 
Returns
| Type | Description | 
|---|---|
| Texture2D | A Texture2D object containing the rendered vector sprite | 
SceneNodeBounds(SceneNode)
Computes a pretty accurate approximation of the scene bounds.
Declaration
public static Rect SceneNodeBounds(SceneNode root)Parameters
| Type | Name | Description | 
|---|---|---|
| SceneNode | root | The root node of the hierarchy to computes the bounds from | 
Returns
| Type | Description | 
|---|---|
| Rect | An approximation of the node hierarchy axis-aligned bounding-box | 
Remarks
This will properly evaluate the bounds of the paths and shapes, but will ignore the paths stroke widths.
SceneNodes(SceneNode)
Lists every nodes under a root node.
Declaration
public static IEnumerable<SceneNode> SceneNodes(SceneNode root)Parameters
| Type | Name | Description | 
|---|---|---|
| SceneNode | root | The root node | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<SceneNode> | The enumerable listing every nodes under "root", including the root itself. | 
SegmentLength(BezierSegment, Single)
Computes the length of a single curve segment.
Declaration
public static float SegmentLength(BezierSegment segment, float precision = 0.001F)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment on which to evaluate the length | 
| Single | precision | The precision of the length computation | 
Returns
| Type | Description | 
|---|---|
| Single | The length of the segment | 
SegmentsInPath(IEnumerable<BezierPathSegment>, Boolean)
Iterates through every segment in a list of path segments.
Declaration
public static IEnumerable<BezierSegment> SegmentsInPath(IEnumerable<BezierPathSegment> segments, bool closed = false)Parameters
| Type | Name | Description | 
|---|---|---|
| IEnumerable<BezierPathSegment> | segments | The path segments to iterate from | 
| Boolean | closed | Whether to return the segment connecting the last point to the beginning of the path | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<BezierSegment> | An enumerable of every segments in the path | 
SegmentsLength(IList<BezierPathSegment>, Boolean, Single)
Computes the combined length of a segment chain.
Declaration
public static float SegmentsLength(IList<BezierPathSegment> segments, bool closed, float precision = 0.001F)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<BezierPathSegment> | segments | The curve segments on which to evaluate the length | 
| Boolean | closed | A boolean indicating if the length of the segment joining the first and last points should be computed | 
| Single | precision | The precision of the length computation | 
Returns
| Type | Description | 
|---|---|
| Single | The combined length of the segment chain | 
SegmentsLengths(IList<BezierPathSegment>, Boolean, Single)
Computes the individual lengths of a segment chain.
Declaration
public static float[] SegmentsLengths(IList<BezierPathSegment> segments, bool closed, float precision = 0.001F)Parameters
| Type | Name | Description | 
|---|---|---|
| IList<BezierPathSegment> | segments | The segments on which to compute the lengths | 
| Boolean | closed | A boolean indicating if the length of the segment joining the first and last points should be computed | 
| Single | precision | The precision of the lengths computation | 
Returns
| Type | Description | 
|---|---|
| Single[] | An array containing the lenghts of the segments | 
SplitSegment(BezierSegment, Single, out BezierSegment, out BezierSegment)
Splits a curve segment at a given parametric location.
Declaration
public static void SplitSegment(BezierSegment segment, float t, out BezierSegment b1, out BezierSegment b2)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment to split | 
| Single | t | The parametric location at which the segment will be split | 
| BezierSegment | b1 | The output of the first segment | 
| BezierSegment | b2 | The output of the second segment | 
TessellatePath(BezierContour, PathProperties, VectorUtils.TessellationOptions, out Vector2[], out UInt16[])
Tessellates a path.
Declaration
public static void TessellatePath(BezierContour contour, PathProperties pathProps, VectorUtils.TessellationOptions tessellateOptions, out Vector2[] vertices, out ushort[] indices)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierContour | contour | The path to tessellate | 
| PathProperties | pathProps | The path properties | 
| VectorUtils.TessellationOptions | tessellateOptions | The tessellation options | 
| Vector2[] | vertices | The resulting vertices | 
| UInt16[] | indices | The resulting triangles | 
Remarks
The individual line segments generated during tessellation are made out of a set of ordered vertices. It is important to honor this ordering so joining and and capping connect properly with the existing vertices without generating dupes. The ordering assumed is as follows: The last two vertices of a piece must be such that the first is generated at the end with a positive half-thickness while the second vertex is at the end too but at a negative half-thickness. No assumptions are enforced for other vertices before the two last vertices.
TessellateRect(Rect, out Vector2[], out UInt16[])
Tessellates a rectangle.
Declaration
public static void TessellateRect(Rect rect, out Vector2[] vertices, out ushort[] indices)Parameters
| Type | Name | Description | 
|---|---|---|
| Rect | rect | Rectangle to tessellate | 
| Vector2[] | vertices | The output vertices | 
| UInt16[] | indices | The output triangles | 
TessellateRectBorder(Rect, Single, out Vector2[], out UInt16[])
Tessellates a rectangle border.
Declaration
public static void TessellateRectBorder(Rect rect, float halfThickness, out Vector2[] vertices, out ushort[] indices)Parameters
| Type | Name | Description | 
|---|---|---|
| Rect | rect | Rectangle to tessellate | 
| Single | halfThickness | The half-thickness of the border | 
| Vector2[] | vertices | The output vertices | 
| UInt16[] | indices | The output triangles | 
TessellateScene(Scene, VectorUtils.TessellationOptions, Dictionary<SceneNode, Single>)
Tessellates a Scene object into triangles.
Declaration
public static List<VectorUtils.Geometry> TessellateScene(Scene scene, VectorUtils.TessellationOptions tessellationOptions, Dictionary<SceneNode, float> nodeOpacities = null)Parameters
| Type | Name | Description | 
|---|---|---|
| Scene | scene | |
| VectorUtils.TessellationOptions | tessellationOptions | The tessellation options | 
| Dictionary<SceneNode, Single> | nodeOpacities | If provided, the resulting node opacities | 
Returns
| Type | Description | 
|---|---|
| List<VectorUtils.Geometry> | A list of tesselated geometry | 
TransformBezierPath(BezierPathSegment[], Matrix2D)
Transforms a path by a transformation matrix.
Declaration
public static BezierPathSegment[] TransformBezierPath(BezierPathSegment[] path, Matrix2D matrix)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierPathSegment[] | path | The path to transform | 
| Matrix2D | matrix | The transformation matrix to apply on the curve segment | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | The transformed path | 
TransformBezierPath(BezierPathSegment[], Vector2, Single, Vector2)
Transforms a path by a transformation matrix.
Declaration
public static BezierPathSegment[] TransformBezierPath(BezierPathSegment[] path, Vector2 translation, float rotation, Vector2 scaling)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierPathSegment[] | path | The path to transform | 
| Vector2 | translation | The translation to apply | 
| Single | rotation | The rotation to apply, in radians | 
| Vector2 | scaling | The scaling to apply | 
Returns
| Type | Description | 
|---|---|
| BezierPathSegment[] | The transformed path | 
TransformSegment(BezierSegment, Matrix2D)
Transforms a curve segment by a transformation matrix.
Declaration
public static BezierSegment TransformSegment(BezierSegment segment, Matrix2D matrix)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment to transform | 
| Matrix2D | matrix | The transformation matrix to apply on the curve segment | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | The transformed curve segment | 
TransformSegment(BezierSegment, Vector2, Single, Vector2)
Transforms a curve segment by a translation, rotation and scaling.
Declaration
public static BezierSegment TransformSegment(BezierSegment segment, Vector2 translation, float rotation, Vector2 scaling)Parameters
| Type | Name | Description | 
|---|---|---|
| BezierSegment | segment | The curve segment to transform | 
| Vector2 | translation | The translation to apply on the curve segment | 
| Single | rotation | The rotation to apply on the curve segment | 
| Vector2 | scaling | The scaling to apply on the curve segment | 
Returns
| Type | Description | 
|---|---|
| BezierSegment | The transformed curve segment | 
WorldTransformedSceneNodes(SceneNode, Dictionary<SceneNode, Single>)
Iterates through every nodes under a root with computed transform and opacities.
Declaration
public static IEnumerable<VectorUtils.SceneNodeWorldTransform> WorldTransformedSceneNodes(SceneNode root, Dictionary<SceneNode, float> nodeOpacities)Parameters
| Type | Name | Description | 
|---|---|---|
| SceneNode | root | The starting node of the hierarchy | 
| Dictionary<SceneNode, Single> | nodeOpacities | Storage for the resulting node opacities, may be null | 
Returns
| Type | Description | 
|---|---|
| IEnumerable<VectorUtils.SceneNodeWorldTransform> | An enumeration of every node with their pre-computed world transforms, opacities and paths. |