GeomPP 0.13.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package GeomPP --version 0.13.0
                    
NuGet\Install-Package GeomPP -Version 0.13.0
                    
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="GeomPP" Version="0.13.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="GeomPP" Version="0.13.0" />
                    
Directory.Packages.props
<PackageReference Include="GeomPP" />
                    
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 GeomPP --version 0.13.0
                    
#r "nuget: GeomPP, 0.13.0"
                    
#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 GeomPP@0.13.0
                    
#: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=GeomPP&version=0.13.0
                    
Install as a Cake Addin
#tool nuget:?package=GeomPP&version=0.13.0
                    
Install as a Cake Tool

GeomPP — C# Bindings

C++/CLI bindings for geompp, targeting Windows x64.

Available on NuGet as GeomPP.

Supports .NET 8, .NET 9, .NET 10, and .NET Framework 4.8.

Changelog — full release notes for every version.


Install

dotnet add package GeomPP

or in your .csproj:

<PackageReference Include="GeomPP" Version="0.8.0" />
Platform .Net .Net Framework
Windows x64 8 · 9 · 10 4.8

Supported types

Type 2D 3D
Point
Vector
Line
Ray
LineSegment
Polyline
Triangle
Polygon
BBox
BBall
BRect2D
BPrism3D
Plane
View2D
GeometryCollection
WktParser

All types expose ToWkt(), FromWkt(), ToFile(), FromFile(), AlmostEquals(), and the same operators available in the C++ library.

Decimal precision for all <=> or AlmostEquals() or compare(a,b, epsilon) functions are managed by a global, thread local variable. It is best to set it up at the beginning of your program (in your main). The defalt is 3 decimals, or 0.001 tolorance.

G.Precision.DecimalPrecision = 6; // default: G.Precision.DP_THREE

Intersection methods return object (null when there is no intersection); use C# pattern matching to extract the result type:

var result = line.Intersection(segment);
if (result is G.Point2D p)       { /* point intersection */ }
if (result is G.LineSegment2D s) { /* overlap */ }

Platform note

GeomPP is built with C++/CLI and is Windows x64 only. It will not run on Linux, macOS, or 32-bit processes.


How to use it

You can look at the test suite to see detailed usage.

A quick list of code examples per topic is provided here.

👉 View Full Code Examples on Github


Build on Windows x64 manually

Build the C# DLL

# from the main directory, geompp

# .NET 8 (LTS, supported until Nov 2026)
msbuild geompp_csharp\GeomPP_Net8.vcxproj /p:Platform=x64 /p:GeomppBuildRoot="$PWD\build_win" [/p:Configuration=Release]

# .NET 9 (STS)
msbuild geompp_csharp\GeomPP_Net9.vcxproj /p:Platform=x64 /p:GeomppBuildRoot="$PWD\build_win" [/p:Configuration=Release]

# .NET 10 (LTS)
msbuild geompp_csharp\GeomPP.vcxproj /p:Platform=x64 /p:GeomppBuildRoot="$PWD\build_win" [/p:Configuration=Release]

# .NET Framework 4.8
msbuild geompp_csharp\GeomPP_Net48.vcxproj /p:Platform=x64 /p:GeomppBuildRoot="$PWD\build_win" [/p:Configuration=Release]

# run smoke tests, after build from the main directory geompp
dotnet test geompp_csharp\tests\GeomPPTests.csproj [-p:GeomPPConfiguration=Release]
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net9.0-windows7.0 is compatible.  net10.0-windows was computed.  net10.0-windows7.0 is compatible. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.8

    • No dependencies.
  • net10.0-windows7.0

    • No dependencies.
  • net8.0-windows7.0

    • No dependencies.
  • net9.0-windows7.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
0.17.3 98 8/15/2026
0.17.2 92 8/14/2026
0.16.2 87 8/6/2026
0.15.1 119 7/24/2026
0.14.0 104 7/21/2026
0.13.0 117 7/9/2026
0.12.0 103 7/8/2026
0.11.0 110 7/4/2026
0.10.1 124 6/23/2026
0.9.1 222 6/17/2026
0.8.2 117 5/18/2026
0.8.0 111 5/18/2026
0.7.0 104 5/6/2026
0.6.0 104 5/4/2026
0.5.0 103 5/1/2026
0.4.0 115 4/27/2026
0.1.2 124 4/13/2026
0.1.1 123 4/13/2026
0.1.0 125 4/9/2026

