Xui.Runtime.Software.Tessellate

Assembly: Xui.Runtime.Software · C# declarations · Assembly overview

Types

class PathTesselator

Represents a full tessellation pipeline result, including intermediate geometric representations. Used for visual debugging, documentation, and rendering filled polygons from vector paths.

public partial class PathTesselator
{
    public readonly struct ClosedContour
    {
        public readonly IReadOnlyList<Point> Points;
        public ClosedContour(IReadOnlyList<Point> points);
        public int Count { get; }

        public Point this[int index] { get; }

        public enum WindingDirection
        {
            Clockwise,
            CounterClockwise
        }

        public WindingDirection Winding { get; }
        public Rect Bounds { get; }
        public nfloat SignedArea { get; }
    }
}
public partial class PathTesselator
{
    public class Contouring : IPathBuilder
    {
        public IReadOnlyList<ClosedContour> Contours { get; }

        public Contouring();
        public Contouring(nfloat precision);
        public List<ClosedContour> Result { get; }

        public static IReadOnlyList<ClosedContour> ContourPath(Path2D path, nfloat precision);
        public void BeginPath();
        public void MoveTo(Point to);
        public void LineTo(Point to);
        public void CurveTo(Point cp1, Point cp2, Point to);
        public void CurveTo(Point control, Point to);
        public void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
        public void Ellipse(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
        public void ArcTo(Point cp1, Point cp2, nfloat radius);
        public void Rect(Rect rect);
        public void RoundRect(Rect rect, nfloat radius);
        public void RoundRect(Rect rect, CornerRadius radius);
        public void ClosePath();
    }
}
public partial class PathTesselator
{
    public partial class ScanlineSweep
    {
        public static List<Polygon> Fill(IReadOnlyList<ClosedContour> contours, FillRule fillRule);
        public static void SweepAndEmitTrapezoids(IReadOnlyList<ClosedContour> contours, FillRule fillRule, List<Polygon> outputTriangles);
        public static List<PathTesselator.ClosedContour> ExtractLoops(List<PathTesselator.ScanlineSweep.Edge> edges);
        public readonly struct Edge
        {
            public readonly Point Start;
            public readonly Point End;
            public readonly nfloat XAtYMin;
            public readonly nfloat SlopeInv;
            public readonly nfloat YMin;
            public readonly nfloat YMax;
            public readonly int Winding;
            public Edge(Point a, Point b);
            public nfloat XAt(nfloat y);
        }
    }
}
public partial class PathTesselator
{
    public PathTesselator(IReadOnlyList<ClosedContour> contours, List<Polygon> polygons);
    public IReadOnlyList<ClosedContour> Contours { get; }
    public List<Polygon> Polygons { get; }

    public static PathTesselator Fill(Path2D path, FillRule fillRule, nfloat flatness);
    public static PathTesselator Fill(Path2D path, FillRule fillRule);
}

PathTesselator.PathTesselator(IReadOnlyList<ClosedContour> contours, List<Polygon> polygons)

public PathTesselator(IReadOnlyList<ClosedContour> contours, List<Polygon> polygons);

IReadOnlyList<ClosedContour> PathTesselator.Contours

public IReadOnlyList<ClosedContour> Contours { get; }

Gets the list of closed contours reconstructed from the segments. Each contour represents a loop used in fill evaluation.

PathTesselator PathTesselator.Fill(Path2D path, FillRule fillRule)

public static PathTesselator Fill(Path2D path, FillRule fillRule);

PathTesselator PathTesselator.Fill(Path2D path, FillRule fillRule, NFloat flatness)

public static PathTesselator Fill(Path2D path, FillRule fillRule, nfloat flatness);

Performs full tessellation of a vector path into filled triangle polygons using a specified fill rule. Intermediate data including segments, contours, and trapezoids is retained for debugging or visualization.

  • path — The vector path to tessellate.

  • fillRule — The fill rule (EvenOdd or NonZero) to apply during sweep.

