TVGL 2.0.0
dotnet add package TVGL --version 2.0.0
NuGet\Install-Package TVGL -Version 2.0.0
<PackageReference Include="TVGL" Version="2.0.0" />
<PackageVersion Include="TVGL" Version="2.0.0" />
<PackageReference Include="TVGL" />
paket add TVGL --version 2.0.0
#r "nuget: TVGL, 2.0.0"
#:package TVGL@2.0.0
#addin nuget:?package=TVGL&version=2.0.0
#tool nuget:?package=TVGL&version=2.0.0
TVGL
TVGL is a computational geometry library for .NET. It provides data structures and algorithms for triangle meshes, polygons, voxels, analytic surfaces, convex hulls, and solid-model analysis.
The repository also contains testing, benchmarking, file-conversion, and Windows desktop presentation projects. Some of these projects have platform-specific requirements beyond those of the core library.
Installation
Clone the repository and build the core library in Release configuration:
git clone https://github.com/DesignEngrLab/TVGL.git
cd TVGL
dotnet build TessellationAndVoxelizationGeometryLibrary/TessellationAndVoxelizationGeometryLibrary.csproj --configuration Release
Reference TessellationAndVoxelizationGeometryLibrary.csproj directly from your project.
Installation from NuGet
Install it from NuGet with the .NET CLI:
dotnet add package TVGL --version 2.0.0
Or add the package reference directly to your project file:
<PackageReference Include="TVGL" Version="2.0.0" />
Quick start
The following example constructs the three-dimensional convex hull of five points:
using System;
using System.Collections.Generic;
using TVGL;
var points = new List<Vector3>
{
new Vector3(0, 0, 0),
new Vector3(1, 0, 0),
new Vector3(0, 1, 0),
new Vector3(0, 0, 1),
new Vector3(0.2, 0.2, 0.2)
};
if (ConvexHull3D.Create(points, out var hull, out var hullVertexIndices))
{
Console.WriteLine($"Hull vertices: {hull.Vertices.Count}");
Console.WriteLine($"Hull edges: {hull.Edges.Count}");
Console.WriteLine($"Hull faces: {hull.Faces.Count}");
Console.WriteLine($"Input vertices on hull: {string.Join(", ", hullVertexIndices)}");
}
Capabilities
TVGL includes tools for:
- triangle meshes and boundary-representation solids;
- two-dimensional polygons, offsets, intersections, and triangulation;
- voxelization and voxel-based solid operations;
- convex hulls and Delaunay triangulation in two, three, and four dimensions;
- planes, cylinders, cones, spheres, tori, and general quadrics;
- axis-aligned and oriented bounding volumes;
- KD-trees and nearest-neighbor searches;
- geometric transformations, projections, intersections, and distances;
- mesh inspection, modification, and repair; and
- importing and exporting common mesh file formats.
Computational geometry is sensitive to degeneracies, floating-point precision, topology, and model scale. Callers should choose tolerances appropriate to their data and validate results when working with malformed, non-manifold, or nearly degenerate geometry.
Core types
Vectors and coordinates
Vector2, Vector3, and Vector4 represent coordinates and directions. Many TVGL algorithms are implemented as extension methods on vectors, vertices, faces, polygons, and solids.
Polygons
Polygon represents a bounded two-dimensional contour. Polygon operations include containment queries, intersections, offsets, simplification, triangulation, and related planar geometry functions.
Tessellated solids
TessellatedSolid represents a three-dimensional boundary using vertices, edges, and triangular faces. TVGL includes operations for constructing, transforming, querying, modifying, and analyzing these meshes.
Voxelized solids
VoxelizedSolid represents geometry on a regular grid of cubic cells. Voxel models are useful when a discrete representation is preferable to exact boundary geometry, including some boolean, slicing, and analysis workflows.
Analytic primitives
TVGL models planes, cylinders, cones, spheres, tori, and more general conic and quadric surfaces. These types support geometric queries and the interpretation of analytic geometry found in tessellated models.
Loading and saving geometry
The core library contains readers and writers for several three-dimensional mesh formats, including:
- STL, both ASCII and binary;
- 3MF;
- AMF;
- OBJ;
- OFF;
- PLY, both ASCII and binary; and
- TVGL's native serialized formats.
Open a supported model using its file extension:
using TVGL;
Solid solid = IO.Open("part.stl");
For two-dimensional SVG, DXF, and DWG workflows, see the separate PolygonImportExport project in this repository. Format support varies between reading and writing; consult the relevant APIs before depending on round-trip conversion.
Documentation
The repository contains introductory guides for several major areas of TVGL:
- Basic vector and geometric operations
- Working with tessellated solids
- Understanding voxelized solids
- Using primitive surfaces
The public API also includes XML documentation for use in IntelliSense and generated reference documentation.
Contributing
Bug reports and pull requests are welcome. Geometry bug reports are most useful when they include:
- a minimal reproducible example;
- the input geometry or a small equivalent model;
- the expected and actual results;
- the units, scale, and tolerance involved; and
- relevant topology information, such as whether the mesh is closed and manifold.
Please keep behavioral changes separate from formatting or documentation-only changes where practical, and include focused tests for geometry fixes.
License
TVGL is distributed under the MIT License.
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging.Console (>= 10.0.9)
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TVGL:
| Package | Downloads |
|---|---|
|
TVGL.PolygonImportExport
Import and export two-dimensional TVGL polygons in SVG, DXF, and DWG formats. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 111 | 8/3/2026 |
| 1.0.19.213 | 1,793 | 4/28/2019 |
| 1.0.18.133 | 1,607 | 1/31/2018 |
| 1.0.18.132 | 1,562 | 1/31/2018 |
| 1.0.18.131 | 1,549 | 1/31/2018 |
| 1.0.17.1019 | 1,439 | 10/20/2017 |
| 1.0.17.818 | 1,392 | 8/18/2017 |
| 1.0.17.719 | 1,387 | 7/20/2017 |
| 1.0.17.707 | 1,337 | 7/8/2017 |
| 1.0.17.515 | 1,390 | 5/15/2017 |
| 1.0.17.419 | 1,358 | 4/20/2017 |
| 1.0.17.226 | 1,418 | 2/25/2017 |
| 1.0.17.225 | 1,383 | 2/25/2017 |
| 1.0.17.224 | 1,390 | 2/24/2017 |
| 1.0.16.1010 | 1,499 | 10/10/2016 |
| 1.0.16.905 | 1,454 | 9/5/2016 |
| 1.0.16.903 | 1,424 | 9/4/2016 |
| 1.0.16.826 | 1,408 | 8/27/2016 |
| 1.0.16.624 | 1,468 | 6/25/2016 |
| 1.0.16.623 | 1,432 | 6/24/2016 |