MeshUnwrapper Class

I am wondering how to use this class.
I would like to get the 2d representation of a 3d shape (mesh) using the LSCM method.

So I tried:

            var ptsBeforeUnwrapping = GetTexturePts(meshToUnwrap);

            var unwrapper = new MeshUnwrapper(meshToUnwrap);
            var result = unwrapper.Unwrap(MeshUnwrapMethod.LSCM);

            var ptsAfterUnwrapping = GetTexturePts(meshToUnwrap);

private List<Point3d> GetTexturePts(Mesh meshToUnwrap)
            var tc = meshToUnwrap.TextureCoordinates;
            var pts = new List<Point3d>();
            foreach (var item in tc)
                pts.Add(new Point3d(item.X, item.Y, 0));

            return pts;

I see as said in the API docu that the TextureCoordinates of the given mesh object changed, executing the Unwrap method. But how can I get a 2d mesh out of these? What do the TextureCoordinates actually represent?
My expectation was to get a new mesh object that lies in a plane, and ideally the distortions on its vertices. Is there a way this class can help me achieving this?
Thank you.

Hi Pierre,

no, but you can easily write this yourself. To get the 2d version, just use the texture coordinates as vertex positions and build the 2d mesh with the same indices as the 3d mesh.

Once you have the 2d and 3d mesh, scale the 2d mesh so it has the same area as the 3d mesh. Then compare edgelength deltas and setup a graph which you can transfer into vertex colors.


1 Like

Hello Clement,
thank you for the reply. Yes it is simple in fact. Exactly so as you described, thanks!