2
$\begingroup$

I would like to know how one can coax Mathematica to reveal the coordinates of a generic Graphics3D object. Consider, e.g., the unit sphere:

Graphics3D[Sphere[]]

enter image description here

I realise that the first step is probably to generate a discrete mesh of the object using DiscretizeGraphics[], but what next?

enter image description here


EDIT: I apologise, I was vague about what I really wanted. What I really need is the ability to see the coordinates of each point as I am scrolling over it, like in regular 2d plots. Is that possible?

Note: There is already a question on this topic (Seeing coordinates in Graphics3D) from 2016, but it's only meant for line segments, and thus does not serve my purposes.

$\endgroup$

2 Answers 2

3
$\begingroup$

Try

pic = DiscretizeGraphics[ Graphics3D[Sphere[]]]


pic["Coordinates"]

gives you all the points of the surface!

More information concerning pic you can fin with pic["Properties"]

$\endgroup$
4
  • $\begingroup$ Thank you. Ideally, would it be possible to display the coordinates of each point as I am scrolling over it? $\endgroup$
    – ap21
    Mar 1, 2021 at 11:24
  • $\begingroup$ In fact, that is really the question I had. Let me edit my question in order to reflect that. Sorry for the confusion; I really appreciate the first step you have provided here. $\endgroup$
    – ap21
    Mar 1, 2021 at 11:29
  • $\begingroup$ @ap21 If you scroll over the 2D image of the sphere how to decide which of the two 3D points is the right one? $\endgroup$ Mar 1, 2021 at 11:36
  • $\begingroup$ Good point. But I am taking my cue from software like Matlab, where it is possible to scroll over a point in 3d and get its coordinates. I know it is tricky, and one has to play around to get the good coordinates, but if Matlab has a solution, so should Mathematica. That's why I was asking. $\endgroup$
    – ap21
    Mar 1, 2021 at 11:59
1
$\begingroup$

I got the desired results using Ulrich Neumann's answer, and Algohi's answer in How can I add labels to the points in my scatterplot?

I mesh the Graphics3D object, get its coordinates, plot a 3d scatter plot using ListPointPlot3D, and use Tooltip to display its coordinates:

pic = DiscretizeGraphics[ Graphics3D[Sphere[]]]
coords=pic["Coordinates"]
ListPointPlot3D[MapThread[Tooltip, {coords, coords}]]

Show[%, pic]

So, for example, for a sliver of a cone:

enter image description here

I get:

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.