Message Boards Message Boards

GROUPS:

Visual problem when plotting several figures

Posted 3 years ago
4644 Views
|
4 Replies
|
0 Total Likes
|

Hi

Suppose that I want to plot two polygons and some points in the same 3d graph. For example:

poly1 = Graphics3D[Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]];

poly2 = Graphics3D[Polygon[{{2, 1, 1}, {1, 1, 1}, {1, 1, 2}}]];

Show[poly1, poly2, 
 ListPointPlot3D[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}, 
  PlotStyle -> Directive[Red, PointSize[0.05]]]]

Where the two polygons meet, I am asking Mathematica to plot both the plans and the point (1,1,1). How can I set the priority such that the point has a higher priority? The problem is that I want the red points to have higher priority, i.e. to be drawn completely. On the picture you can see that it is not the case. If I have more figures, sometimes when turning the graph, the point can even disappear completely, while I want it to be very clear.

enter image description here

Thank you very much!

Best, Alex

4 Replies

I doubt you can set priorities in 3D, but you can make the planes partially transparent with Opacity[]. Otherwise you may use Sphere instead of Point.

Try this

poly1 = Graphics3D[{Opacity[.5], 
    Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]}];

poly2 = Graphics3D[{Opacity[.5], 
    Polygon[{{2, 1, 1}, {1, 1, 1}, {1, 1, 2}}]}];

points = Graphics3D[{Red, Opacity[1], PointSize[0.05], 
    Point[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}]}];

Show[poly1, poly2, points]

The opacity solution may work just fine for you, but it can be demanding for older machines or if there's any compatibility issue with the graphics driver (that can happen on some Linux systems). Try the following if you want opaque planes and the points don't have to be flat:

Graphics3D[{
  Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}],
  Polygon[{{2, 1, 1}, {1, 1, 1}, {1, 1, 2}}],
  Red, Sphere[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}, .05]
  }]

(Also, I can't quantify it off the top of my head, but a Show of a lot of Graphics3D objects tends to be slower than one big Graphics3D, but that won't matter for plots with only a few elements.)

Posted 3 years ago

Thank you very much for your answers!

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