Table of Contents

Class BorderPolylineSimplifier

Namespace
Map.Rendering.Border
Assembly
MapAssembly.dll

Utilities for simplifying and smoothing polylines Extracted from BorderCurveExtractor for single responsibility

Methods:

  • SimplifyPolyline: Ramer-Douglas-Peucker algorithm to reduce vertex count
  • SmoothCurve: Chaikin subdivision smoothing algorithm
  • TessellatePolyline: Subdivide long segments for dense vertex coverage
public static class BorderPolylineSimplifier
Inheritance
object
BorderPolylineSimplifier

Methods

SimplifyPolyline(List<Vector2>, float)

Simplify polyline using Ramer-Douglas-Peucker algorithm Reduces pixel-perfect staircase to longer line segments that Chaikin can smooth

public static List<Vector2> SimplifyPolyline(List<Vector2> points, float epsilon)

Parameters

points List<Vector2>

Input polyline points

epsilon float

Maximum distance from line for point to be removed

Returns

List<Vector2>

Simplified polyline with fewer points

SmoothCurve(List<Vector2>, int, bool)

Smooth polyline using Chaikin subdivision algorithm Preserves original endpoints to maintain junction connections

public static List<Vector2> SmoothCurve(List<Vector2> points, int iterations, bool enableDebugLog = false)

Parameters

points List<Vector2>

Input polyline points

iterations int

Number of smoothing iterations (more = smoother)

enableDebugLog bool

Log smoothing progress

Returns

List<Vector2>

Smoothed polyline with more points

TessellatePolyline(List<Vector2>, float)

Tessellate polyline to ensure dense vertex coverage (Paradox approach) Subdivides any segment longer than maxSegmentLength to create smooth rendering Target: 0.5 pixel spacing = ~2 vertices per pixel for ultra-smooth borders

public static List<Vector2> TessellatePolyline(List<Vector2> points, float maxSegmentLength)

Parameters

points List<Vector2>

Input polyline points

maxSegmentLength float

Maximum allowed segment length before subdivision

Returns

List<Vector2>

Tessellated polyline with denser vertex coverage