MeshLib
 
Loading...
Searching...
No Matches
Mesh Decimation

Example of mesh decimation

using MR.DotNet;
using System;
using System.Reflection;
class Program
{
static void Main(string[] args)
{
if (args.Length != 1 && args.Length != 2)
{
Console.WriteLine("Usage: {0} INPUT [OUTPUT]", Assembly.GetExecutingAssembly().GetName().Name);
return;
}
try
{
string input = args[0];
string output = args.Length == 2 ? args[1] : args[0];
var mesh = Mesh.FromAnySupportedFormat( input );
dp.strategy = DecimateStrategy.MinimizeError;
dp.maxError = 1e-5f * mesh.BoundingBox.Diagonal();
dp.tinyEdgeLength = 1e-3f;
dp.packMesh = true;
var result = MeshDecimate.Decimate(mesh, dp);
Mesh.ToAnySupportedFormat(mesh, output);
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e.Message);
}
}
}
DecimateStrategy
Defines the order of edge collapses inside Decimate algorithm.
Definition MRDotNet/MRMeshDecimate.h:13
represents a mesh, including topology (connectivity) information and point coordinates,
Definition MRDotNet/MRMesh.h:30
static void ToAnySupportedFormat(Mesh^ mesh, System::String^ path)
saves mesh to file of any supported format
static Mesh FromAnySupportedFormat(System::String^ path)
loads mesh from file of any supported format
Definition MeshDecimate.dox.py:1
Definition MRDotNet/MRMeshDecimate.h:21