| 139 | } |
| 140 | |
| 141 | void BoundingSphere::FromBox(const BoundingBox& box, BoundingSphere& result) |
| 142 | { |
| 143 | if (box.Minimum.IsNanOrInfinity() || box.Maximum.IsNanOrInfinity()) |
| 144 | { |
| 145 | result = Empty; |
| 146 | return; |
| 147 | } |
| 148 | const Real x = box.Maximum.X - box.Minimum.X; |
| 149 | const Real y = box.Maximum.Y - box.Minimum.Y; |
| 150 | const Real z = box.Maximum.Z - box.Minimum.Z; |
| 151 | result.Center.X = box.Minimum.X + x * 0.5f; |
| 152 | result.Center.Y = box.Minimum.Y + y * 0.5f; |
| 153 | result.Center.Z = box.Minimum.Z + z * 0.5f; |
| 154 | result.Radius = Math::Sqrt(x * x + y * y + z * z) * 0.5f; |
| 155 | } |
| 156 | |
| 157 | void BoundingSphere::Merge(const BoundingSphere& value1, const BoundingSphere& value2, BoundingSphere& result) |
| 158 | { |
no test coverage detected