← Back to team overview

yade-users team mailing list archive

Re: [Question #275838]: Question about utils.tetraPoly

 

Question #275838 on Yade changed:
https://answers.launchpad.net/yade/+question/275838

    Status: Open => Answered

Jan Stránský proposed the following answer:
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 <question275838@xxxxxxxxxxxxxxxxxxxxx>:

> 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     : yade-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~yade-users
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because your team yade-users is
an answer contact for Yade.