← Back to team overview

yade-users team mailing list archive

Questions on ScGeom


Hi everyone,

I've been looking at ScGeom, and I'm puzzled about the boolean "isNew".    Has "isNew" been used correctly when assigning prevNormal?  In the following, "c" is "interaction".   If c->interactionGeometry is true, it would mean that interactionGeometry has already existed?  Wouldn't c->interactionGeometry mean isOld?

bool isNew=c->interactionGeometry;
        if(c->interactionGeometry) scm=YADE_PTR_CAST<ScGeom>(c->interactionGeometry);
        else { scm=shared_ptr<ScGeom>(new ScGeom()); c->interactionGeometry=scm; }

        Real penetrationDepth=s1->radius+s2->radius-normal.Normalize(); /* Normalize() works in-place and returns length before normalization; from here, normal is unit vector */
        #ifdef SCG_SHEAR
            if(isNew) scm->prevNormal=normal; 
            else scm->prevNormal=scm->normal;


Windows 7: Simplify what you do everyday. Find the right PC for you.

Follow ups