Ignore:
Timestamp:
05/07/14 20:41:18 (6 years ago)
Author:
Maciej Komosinski
Message:

Added caching of geometry properties (which are costly to compute)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/model/geometry/modelgeoclass.h

    r235 r242  
    44#include <frams/model/modelobj.h>
    55
    6 class ModelGeometry: public DestrBase
     6class ModelGeometry : public DestrBase
    77{
    8   public:
    9 ModelObj *model;
    10 double density;
    11 Param par;
     8public:
     9        ModelObj *model;
     10        double density;
    1211
    13 ModelGeometry(ModelObj *mo=NULL);
    14 ~ModelGeometry();
     12        //"cached" fields let avoid redundant computations when asking for the same properties of the same model at the same density
     13        double cached_for_density;
     14        double cached_volume, cached_area;
     15        Pt3D cached_sizes; Orient cached_axes;
     16
     17        Param par;
     18
     19        ModelGeometry(ModelObj *mo = NULL);
     20        ~ModelGeometry();
     21
     22        void invalidateAllCached();
     23        void onDensityChanged();
    1524
    1625#define STATRICKCLASS ModelGeometry
    17 PARAMPROCDEF(p_formodel);
    18 PARAMPROCDEF(p_volume);
    19 PARAMPROCDEF(p_area);
    20 PARAMPROCDEF(p_sizesandaxes);
     26        PARAMPROCDEF(p_formodel);
     27        PARAMPROCDEF(p_volume);
     28        PARAMPROCDEF(p_area);
     29        PARAMPROCDEF(p_sizesandaxes);
    2130#undef STATRICKCLASS
    2231
    23 static ExtObject makeDynamicObject(ModelGeometry* mg);
     32        static ExtObject makeDynamicObject(ModelGeometry* mg);
    2433};
    2534
Note: See TracChangeset for help on using the changeset viewer.