← Back to team overview

yade-dev team mailing list archive

Re: removing GeometricalModel

 

>   
> Concerning the fix in Triaxial files, when I have this :
> 
> #ifdef YADE_SHAPE
>         shared_ptr<Sphere> gSphere(new Sphere);
>         gSphere->radius            = radius;
>         gSphere->diffuseColor        = spheresColor;
>         gSphere->wire            = false;
>         gSphere->shadowCaster        = true;
>         body->geometricalModel        = gSphere;
>     #endif
>    
>     iSphere->radius            = radius;
>     iSphere->diffuseColor        = 
> Vector3r(Mathr::UnitRandom(),Mathr::UnitRandom(),Mathr::UnitRandom());
> 
> 
> should it be replaced by this to get the same result? :
> 
> iSphere->wire = false
> iSphere->shadowCaster        = true;
> iSphere->radius            = radius;
> iSphere->diffuseColor        = spheresColor;

In most cases the GeometricalModel just duplicates information already
stored in InteractingGeometry (for Sphere, at least). So probably you
already do have the code already in place, and just avoiding the
#ifdef'd part should be enought.

I only added wire and diffuseColor to InteractingGeometry, right, so you
need to additionaly assign it. (I didn't add shadowCaster, as I didn't
see any use of it, sorry...).

Once you are fixing various TriaxialTests: I would suggest you make
TriaxialTest::createSphere/createBox static (and add afew params like
young's modulus), and then call TriaxialTest::createSphere(...) from all
*TriaxialTest classes. That way you will have to fix it only once. 

(There is Shop::sphere function which was meant as generic sphere
factory, but it is not that flexible due to quice awkward usage of
default parameters in the code. It could be perhaps adapted to suit your
needs here by passing all params explicitly. But I understand time is
precious and striving for perfection might do harm.)

Thanks for cooperation :-)

Vaclav




References