Message Boards Message Boards

0
|
1726 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to draw complex 3D regions?

Posted 1 year ago

POSTED BY: Werner Geiger
2 Replies

Werner,

keeping things simple, here is one way:

primsCubes = 
  DiscretizeRegion /@ {Cuboid[{-10, -10, 0}, {10, 10, 40}], 
    Cuboid[{-26, -10, 0}, {26, 10, 5}]};
primsHoles = 
  DiscretizeRegion /@ {Cuboid[{-1, -12, 30}, {1, 12, 50}], 
    Cylinder[{{-20, 0, 35}, {20, 0, 35}}, 2], 
    Cylinder[{{0, -20, 25}, {0, 20, 25}}, 7], 
    Cylinder[{{-18, 0, -1}, {-18, 0, 12}}, 4], 
    Cylinder[{{18, 0, -1}, {18, 0, 12}}, 4]};

part1 = Fold[RegionDifference, primsCubes[[1]], primsHoles[[;; 3]]]
part2 = Fold[RegionDifference, primsCubes[[2]], primsHoles[[4 ;;]]]
workpiece = RegionUnion[part1, part2]

enter image description here

Regards -- Henrik

EDIT / ADDENDUM:

Why do you not want to simply use CSGRregion[] ?

POSTED BY: Henrik Schachner
Posted 1 year ago

Thanks Henrik, I will try your hint to DiscretizeRegion.

My actual task is to draw a complex moving part (namely a gyroscope in some housing) together with its locus, orientation and additional information like forces and torques in a 3D animation. Therefore, the rendering must be very fast.

CSGRegion is great, although I don't really understand its necessity. It seems to be something like a combination of region construction operations like RegionUnion etc. and the representation of regions by Region[region]. But CSGRegion[region] seems to be more powerful in terms of representation.

POSTED BY: Werner Geiger
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract