Mesh Tools

Like what you are seeing?

Support us as a GitHub Sponsor and get instant access to all our assets, exclusive tools and assets, escalated support and issue tracking and our gratitude. These articles are made possible by our GitHub Sponsors ... become a sponsor today!

Introduction

public static class MeshTools

Found in namespace:

using HeathenEngineering.UnityPhysics.API;

We recommend using aliases to reduce typing and simplify names. and reduce possible collisions with similarly named objects.

using API = HeathenEngineering.UnityPhysics.API;

doing this you can fully qualify the name of this class as

API.MeshTools

What can it do?

Mesh tools is used to create convex hulls, calculate the volume of a mesh, find surface area and various other geometry functions handy when your working on physics problems.

Convex Hull

The most common use of mesh tools is to create a convex hull. You can get a convex hull for a single mesh, multiple mesh or for any collection of points in space.

var mesh = MeshTools.ConvexHull(meshfilters);
var mesh = MeshTools.ConvexHull(meshes);
var mesh = MeshTools.ConvexHull(vertexList);

Mesh Volume

You can find the volume of a mesh, or find the convex hull of a mesh then find the volume of that

var volume = MeshTools.VolumeOfConvexMesh(mesh, scale);

or

var volume = MeshTools.VolumeOfMesh(mesh, scale);

Surface Area

Whole Mesh

var surface = MeshTools.SurfaceArea(mesh);

Cross Section area

var surface = MeshTools.FacingSurfaceArea(mesh, direction);

Area and Volume

A quick short cut to do both

MeshTools.GetAreaAndVolume(mesh, scale, out surface, out volume);

Last updated