Calculate width and height of mesh in rectangle

So I need to apply dynamic texture with text. The problem is I do not know how to get the width and height of a deformed rectangle mesh.

currently my code:

function getPlaneWidthHeight(mesh) {
    var bb = mesh.getBoundingInfo().boundingBox.extendSize;
    var arr = $.map(bb, function (value, key) {
        if (key == '_x' || key == '_y' || key == '_z')
            return value;
    });

    var height = bb._y;
    arr.splice(arr.indexOf(height), 1);
    var width = Math.max.apply(Math, arr);

    return { width: width, height: height };
}

It does not work properly.

For instance I have a shirt with logo in the chest. In my 3D (Blender), I created rectangle, then the rectangle is mapped to the chest curvature. How can I get the width and height of the logo mesh when the mesh got curved around the chest? Also if the rectangle is rotated to the side (place in arm)?

What you mean by width and height of the plane? Is it the width/height in pixels in the 2D screen space? Maybe a drawing or a PG will help to understand what you want to achieve.

2 Likes

Sorry never mind I already got it. Thank you