yade-users team mailing list archive
-
yade-users team
-
Mailing list archive
-
Message #25704
Re: [Question #697363]: force and identify
Question #697363 on Yade changed:
https://answers.launchpad.net/yade/+question/697363
Status: Open => Answered
Jan Stránský proposed the following answer:
Hello,
> 1 + 3
still, please be more specific. What is "the exterior"? Particles
forming a convex hull? Particles close enough to the trimming sphere
surface? ... ? Is more important center of particles? Or their surface?
... ?
The solution is as easy as:
###
exterior = [b for b in O.bodies if isExterior(b)]
for b in exterior:
O.forces.setPermF(b.id,someForce) # or addF
###
isExterior is a function depending on your needs. E.g. the most primitive could be:
###
limitDistance = 1.23
center = Vector3(1,2,3)
def distance(v1,v2):
return (v1-v2).norm()
def isExterior(b):
return distance(b.state.pos,center) < limitDistance
###
> 2...
efficiency w.r.t. code writing and efficiency w.r.t. performance are
often contradicting requirements...
Cheers
Jan
--
You received this question notification because your team yade-users is
an answer contact for Yade.