[286] | 1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
| 2 | // Copyright (C) 1999-2015 Maciej Komosinski and Szymon Ulatowski. |
---|
| 3 | // See LICENSE.txt for details. |
---|
[191] | 4 | |
---|
| 5 | #ifndef _MODELGEOMETRYINFO_H_ |
---|
| 6 | #define _MODELGEOMETRYINFO_H_ |
---|
| 7 | |
---|
| 8 | #include <frams/model/model.h> |
---|
| 9 | #include <frams/util/3d.h> |
---|
| 10 | #include <frams/util/list.h> |
---|
| 11 | |
---|
[657] | 12 | |
---|
| 13 | /** |
---|
| 14 | Currently, the three functions area(), volume() and findSizesAndAxes() are independent and self-sufficient. |
---|
| 15 | Each of them converts the input model to SolidsShapeTypeModel if necessary. |
---|
| 16 | Were these functions to be called multiple times for the same model, this would be inefficient |
---|
| 17 | (the potential conversion of the same model would take place multiple times). |
---|
| 18 | |
---|
| 19 | To improve efficiency, these functions should not have the Model argument. |
---|
| 20 | Instead, another function should be introduced to set the model, the conversion to SolidsShapeTypeModel |
---|
| 21 | should take place in this function once, and these three functions would then always use the converted model. |
---|
| 22 | A similar optimization is already implemented in the ModelGeometry class that provides FramScript access to ModelGeometryInfo. |
---|
| 23 | */ |
---|
[191] | 24 | namespace ModelGeometryInfo |
---|
| 25 | { |
---|
[660] | 26 | double area(Model &model, const double density); |
---|
| 27 | double volume(Model &model, const double density); |
---|
| 28 | void findSizesAndAxes(Model &model, const double density, Pt3D &sizes, Orient &axes); |
---|
[657] | 29 | |
---|
| 30 | void boundingBox(const Model &model, Pt3D &lowerBoundary, Pt3D &upperBoundary); |
---|
[191] | 31 | void boundingBox(const Part *part, Pt3D &lowerBoundary, Pt3D &upperBoundary); |
---|
| 32 | double externalAreaOfPart(const Model &model, const int partIndex, const double density); |
---|
| 33 | double externalAreaOfEllipsoid(const Model &model, const int partIndex, const double density); |
---|
| 34 | double externalAreaOfCuboid(const Model &model, const int partIndex, const double density); |
---|
| 35 | double externalAreaOfCylinder(const Model &model, const int partIndex, const double density); |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | #endif |
---|