something do not understand about code in polyhedra_ig2.cpp

Asked by lip on 2019-06-05

below is the code i am reading:
bool Ig2_Polyhedra_Polyhedra_ScGeom::go(const shared_ptr<Shape>& shape1, const shared_ptr<Shape>& shape2, const State& state1, const State& state2, const Vector3r& shift2, const bool& force, const shared_ptr<Interaction>& interaction) {
 const Se3r& se31=state1.se3;
 const Se3r& se32=state2.se3;
 shared_ptr<ScGeom> geom;
 bool isNew = !interaction->geom;
 if (isNew) {
  Ig2_Polyhedra_Polyhedra_PolyhedraGeom ppGeom = Ig2_Polyhedra_Polyhedra_PolyhedraGeom();
  ppGeom.interactionDetectionFactor = interactionDetectionFactor;
  bool pp = ppGeom.go(shape1,shape2,state2,state1,shift2,force,interaction);
  if (!pp) {
   return false;
  shared_ptr<PolyhedraGeom> pGeom = YADE_PTR_CAST<PolyhedraGeom>(interaction->geom);
  geom = shared_ptr<ScGeom>(new ScGeom());
  geom->radius1 = (pGeom->contactPoint-se31.position).norm();
  geom->radius2 = (pGeom->contactPoint-se32.position+shift2).norm();
 } else {
  geom = YADE_PTR_CAST<ScGeom>(interaction->geom);
 const Real& radius1 = geom->radius1;
 const Real& radius2 = geom->radius2;
 Vector3r normal=(se32.position+shift2)-se31.position;
 Real norm=normal.norm(); normal/=norm; // normal is unit vector now
 Real penetrationDepth=radius1+radius2-norm;
 scene = Omega::instance().getScene().get();
 return true;
question1: what does the parameter shift2 do?
question2:what does se31.position refer to? i know that the position of sphere means the centre of it, but as to polyhedra, which point can define the position of it? Is the positon means the centroid of polyhedra or something else?
lookforward for your answer.

Question information

English Edit question
Yade Edit question
No assignee Edit question
Last query:
Last reply:
Jan Stránský (honzik) said : #1


> question1

for non-periodic simulations, it is Vector3(0,0,0)
for periodic simulations, is is shift of the second body to make the interaction meaningful

> question2

se31.position would be in python state.pos
**usually** it is the center of mass. But in general b.state.pos and b.shape.v can be quite independent.


Can you help with this problem?

Provide an answer of your own, or ask lip for more information if necessary.

To post a message you must log in.