  • flatness — The curve flattening tolerance. Smaller values yield more segments.

Returns: A Xui.Runtime.Software.Tessellate.PathTesselator instance containing all stages of the tessellation pipeline.

List<Polygon> PathTesselator.Polygons

public List<Polygon> Polygons { get; }

Gets the final list of filled triangle polygons that represent the tessellated shape.

readonly struct PathTesselator.ClosedContour

Represents a closed contour — a sequence of connected points forming a polygon loop.

public readonly struct ClosedContour
{
    public readonly IReadOnlyList<Point> Points;
    public ClosedContour(IReadOnlyList<Point> points);
    public int Count { get; }

    public Point this[int index] { get; }

    public enum WindingDirection
    {
        Clockwise,
        CounterClockwise
    }

    public WindingDirection Winding { get; }
    public Rect Bounds { get; }
    public nfloat SignedArea { get; }
}

ClosedContour.ClosedContour(IReadOnlyList<Point> points)

public ClosedContour(IReadOnlyList<Point> points);

Initializes a new closed contour from a sequence of points.

Rect ClosedContour.Bounds

public Rect Bounds { get; }

int ClosedContour.Count

public int Count { get; }

Returns the number of points in this contour.

Point ClosedContour.this[int index]

public Point this[int index] { get; }

Indexer access to individual points.

IReadOnlyList<Point> ClosedContour.Points

public readonly IReadOnlyList<Point> Points;

Ordered list of points forming the closed contour path.

NFloat ClosedContour.SignedArea

public nfloat SignedArea { get; }

WindingDirection ClosedContour.Winding

public WindingDirection Winding { get; }

enum PathTesselator.ClosedContour.WindingDirection

public enum WindingDirection
{
    Clockwise,
    CounterClockwise
}

WindingDirection.Clockwise

Clockwise

WindingDirection.CounterClockwise

CounterClockwise

class PathTesselator.Contouring

public class Contouring : IPathBuilder
{
    public IReadOnlyList<ClosedContour> Contours { get; }

    public Contouring();
    public Contouring(nfloat precision);
    public List<ClosedContour> Result { get; }

