Problem
How to discretize a surface constructed with multiple components?
Unsuccessful attempts include combining the objects top
and hull
using the Mathematica commands Graphics3D
, Union
, and RegionUnion
.
Other posts investigated
Boundary discretize region of ellipsoid returns a three dimensional region
How to combine regions of two 3D plots
RegionUnion issues with many Regions
Example
Combine and mesh the surface defined by these two blocks:
{length, beam, draft} = {50, 3, 4}
pmin={0, 0, 0};
pmax={length, beam, draft};
hull = Cuboid[pmin, pmax];
{topLength, height} = {30, 3};
pmin = {10, 0, draft};
pmax = pmin + {topLength, beam, height};
top = Cuboid[pmin, pmax];
ohp = RegionUnion[top, hull]
Fails to discretize:
BoundaryDiscretizeRegion[ohp, MaxCellMeasure -> {"Length" -> 5}]
BoundaryDiscretizeRegion: A non-degenerate region is expected at position 1
pmin = {10, 0, draft - 10^-9};
make the pmin of the top very slighty stick into the hull and it works. If you want a shaper edge, reduce the MaxCellMeasure to something like 0.25. $\endgroup$