Changeset 1111 for cpp/frams/model/geometry/modelgeoclass.cpp
- Timestamp:
- 03/16/21 23:59:15 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/geometry/modelgeoclass.cpp
r999 r1111 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 16Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2021 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 11 11 static ParamEntry modelgeo_paramtab[] = 12 12 { 13 { "Creature: Geometry", 1, 5, "ModelGeometry",13 { "Creature: Geometry", 1, 6, "ModelGeometry", 14 14 "Approximately estimates sizes, volume, and area of a Model based on the geometry of its parts.\n" 15 15 "Example usage:\n" … … 22 22 { "volume", 0, PARAM_NOSTATIC | PARAM_USERHIDDEN, "volume", "p f()", PROCEDURE(p_volume), }, 23 23 { "area", 0, PARAM_NOSTATIC | PARAM_USERHIDDEN, "area", "p f()", PROCEDURE(p_area), }, 24 { "voxels", 0, PARAM_NOSTATIC | PARAM_USERHIDDEN, "voxels", "p oVector()", PROCEDURE(p_voxels), }, 24 25 { "sizesAndAxes", 0, PARAM_NOSTATIC | PARAM_USERHIDDEN, "sizesAndAxes", "p oVector()", PROCEDURE(p_sizesandaxes), "The returned vector contains XYZ (sizes) and Orient (axes) objects." }, 25 26 { 0, 0, 0, }, … … 33 34 34 35 ModelGeometry::ModelGeometry(ModelObj *mo) 35 :par(modelgeo_paramtab, this)36 :par(modelgeo_paramtab, this) 36 37 { 37 38 cached_for_density = -1; //invalid value, will be updated on first request … … 56 57 cached_area = -1; 57 58 cached_sizes.x = -1; 59 cached_voxels.setEmpty(); 58 60 } 59 61 … … 74 76 if (m != NULL) 75 77 { 76 77 78 if (m->getShapeType() == Model::SHAPETYPE_BALL_AND_STICK) 79 { 78 80 Model *converted = new Model; 79 81 converted->open(); 80 82 converted->buildUsingSolidShapeTypes(*m, Part::SHAPE_CYLINDER, 0.2); 81 83 converted->close(); 82 m =converted;83 84 m = converted; 85 } 84 86 ModelGeometry *mg = new ModelGeometry((ModelObj*)m); 85 87 mg->density = density; … … 106 108 } 107 109 110 void ModelGeometry::p_voxels(ExtValue *args, ExtValue *ret) 111 { 112 onDensityChanged(); 113 if (cached_voxels.isEmpty()) //calculate if invalid 114 cached_voxels = ModelGeometryInfo::getVoxels(*model, density); 115 ret->setObject(cached_voxels); 116 } 117 108 118 void ModelGeometry::p_sizesandaxes(ExtValue *args, ExtValue *ret) 109 119 {
Note: See TracChangeset
for help on using the changeset viewer.