    public static IReadOnlyList<ClosedContour> ContourPath(Path2D path, nfloat precision);
    public void BeginPath();
    public void MoveTo(Point to);
    public void LineTo(Point to);
    public void CurveTo(Point cp1, Point cp2, Point to);
    public void CurveTo(Point control, Point to);
    public void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    public void Ellipse(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);
    public void ArcTo(Point cp1, Point cp2, nfloat radius);
    public void Rect(Rect rect);
    public void RoundRect(Rect rect, nfloat radius);
    public void RoundRect(Rect rect, CornerRadius radius);
    public void ClosePath();
}

Contouring.Contouring()

public Contouring();

Contouring.Contouring(NFloat precision)

public Contouring(nfloat precision);

void Contouring.Arc(Point center, NFloat radius, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)

public void Arc(Point center, nfloat radius, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);

void Contouring.ArcTo(Point cp1, Point cp2, NFloat radius)

public void ArcTo(Point cp1, Point cp2, nfloat radius);

void Contouring.BeginPath()

public void BeginPath();

void Contouring.ClosePath()

public void ClosePath();

IReadOnlyList<ClosedContour> Contouring.ContourPath(Path2D path, NFloat precision)

public static IReadOnlyList<ClosedContour> ContourPath(Path2D path, nfloat precision);

IReadOnlyList<ClosedContour> Contouring.Contours

public IReadOnlyList<ClosedContour> Contours { get; }

void Contouring.CurveTo(Point control, Point to)

public void CurveTo(Point control, Point to);

void Contouring.CurveTo(Point cp1, Point cp2, Point to)

public void CurveTo(Point cp1, Point cp2, Point to);

void Contouring.Ellipse(Point center, NFloat rx, NFloat ry, NFloat rotation, NFloat startAngle, NFloat endAngle, Winding winding = Winding.ClockWise)

public void Ellipse(Point center, nfloat rx, nfloat ry, nfloat rotation, nfloat startAngle, nfloat endAngle, Winding winding = Winding.ClockWise);

void Contouring.LineTo(Point to)

public void LineTo(Point to);

void Contouring.MoveTo(Point to)

public void MoveTo(Point to);

void Contouring.Rect(Rect rect)

public void Rect(Rect rect);

List<ClosedContour> Contouring.Result

public List<ClosedContour> Result { get; }

void Contouring.RoundRect(Rect rect, NFloat radius)

public void RoundRect(Rect rect, nfloat radius);

void Contouring.RoundRect(Rect rect, CornerRadius radius)

public void RoundRect(Rect rect, CornerRadius radius);

class PathTesselator.ScanlineSweep

public partial class ScanlineSweep
{
    public static List<Polygon> Fill(IReadOnlyList<ClosedContour> contours, FillRule fillRule);
    public static void SweepAndEmitTrapezoids(IReadOnlyList<ClosedContour> contours, FillRule fillRule, List<Polygon> outputTriangles);
    public static List<PathTesselator.ClosedContour> ExtractLoops(List<PathTesselator.ScanlineSweep.Edge> edges);
    public readonly struct Edge
    {
        public readonly Point Start;
        public readonly Point End;
        public readonly nfloat XAtYMin;
        public readonly nfloat SlopeInv;
        public readonly nfloat YMin;
        public readonly nfloat YMax;
        public readonly int Winding;
        public Edge(Point a, Point b);
        public nfloat XAt(nfloat y);
    }
}

List<ClosedContour> ScanlineSweep.ExtractLoops(List<Edge> edges)

public static List<PathTesselator.ClosedContour> ExtractLoops(List<PathTesselator.ScanlineSweep.Edge> edges);

Extracts all closed, non-intersecting loops from a set of directed edges. Each loop is returned as a ClosedContour.

List<Polygon> ScanlineSweep.Fill(IReadOnlyList<ClosedContour> contours, FillRule fillRule)

public static List<Polygon> Fill(IReadOnlyList<ClosedContour> contours, FillRule fillRule);

void ScanlineSweep.SweepAndEmitTrapezoids(IReadOnlyList<ClosedContour> contours, FillRule fillRule, List<Polygon> outputTriangles)

public static void SweepAndEmitTrapezoids(IReadOnlyList<ClosedContour> contours, FillRule fillRule, List<Polygon> outputTriangles);

readonly struct PathTesselator.ScanlineSweep.Edge

public readonly struct Edge
{
    public readonly Point Start;
    public readonly Point End;
    public readonly nfloat XAtYMin;
    public readonly nfloat SlopeInv;
    public readonly nfloat YMin;
    public readonly nfloat YMax;
    public readonly int Winding;
    public Edge(Point a, Point b);
    public nfloat XAt(nfloat y);
}

Edge.Edge(Point a, Point b)

public Edge(Point a, Point b);

Point Edge.End

public readonly Point End;

NFloat Edge.SlopeInv

public readonly nfloat SlopeInv;

Point Edge.Start

public readonly Point Start;

int Edge.Winding

public readonly int Winding;

NFloat Edge.XAt(NFloat y)

public nfloat XAt(nfloat y);

NFloat Edge.XAtYMin

public readonly nfloat XAtYMin;

NFloat Edge.YMax

public readonly nfloat YMax;

NFloat Edge.YMin

public readonly nfloat YMin;

readonly struct Polygon

Represents a triangle polygon used during path tessellation.

public readonly struct Polygon : IEnumerable<Point>
{
    public readonly Point A;
    public readonly Point B;
    public readonly Point C;
    public Polygon(Point a, Point b, Point c);
    public IEnumerator<Point> GetEnumerator();
}

Polygon.Polygon(Point a, Point b, Point c)

public Polygon(Point a, Point b, Point c);

Point Polygon.A

public readonly Point A;

Point Polygon.B

public readonly Point B;

Point Polygon.C

public readonly Point C;

IEnumerator<Point> Polygon.GetEnumerator()

public IEnumerator<Point> GetEnumerator();

readonly struct Trapezoid

public readonly struct Trapezoid : IEnumerable<Polygon>
{
    public readonly Point A;
    public readonly Point B;
    public readonly Point C;
    public readonly Point D;
    public Trapezoid(Point a, Point b, Point c, Point d);
    public Polygon Polygon1 { get; }
    public Polygon Polygon2 { get; }

    public IEnumerator<Polygon> GetEnumerator();
}

Trapezoid.Trapezoid(Point a, Point b, Point c, Point d)

public Trapezoid(Point a, Point b, Point c, Point d);

Point Trapezoid.A

public readonly Point A;

Point Trapezoid.B

public readonly Point B;

Point Trapezoid.C

public readonly Point C;

Point Trapezoid.D

public readonly Point D;

IEnumerator<Polygon> Trapezoid.GetEnumerator()

public IEnumerator<Polygon> GetEnumerator();

Polygon Trapezoid.Polygon1

public Polygon Polygon1 { get; }

Polygon Trapezoid.Polygon2

public Polygon Polygon2 { get; }