Group Abstract Group Abstract

Message Boards Message Boards

Differences in 3 Dimensional objects?

Posted 9 years ago

I'm am subtracting a 3D shape form another 3d shape.

This code works nicely;

    tray = Cuboid[-1.0 {714.35, 130.66,  0}, {714.35, 130.66, 153.94}]; 
    trayCutout = Cuboid[-1.0 {699.21, 115.52, 15.14}, {699.21, 115.52, 138.79}]; 
    reg = Fold[RegionDifference, tray, {trayCutout}];

This code fails ...

    object = RegionPlot3D[0.012537762251 (x^2 + y^2) - z <= 0, {x, -101.60, 101.60}, {y, -101.60, 101.60}, {z, 0, 129.43}]
    cutout = RegionPlot3D[0.023816076541 (x^2 + y^2) - z <= 0, {x, -54.88, 54.88}, {y, -54.88, 54.88}, {z, 0, 71.72}] 
    region = Fold[RegionDifference, object, {cutout}];

Any thoughts on why the RegionPlot3D fails & the Cuboid works nicely. And how can I make the RegionPlot3D work ?

POSTED BY: Rick Tschudin
11 Replies

RegionPlot3D generates a Graphics3D object, not a region.

POSTED BY: Frank Kampas
POSTED BY: Sander Huisman

GOT IT !

I quit Mathematica 11 and restarted it.
I think there were too many spurious variables floating around.

Near the origin, it fell apart ...

POSTED BY: Rick Tschudin

Here, even better, the file.

Attachments:
POSTED BY: Sander Huisman

I have a Home version, purchased & registered a few days ago. Clean ?... I think it has to be.

Can you send a screen shot of 'the line of code'. I suspect, copy and paste may be the problem.

This solves a big problem for me. I've been using Applescript to do the math, logic & write the Mathematica code . I do the same, writing Python code to drive Blender. I'm hoping to do everything with Mathematica , alone.

Greatly appreciate your input !

On a side note; I have a picture of Machu Picchu, shot from the exact same spot as yours. Went there in the 1980's on a Shirley MacLaine film. In fact we climbed to the top of Huana Picchu the mountain in the background.

POSTED BY: Rick Tschudin

If you do a straight copy from my above post, in a clean Mathematica 11 you should get:

enter image description here

POSTED BY: Sander Huisman

Sander , I like this!
A single line, not so many coercive lines of code.

I've read about 'And Not Or Xor' & about RegionPlot3D.

I Think this says, a larger paraboloid solid at the origin, minus a smaller paraboloid solid also at the origin. enter image description here

I am guessing that this does not say what I think it says.

Ideas ?

POSTED BY: Rick Tschudin

RegionPlot(3D) can handle And Not Or Xor et cetera:

RegionPlot3D[
 0.012537762251 (x^2 + y^2) - z <= 0 \[And] 
  Not[0.023816076541 (x^2 + y^2) - z <= 0], {x, -101.60, 
  101.60}, {y, -101.60, 101.60}, {z, 0, 129.43}]
POSTED BY: Sander Huisman

Thanks Frank , My goal with this code is 'to subtract 1 shape from another shape' , so I added these lines ...

        (*     RegionPlot3D generates a Graphics3D object,  not a region !     *)
        objMesh = DiscretizeGraphics[object];
        cutoutMesh = DiscretizeGraphics[cutout];
        region = Fold[RegionDifference, objMesh, {cutoutMesh}];

        (*     Use RegionMember to turn this into inequalities:     *)
        ineqs = RegionMember[region, {x, y, z}];

All is good till here and this last line fails ...

        contourRegionPlot3D[ineqs, {x, -101.60, 101.60}, {y, -101.60, 101.60}, {z, 0, 129.43}, Mesh -> NoneBoxRatios -> Automatic,         PlotRange -> All, Boxed -> False, Axes -> False]

        results : Mesh::ilevels    NoneBoxRatios -> Automatic is not a valid mesh specifications.

Any ideas why 'contourRegionPlot3D' fails here ?

POSTED BY: Rick Tschudin
Posted 9 years ago
POSTED BY: Updating Name
POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard