PolylineSimplifier 1.0.2

dotnet add package PolylineSimplifier --version 1.0.2
                    
NuGet\Install-Package PolylineSimplifier -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PolylineSimplifier" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PolylineSimplifier" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="PolylineSimplifier" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PolylineSimplifier --version 1.0.2
                    
#r "nuget: PolylineSimplifier, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PolylineSimplifier@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PolylineSimplifier&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=PolylineSimplifier&version=1.0.2
                    
Install as a Cake Tool

PolylineSimplifier

An efficient .NET library for simplifying 2D polylines using the Ramer-Douglas-Peucker algorithm. It reduces the number of points in a curve while preserving its visual shape.

Usage

Installation

dotnet add package PolylineSimplifier

Example

using PolylineSimplifier;

public record Point(float X, float Y);

List<Point> points = new List<Point>
{
    new(0, 0), new(1, 0.1f), new(2, -0.1f), new(3, 5), new(4, 6),
    new(5, 7), new(6, 8.1f), new(7, 9), new(8, 9), new(9, 9)
};

List<Point> simplified = RamerDouglasPeucker2D.Simplify(
    points,
    epsilon: 1.0f,
    getX: p => p.X,
    getY: p => p.Y);

Parameters

Parameter Description
points The input polyline as a list of points
epsilon Maximum perpendicular distance tolerance. Larger values = more simplification
getX Function to extract the X coordinate from a point
getY Function to extract the Y coordinate from a point

Benchmarks

Measured on an AMD Ryzen 5 7600X Processor:

Method Mean Allocated
100 Points 1.40 μs 2.11 KB
1000 Points 22.9 μs 15,6 KB
10000 Points 757 μs 143 KB
100000 Points 17200 μs 1440 KB

Note: Epsilon = 1.0 for all benchmarks. A larger epsilon generally decreases the execution time and allocates less memory.

Running Benchmarks

git clone git@github.com:jonataneckeskog/PolylineSimplifier.git
cd PolylineSimplifier
dotnet run -c Release --project tests/PolylineSimplifier.Benchmarks

License

MIT License – see LICENSE for details.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 80 2/28/2026
1.0.1 81 2/28/2026
1.0.0 201 11/27/2025