> C++ library — tagged `v0.13.0` · C# / NuGet — tagged `csharp-v0.13.0` · Python / PyPI — tagged `python-v0.13.0`

> Polyline vertex-count reduction: `Polyline2D/3D::Reduce()` with three selectable strategies (RadialDistance, RamerDouglasPeucker, VisvalingamWhyatt), backed by three new dimension-agnostic free functions in `calc_utils2d.hpp`. `geompp_sample/` removed (superseded by the test suite and README code examples).

### Added

**C++ core**
- `PolylineDecimationStrategy` enum (`constants.hpp`) — `RadialDistance`, `RamerDouglasPeucker`, `VisvalingamWhyatt`.
- `dist_decimation(Points const&, double threshold)` (`calc_utils2d.hpp`) — O(n) radial-distance decimation: drops a vertex when it's closer than `threshold` to the last kept vertex. Templated over `PointContainer`; explicit-instantiated for `std::vector<Point2D>` / `std::vector<Point3D>`.
- `rdp_decimation(Points const&, double threshold)` — Ramer-Douglas-Peucker, O(n log n) to O(n²): iterative (explicit-stack, no recursion) search for the vertex with maximum perpendicular distance from the chord spanning its segment; keeps it and recurses when that distance exceeds `threshold`, else discards the whole span. Perpendicular distance is computed via vector projection (`line_distance_2`), avoiding the `LineSegment` constructor and working uniformly across `Vector2D`/`Vector3D`.
- `vw_decimation(Points const&, double threshold)` — Visvalingam-Whyatt, O(n log n) to O(n²): doubly-linked-list topology + lazy-deletion min-heap keyed on (squared) triangle area; repeatedly removes the lowest-area vertex while its neighbors' areas are recomputed and re-pushed, until the smallest remaining area exceeds `threshold`.
- `Polyline2D::Reduce(PolylineDecimationStrategy strategy = RamerDouglasPeucker, double threshold = 0.5) const` and `Polyline3D::Reduce(...)` — returns a copy of the polyline with fewer vertices. The `VisvalingamWhyatt` and `RamerDouglasPeucker` cases run a cheap `dist_decimation` noise pre-pass (`threshold * 0.1`) before the main algorithm.

**Python bindings**
- `PolylineDecimationStrategy` enum (`RadialDistance`, `RamerDouglasPeucker`, `VisvalingamWhyatt`).
- `dist_decimation(points, threshold)`, `rdp_decimation(points, threshold)`, `vw_decimation(points, threshold)` — bound for both `Point2D` and `Point3D` point lists.
- `Polyline2D.reduce(strategy=RamerDouglasPeucker, threshold=0.5)` and `Polyline3D.reduce(...)`.

**C# bindings**
- `PolylineDecimationStrategy` enum (declared alongside `Polyline2D`, shared by `Polyline3D`).
- `GeomUtil.DistDecimation(List<Point2D^>^, double)` / `RdpDecimation(...)` / `VwDecimation(...)` — and the `Point3D^` overloads.
- `Polyline2D.Reduce()` (defaults) and `Polyline2D.Reduce(PolylineDecimationStrategy, double)`; same pair on `Polyline3D`.

### Removed

- `geompp_sample/` (the standalone `sample.cpp` demo app and its `CMakeLists.txt`) — dropped from the top-level `CMakeLists.txt` and the README's "How to use it" pointer. The test suite and README code examples already cover the same ground.

### Tests

- `test_calc_utils2d.cpp` / `test_calc_utils3d.cpp`: `DistDecimation_*`, `RdpDecimation_*`, `VwDecimation_*` — clustered-point removal, collinear collapse, a hand-verified triangular-spike case (peak kept, shoulders discarded) cross-checked by hand for both the RDP chord-distance and VW triangle-area math, and epsilon-boundary behavior at `threshold=0`. 3D cases isometrically embed the same numeric scenarios in a non-axis-aligned plane to exercise the `Vector3D` code path.
- `test_polyline2d.cpp` / `test_polyline3d.cpp`: `Reduce_*` — all three strategies, default-parameter equivalence to explicit `RamerDouglasPeucker`/`0.5`, and the two-point pass-through case.
- Python `TestDecimationFreeFunctions`, `TestPolyline2DReduce`, `TestPolyline3DReduce`; C# `DistDecimation_*`/`RdpDecimation_*`/`VwDecimation_*`, `Polyline2D_Reduce_*`, `Polyline3D_Reduce_*` mirror the same cases.

---