how to get vertex coordinate of polyhedra created by function polyhedra_utils.fillBox()

Asked by lip

hello
i have created many polyhedra by function polyhedra_utils.fillBox, i want to know how to obtain the vertex coordinates of any polyhedron.
lookforward for your answer.

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
lip
Solved:
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :
#1
Revision history for this message
lip (mr.xie) said :
#2

thank you for your answer.i think it may work, but i have not tried it yet for i do not know what does the argument shape mean.I just want to get the vertex coordinates of one of the polyhedrons according to its id,not all the polyhedras.
by the way, if i want to get the volume of a polyhedra, is there any way to achieve that?

Revision history for this message
Robert Caulk (rcaulk) said :
#3

Did you try b.shape, where b is the polyhedra?

Revision history for this message
lip (mr.xie) said :
#4

dear Robert:
     i have tried b.shape, and the problem solved. but i still have a problem of how to get the vertex of polyhedra for i do not know what does the argument shape mean, if i just want to get the vertex coordinates of one of the polyhedrons,can i achive that according to its id?

Revision history for this message
Robert Caulk (rcaulk) said :
#5

I think it would be easier to help you if you provided an MWE and the error [1].

[1]https://www.yade-dem.org/wiki/Howtoask

Revision history for this message
lip (mr.xie) said :
#6

i am sorry for i did not make my question clear. my question is that:
if i created a polyhedra by function polyhedra_utils.polyhedra like that:
polyhedra_utils.polyhedra(material=m,size=(0.4,0.4,0.8),seed=1)
what should i do to get the vertex of the polyhedra?
lookforward for your answer

Revision history for this message
Robert Caulk (rcaulk) said :
#7

To be honest, I do not know. I am just trying to guide you through the documentation. I'm happy to dive into it with you if you provide an MWE and an error.

I would try using b.shape as the argument of PrintPolyhedra if I were you.

Revision history for this message
lip (mr.xie) said :
#8

dear Robert:
      i have tried function _polyhedra_utils.PrintPolyhedra

Revision history for this message
Robert Caulk (rcaulk) said :
#9

Hello Lip,

If the problem is solved, please mark the answer that solved it or indicate how it is solved so people in the future can (attempt to) benefit from this thread.

Thank you,

Robert

Revision history for this message
Jan Stránský (honzik) said :
#10

Hello,
sorry for late answer..

> what does the argument shape mean

b.shape

> get the volume of a polyhedra

b.shape.GetVolume() [1]

> can i achive that according to its id?

b = O.bodies[id]

> how to obtain the vertex coordinates of any polyhedron.

transform the polyedron's local coordinates to globals using b.state.pos and b.state.ori:
###
vsLocal = b.shape.v # [2], vertices in Polyhedron's coordinate system
vsGlobal = [b.state.pos + b.state.ori*v for v in vsLocal] # vertices in global coordinate system
###

cheers
Jan

[1] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Polyhedra.GetVolume
[2] https://yade-dem.org/doc/yade.wrapper.html#yade.wrapper.Polyhedra.v