Changeset 1056 for cpp/frams/model
- Timestamp:
- 12/28/20 02:06:52 (4 years ago)
- Location:
- cpp/frams/model/geometry
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/model/geometry/geometryutils.cpp
r1045 r1056 369 369 } 370 370 371 double GeometryUtils::calculateSolidVolume( Part * part)371 double GeometryUtils::calculateSolidVolume(const Part * part) 372 372 { 373 373 double radiiProduct = part->scale.x * part->scale.y * part->scale.z; … … 386 386 } 387 387 388 bool GeometryUtils::isSolidPartScaleValid(const Part::Shape &partShape, const Pt3D &scale )388 bool GeometryUtils::isSolidPartScaleValid(const Part::Shape &partShape, const Pt3D &scale, bool ensureCircleSection) 389 389 { 390 390 Part *tmpPart = new Part(partShape); … … 402 402 return false; 403 403 404 if (partShape == Part::Shape::SHAPE_ELLIPSOID && scale.maxComponentValue() != scale.minComponentValue()) // When any radius has a different value than the others 405 return false; 406 if (partShape == Part::Shape::SHAPE_CYLINDER && scale.y != scale.z) // If base radii have different values 407 return false; 404 if (ensureCircleSection) 405 { 406 if (partShape == Part::Shape::SHAPE_ELLIPSOID && scale.maxComponentValue() != scale.minComponentValue()) // Any radius has a different value than the other ones? 407 return false; 408 if (partShape == Part::Shape::SHAPE_CYLINDER && scale.y != scale.z) // Base radii have different values? 409 return false; 410 } 408 411 return true; 409 412 } -
cpp/frams/model/geometry/geometryutils.h
r1045 r1056 178 178 double ellipsePerimeter(const double a, const double b); 179 179 180 double calculateSolidVolume( Part *part);181 bool isSolidPartScaleValid(const Part::Shape &partShape, const Pt3D &scale );180 double calculateSolidVolume(const Part *part); 181 bool isSolidPartScaleValid(const Part::Shape &partShape, const Pt3D &scale, bool ensureCircleSection); 182 182 183 183 /** -
cpp/frams/model/geometry/part_distance_estimator.h
r1032 r1056 7 7 8 8 #include "frams/model/geometry/meshbuilder.h" 9 #include <cmath> 9 10 10 11 class PartDistanceEstimator … … 54 55 static double calculateDistance(Part tmpPart1, Part tmpPart2, double distanceTolerance, double relativeDensity) 55 56 { 56 /// tmpPart1 and tmpPart2 are copied for purpose and should not be passed as reference 57 /// This function can change some of the properties of those parts 57 /// tmpPart1 and tmpPart2 are copied for purpose and should not be passed as reference. 58 /// This function can change some of the properties of those parts. 58 59 /// tmpPart1 will be approximated by surface points. 59 /// The collision between the parts is detected when any of th ose points is inside tmpPart260 /// If tmpPart1 and tmpPart2 are swapped, the calculated distance may slightly differ 60 /// The collision between the parts is detected when any of these points is inside tmpPart2. 61 /// If tmpPart1 and tmpPart2 are swapped, the calculated distance may slightly differ. 61 62 Pt3D directionVersor = tmpPart1.p - tmpPart2.p; 62 63 directionVersor.normalize();
Note: See TracChangeset
for help on using the changeset viewer.