I've created a Graphics3D
object by extruding a binary 2D image (as shown here).
pts = ImageData[ColorNegate@Binarize@Import["https://i.stack.imgur.com/UWO6k.png"], "Bit"];
g = RegionPlot3D[pts[[Sequence @@ Round@{i, j}]] == 1, {i, 1, #1}, {j, 1, #2},
{z, 0, 300}, PlotPoints -> 100, Mesh -> False, Axes -> True,
Boxed -> False] & @@ Dimensions[pts]
This object has dimensions 600 $\times$ 600 $\times$ 300 and it is centered on (300, 300, 150). In other words, all coordinates are within the ranges of the given dimensions.
My need is to be able to rescale this object by preserving the same Graphics3D
structure (i.e., including vertices, polygons, vertex normals, etc.). The new ranges of dimensions I'm looking for are ((-0.5, 0.5), (-0.5, 0.5), (-0.25, 0.25)).
I had no troubles to rescale the coordinates of the GraphicsComplex
, but these are not enough to then export the Graphics3D
as an .obj file. A second approach that I took was to use TetGenLink
to recompute the needed information, but since my object has also concavities this did not work as expected.
Has anyone done this before? Any suggestion is more than welcome.