New question #690262 on Yade: https://answers.launchpad.net/yade/+question/690262
Hi All, last time I asked the question in this post:https://answers.launchpad.net/yade/+question/690079 one answer for the local bodies is we can use the following code: ### The same for interactions (e.g. based on their contactPoint): ### predicate = pack.inAlignedBox(...) localIntrs = [i for i in O.interactions if predicate(i.geom.contactPoint)] ################# I did the same way, here is my code: def local_interaction(): predicate = pack.inAlignedBox((0.1,0.1,0.1),(0.15,0.15,0.15)) #predicate = pack.inSphere((0.2,0.2,0.1), 0.1) localintrs = [i for i in O.interactions if predicate(i.geom.contactPoint)] for i in localintrs: constnormal1 = i.geom.normal[0] constnormal2 = i.geom.normal[1] constnormal3 = i.geom.normal[2] print('this is contact normal 1:',constnormal1) print('this is contact normal 2:',constnormal2) print('this is contact normal 3:',constnormal3) ###############but I got the error: In [1]: --------------------------------------------------------------------------- ArgumentError Traceback (most recent call last) /usr/bin/yade in <module>() /usr/bin/yade in local_interaction() 40 predicate = pack.inAlignedBox((0.1,0.1,0.1),(0.15,0.15,0.15)) 41 #predicate = pack.inSphere((0.2,0.2,0.1), 0.1) ---> 42 localintrs = [i for i in O.interactions if predicate(i.geom.contactPoint)] 43 for i in localintrs: 44 constnormal1 = i.geom.normal[0] ArgumentError: Python argument types in Predicate.__call__(inAlignedBox, Vector3) did not match C++ signature: __call__(PredicateWrap {lvalue}, Eigen::Matrix<double, 3, 1, 0, 3, 1>, double) __call__(Predicate {lvalue}, Eigen::Matrix<double, 3, 1, 0, 3, 1>, double) ############### sorry, I don't know the error, but i know it's related to line 42 "if predicate(i.geom.contactPoint)]-------------here" it seems i need to add something here. ###################### if we use another code post at that question. ### predicate = pack.inAlignedBox(...) # or other instance or combination of several predicates localBodies = [b for b in O.bodies if predicate(b.state.pos,b.shape.radius)] ### these code didn't give me error. but if i change here----------------if predicate(b.state.pos,b.shape.radius)]------to-------if predicate(b.state.pos)], it will give me the same error. for these code, i think we need the position as well as the radius to identify one sphere, so we need:b.state.pos,b.shape.radius. but for an interaction point, why we can't just use i.geom.contactPoint to determine the contact point is in this predicate or not? overall, I think my question is how to use the predicate to determine whether a contact point is in this predicate or not? thanks Yong -- 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 protected] Unsubscribe : https://launchpad.net/~yade-users More help : https://help.launchpad.net/ListHelp

