9

What's the best workaround for this limitation:

RegionBounds[
 BoundaryDiscretizeGraphics[Graphics3D[{Cone[], Cuboid[]}]]]

enter image description here

Carl Lange
  • 13,065
  • 1
  • 36
  • 70
M.R.
  • 31,425
  • 8
  • 90
  • 281
  • 1
    Tz. Who downvotes this? @M.R. What about RegionBounds@RegionUnion[ BoundaryDiscretizeRegion[Cone[]], BoundaryDiscretizeRegion[Cuboid[]] ]? – Henrik Schumacher Jan 14 '19 at 15:50
  • The very last item in the DiscretizeRegion docs says "DiscretizeGraphics for Graphics3D with multiple volume primitives is not supported", unfortunately. Hence the need for a workaround I suppose :) – Carl Lange Jan 14 '19 at 15:56
  • 1
    @HenrikSchumacher I expect the downvote was due to the question originally not having copy-pasteable code :) – Carl Lange Jan 14 '19 at 15:57
  • 1
    @HenrikSchumacher I did. Because of the very low quality question for a long term user. No copyable code, not a word about what qualifies as expected output etc. – Kuba Jan 14 '19 at 15:58
  • Possible duplicate: https://mathematica.stackexchange.com/questions/18034/how-to-get-the-real-plotrange-using-absoluteoptions – Michael E2 Jan 14 '19 at 16:33

3 Answers3

7
RegionBounds@RegionUnion[ 
  BoundaryDiscretizeRegion[Cone[]], 
  BoundaryDiscretizeRegion[Cuboid[]]
  ]

{{-1., 1.}, {-1., 1.}, {-1., 1.}}

Henrik Schumacher
  • 106,770
  • 7
  • 179
  • 309
7
Charting`get3DPlotRange[
 Show[Graphics3D[{Cone[], Cuboid[]}], PlotRangePadding -> None]]
(*  {{-1., 1.}, {-1., 1.}, {-1., 1.}}  *)

See How to get the real PlotRange using AbsoluteOptions?

If "arbitrary 3d graphics" includes of objects of heterogeneous dimensions, then get3DPlotRange still works:

Charting`get3DPlotRange[
 Show[Graphics3D[{Cone[], Cuboid[], Point[{0, 0, -3}], 
    Line[{{1, 0, 0}, {-2, 0, 0}}]}], PlotRangePadding -> None]]
(*  {{-2., 1.}, {-1., 1.}, {-3., 1.}}  *)
Michael E2
  • 235,386
  • 17
  • 334
  • 747
4
MinMax /@ Transpose[RegionBounds /@ {Cone[], Cuboid[]}]

{{-1, 1}, {-1, 1}, {-1, 1}}

halmir
  • 15,082
  • 37
  • 53