yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #16395
Re: [Question #661471]: Find particle id given its position
Question #661471 on Yade changed:
https://answers.launchpad.net/yade/+question/661471
Status: Open => Answered
Jan Stránský proposed the following answer:
Hi George
> is there the possibility to find a particle id given its position
efficiently?
###
reqPos = Vector3(1,1,1)
for b in O.bodies:
if isinstance(b.shape,Sphere):
if b.state.pos == reqPos: # here
print b.id,b.state.pos[0],b.state.pos[1],b.state.pos[2]
###
could help a bit.
Rewriting the code to C++ will also decrease the needed time.
> is it possible to access the particle position knowing only the
particle id?
O.bodies[id].state.pos
O.bodies[id].whatever # for not only position
cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.