Changeset 658


Ignore:
Timestamp:
04/24/17 03:14:21 (7 years ago)
Author:
Maciej Komosinski
Message:
  • One function name made shorter
  • Fixed some typos
  • Predictable behavior for empty (zero-Part) Models (that should never happen)
Location:
cpp/frams
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/geometry/info_test.cpp

    r534 r658  
    3030        Orient axes;
    3131        // Calculating approximate sizes and axes of model. These values are calculated together because
    32         // they depends on each other. Sizes are distances between furthest points on model surface
     32        // they depend on each other. Sizes are distances between furthest points on model surface
    3333        // measured along corresponding axes. Fields sizes.x and axes.x describes the 'length' of 3D
    3434        // model. Fields sizes.y and axes.y desctibes 'width' of 2D model created by projecting original
     
    3737        // points created for each unit of length. It means, that for each square unit of surface area
    3838        // of parts of model, at least density^2 points will be created.
    39         ModelGeometryInfo::findSizesAndAxesOfModel(model, density, sizes, axes);
     39        ModelGeometryInfo::findSizesAndAxes(model, density, sizes, axes);
    4040       
    4141       
    4242        // Creating output variables.
    4343        Pt3D lowerBoundary, upperBoundary;
    44         // Calculationg bounding box of model. Result is stored in variables lowerBoundary and
     44        // Calculating bounding box of model. Result is stored in variables lowerBoundary and
    4545        // upperBoundary.
    4646        ModelGeometryInfo::boundingBox(model, lowerBoundary, upperBoundary);
  • cpp/frams/model/geometry/geometryutils.cpp

    r375 r658  
    99double GeometryUtils::pointPosition(const int pointIndex, const int numberOfPoints)
    1010{
    11         return pointIndex / (numberOfPoints-1.0);
     11        if (numberOfPoints == 1)
     12                return 0;
     13        else
     14                return pointIndex / (numberOfPoints-1.0);
    1215}
    1316
  • cpp/frams/model/geometry/modelgeoclass.cpp

    r548 r658  
    102102        onDensityChanged();
    103103        if (cached_sizes.x < 0) //calculate if invalid
    104                 ModelGeometryInfo::findSizesAndAxesOfModel(*model, density, cached_sizes, cached_axes);
     104                ModelGeometryInfo::findSizesAndAxes(*model, density, cached_sizes, cached_axes);
    105105
    106106        VectorObject* n = new VectorObject;
  • cpp/frams/model/geometry/modelgeometryinfo.cpp

    r546 r658  
    77#include <frams/model/geometry/meshbuilder.h>
    88
    9 void ModelGeometryInfo::findSizesAndAxesOfModel(const Model &input_model, const double density,
     9void ModelGeometryInfo::findSizesAndAxes(const Model &input_model, const double density,
    1010        Pt3D &sizes, Orient &axes)
    1111{
     
    2525}
    2626
    27 bool ModelGeometryInfo::boundingBox(const Model &model, Pt3D &lowerBoundary, Pt3D &upperBoundary)
     27void ModelGeometryInfo::boundingBox(const Model &model, Pt3D &lowerBoundary, Pt3D &upperBoundary)
    2828{
    29         if (model.getPartCount() == 0)
     29        if (model.getPartCount() == 0) //should never happen. Invalid model provided?
    3030        {
    31                 return false;
     31                lowerBoundary = Pt3D_0;
     32                upperBoundary = Pt3D_0;
     33                return;
    3234        }
    3335       
     
    4244                upperBoundary.getMax(partUpperBoundary);
    4345        }
    44        
    45         return true;
    4646}
    4747
Note: See TracChangeset for help on using the changeset viewer.