Is there an example of how to use DefaultMesh? There are 2 constructors for DefaultMesh and both of them create “A new empty facet container”. Since they were both empty, I tried the simpler one, with no vertices. Then I did a mesh0.setFaces(facets); where facets is a list of triangular faces.

Looking at the mesh object the list of vertices is of length zero and the surface are is also zero. Perhaps I need to use the constructor DefaultMesh(Set vertices)? I don’t see any function to tell the mesh to refresh itself.

In short, at least it doesn’t crash, but I am clearly not doing enough to get anything useful out of it. In the end I want to obtain the default sphericity.

Thanks,

Ilan

# How to use DefaultMesh?

**ilan**#1

**kephale**#2

Please note that we just released significant improvements and changes to meshes. See one of the new backend implementations such as: https://github.com/imagej/imagej-mesh/blob/master/src/main/java/net/imagej/mesh/naive/NaiveDoubleMesh.java

DefaultMesh has been removed in favor of a more robust Mesh API that you can access via imagej-mesh, imagej-mesh-io, and SciView

**ilan**#3

Thanks Kyle. I’ve looked at both NaiveDoubleMesh and BufferMesh.

Both of them need inputs of normal vectors for the faces and vertices. It wasn’t obvious to me what a normal vector for a vertex would mean, but I see is a weighted average of the triangular faces attached to it. What I have as input is a convex hull which supplies both faces and vertices but no normal vectors.

I see how I am supposed to construct normal vectors for the triangular faces and then presumably weight the normal vectors by the triangular area. It would seem to me that this is a good candidate for reusable code.

Is there any thought that the mesh might calculate its own normal vectors? The face points are in counter clockwise order. I am still fairly new to the subject for forgive me if I am saying nonsense.

Thanks,

Ilan