New question #681246 on Yade:
https://answers.launchpad.net/yade/+question/681246

hello
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();
                interaction->geom=geom;
        } 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;
        
geom->contactPoint=se31.position+(radius1-0.5*penetrationDepth)*normal;//0.5*(pt1+pt2);
        geom->penetrationDepth=penetrationDepth;
        scene = Omega::instance().getScene().get();
        
geom->precompute(state1,state2,scene,interaction,normal,isNew,shift2,false);
        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.

-- 
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

Reply via email to