Question about utils.tetraPoly

Asked by MikeZhao

Hi there,
Recently I have been looking into Yade's tetra element. There is a question concerning me:

In yade, I first added a tetraPoly:
    O.bodies.append(utils.tetraPoly([[0,0,0],[1,0,0],[0,1,0],[0,0,1]]))
And I looked its details:
O.bodies[0].shape.v
It returned:
[Vector3(-0.7071067811865476,-0.408248290463863,-0.14433756729740643),
 Vector3(2.7755575615628914e-17,0,0.43301270189221935),
 Vector3(-2.220446049250313e-16,0.8164965809277261,-0.14433756729740646),
 Vector3(0.7071067811865477,-0.40824829046386313,-0.14433756729740652)]
At first I thought it might be a local coordinates, however the center of this tetra was:
Vector3(0.25,0.25,0.25)
So I want to know how is tetra.shape.v calculated and how to change it into the normal global coordinates?

Question information

Language:
English Edit question
Status:
Solved
For:
Yade Edit question
Assignee:
No assignee Edit question
Solved by:
MikeZhao
Solved:
Last query:
Last reply:
Revision history for this message
Jan Stránský (honzik) said :
#1

Hi Yang,

the Pylyhedra.shape.v are in local coordinate system, i.e. in coordinate
system with axes being principal axes of inertia and origin in the center
of mass. To get global coordinates, do something like

#################
O.bodies.append(utils.tetraPoly([[0,0,0],[1,0,0],[0,1,0],[0,0,1]]))
b = O.bodies[0]
s = b.state
glob = [s.pos + s.ori*v for v in b.shape.v]
glob
#################

with some rounding errors it gives the original coordinates (not in
original order :-)

cheers
Jan

2015-11-28 10:27 GMT+01:00 MikeZhao <email address hidden>:

> New question #275838 on Yade:
> https://answers.launchpad.net/yade/+question/275838
>
> Hi there,
> Recently I have been looking into Yade's tetra element. There is a
> question concerning me:
>
> In yade, I first added a tetraPoly:
> O.bodies.append(utils.tetraPoly([[0,0,0],[1,0,0],[0,1,0],[0,0,1]]))
> And I looked its details:
> O.bodies[0].shape.v
> It returned:
> [Vector3(-0.7071067811865476,-0.408248290463863,-0.14433756729740643),
> Vector3(2.7755575615628914e-17,0,0.43301270189221935),
> Vector3(-2.220446049250313e-16,0.8164965809277261,-0.14433756729740646),
> Vector3(0.7071067811865477,-0.40824829046386313,-0.14433756729740652)]
> At first I thought it might be a local coordinates, however the center of
> this tetra was:
> Vector3(0.25,0.25,0.25)
> So I want to know how is tetra.shape.v calculated and how to change it
> into the normal global coordinates?
>
>
>
> --
> You received this question notification because your team yade-users is
> an answer contact for Yade.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-users
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-users
> More help : https://help.launchpad.net/ListHelp
>

Revision history for this message
MikeZhao (zhaoyang12) said :
#2

Now I get it. Thanks for your explanation:-)