src/types/boundingbox.cpp

changeset 23
3387a84ddaba
parent 22
6da867fa5429
child 33
4c41bfe2ec6e
equal deleted inserted replaced
22:6da867fa5429 23:3387a84ddaba
39 */ 39 */
40 double longestMeasure(const BoundingBox& box) 40 double longestMeasure(const BoundingBox& box)
41 { 41 {
42 if (box != emptyBoundingBox) 42 if (box != emptyBoundingBox)
43 { 43 {
44 double dx = box.minimum.x - box.maximum.x; 44 const double dx = std::abs(box.minimum.x - box.maximum.x);
45 double dy = box.minimum.y - box.maximum.y; 45 const double dy = std::abs(box.minimum.y - box.maximum.y);
46 double dz = box.minimum.z - box.maximum.z; 46 const double dz = std::abs(box.minimum.z - box.maximum.z);
47 double size = std::max(std::max(dx, dy), dz); 47 const double size = std::max(std::max(dx, dy), dz);
48 return std::max(std::abs(size / 2.0), 1.0); 48 return std::max(size / 2.0, 1.0);
49 } 49 }
50 else 50 else
51 { 51 {
52 return 0.0; 52 return 0.0;
53 } 53 }

mercurial