// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
namespace SixLabors.PolygonClipper {
///
/// Represents a vertex in the input contour linked list used by the sweep.
///
///
/// Vertices are linked in a circular doubly linked list (see and
/// ) so the sweep can traverse ascending/descending bounds and
/// detect local minima/maxima efficiently.
///
internal sealed class SweepVertex
{
#pragma warning disable SA1401 // Hot sweep vertex state uses fields to avoid accessor overhead.
///
/// The vertex position.
///
public Vertex Point;
///
/// The next vertex in the contour.
///
public SweepVertex? Next;
///
/// The previous vertex in the contour.
///
public SweepVertex? Prev;
///
/// Flags describing sweep-related classification.
///
public VertexFlags Flags;
#pragma warning restore SA1401
///
/// Initializes a new instance of the class.
///
public SweepVertex(Vertex point, VertexFlags flags, SweepVertex? prev)
{
this.Point = point;
this.Flags = flags;
this.Next = null;
this.Prev = prev;
}
///
/// Gets a value indicating whether this vertex is marked as a local maxima.
///
public bool IsMaxima => (this.Flags & VertexFlags.LocalMax) != 0;
}
}