docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class VectorUtils

    Provides various tools to work with vector graphics.

    Inheritance
    object
    VectorUtils
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Unity.VectorGraphics
    Assembly: Unity.VectorGraphics.dll
    Syntax
    public static class VectorUtils

    Fields

    Epsilon

    A small value used everywhere by the vector graphics package.

    Declaration
    public static readonly float Epsilon
    Field Value
    Type Description
    float

    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.

    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.

    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.

    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

    BuildSprite(List<Geometry>, float, Alignment, Vector2, ushort, bool)

    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

    float 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

    ushort gradientResolution

    The maximum size of the texture holding gradient data

    bool 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<Geometry>, Rect, float, Alignment, Vector2, ushort, bool)

    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

    float 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

    ushort gradientResolution

    The maximum size of the texture holding gradient data

    bool 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, float)

    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

    float t

    The parametric location on the curve

    Returns
    Type Description
    Vector2

    The position on the curve at parametric location "t"

    EvalFull(BezierSegment, float, 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

    float 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, float, 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

    float 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, float)

    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

    float 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, float)

    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

    float t

    The parametric location on the curve

    Returns
    Type Description
    Vector2

    The tangent of the curve at parametric location "t"

    FillMesh(Mesh, List<Geometry>, float, bool)

    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

    float svgPixelsPerUnit

    How many SVG "pixels" map into a Unity unit

    bool flipYAxis

    Set to "true" to have the positive Y axis to go downward.

    FillUVs(IEnumerable<Geometry>, 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
    float[]

    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<Geometry>, uint, bool, bool, bool)

    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, bool generatePOTTexture = true, bool encodeSettings = true, bool linear = true)
    Parameters
    Type Name Description
    IEnumerable<VectorUtils.Geometry> geoms

    The list of Geometry objects, probably created with TessellateNodeHierarchy

    uint rasterSize

    Maximum size of the generated texture

    bool generatePOTTexture

    Resize the texture to the next power-of-two

    bool encodeSettings

    Encode the gradient settings inside the texture

    bool linear
    Returns
    Type Description
    VectorUtils.TextureAtlas

    The generated texture atlas

    GenerateAtlasAndFillUVs(IEnumerable<Geometry>, uint)

    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

    uint rasterSize

    Maximum size of the generated texture

    Returns
    Type Description
    VectorUtils.TextureAtlas

    The generated texture atlas

    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

    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

    MakeArc(Vector2, float, float, float)

    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

    float startAngleRads

    The starting angle of the arc, in radians

    float sweepAngleRads

    The "length" of the arc, in radians

    float radius

    The radius of the arc

    Returns
    Type Description
    BezierPathSegment[]

    An array of up to four BezierSegments holding the arc

    MakeCircleShape(Shape, Vector2, float)

    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.

    float radius

    The radius of the circle.

    MakeEllipseShape(Shape, Vector2, float, float)

    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.

    float radiusX

    The x component of the radius of the circle.

    float 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
    bool

    True if the two ends of the chain are at the same location, false otherwise

    PathSegmentAtIndex(IList<BezierPathSegment>, int)

    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

    int 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, bool)

    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

    bool flip

    A boolean indicating whether to flip the coordinates on the Y axis

    RenderSprite(Sprite, Material, bool)

    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

    bool clear

    If true, clear the render target before rendering

    RenderSpriteToTexture2D(Sprite, int, int, Material, int, bool)

    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

    int width

    The desired width of the resulting texture

    int height

    The desired height of the resulting texture

    Material mat

    The material used to render the sprite

    int antiAliasing

    The number of samples per pixel for anti-aliasing

    bool 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, float)

    Computes the length of a single curve segment.

    Declaration
    public static float SegmentLength(BezierSegment segment, float precision = 0.001)
    Parameters
    Type Name Description
    BezierSegment segment

    The curve segment on which to evaluate the length

    float precision

    The precision of the length computation

    Returns
    Type Description
    float

    The length of the segment

    SegmentsInPath(IEnumerable<BezierPathSegment>, bool)

    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

    bool 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>, bool, float)

    Computes the combined length of a segment chain.

    Declaration
    public static float SegmentsLength(IList<BezierPathSegment> segments, bool closed, float precision = 0.001)
    Parameters
    Type Name Description
    IList<BezierPathSegment> segments

    The curve segments on which to evaluate the length

    bool closed

    A boolean indicating if the length of the segment joining the first and last points should be computed

    float precision

    The precision of the length computation

    Returns
    Type Description
    float

    The combined length of the segment chain

    SegmentsLengths(IList<BezierPathSegment>, bool, float)

    Computes the individual lengths of a segment chain.

    Declaration
    public static float[] SegmentsLengths(IList<BezierPathSegment> segments, bool closed, float precision = 0.001)
    Parameters
    Type Name Description
    IList<BezierPathSegment> segments

    The segments on which to compute the lengths

    bool closed

    A boolean indicating if the length of the segment joining the first and last points should be computed

    float precision

    The precision of the lengths computation

    Returns
    Type Description
    float[]

    An array containing the lenghts of the segments

    SplitSegment(BezierSegment, float, 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

    float 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, TessellationOptions, out Vector2[], out ushort[])

    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

    ushort[] 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 ushort[])

    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

    ushort[] indices

    The output triangles

    TessellateRectBorder(Rect, float, out Vector2[], out ushort[])

    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

    float halfThickness

    The half-thickness of the border

    Vector2[] vertices

    The output vertices

    ushort[] indices

    The output triangles

    TessellateScene(Scene, TessellationOptions, Dictionary<SceneNode, float>)

    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

    The scene containing the hierarchy to tessellate

    VectorUtils.TessellationOptions tessellationOptions

    The tessellation options

    Dictionary<SceneNode, float> 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, float, 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

    float 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, float, 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

    float 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, float>)

    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, float> 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.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)