| 124 | } |
| 125 | |
| 126 | Vector3 GeneratePointInSphere(const BoundingSphere& sphere) |
| 127 | { |
| 128 | // Use rejection sampling method. |
| 129 | auto relPoint = Vector3::Zero; |
| 130 | do |
| 131 | { |
| 132 | relPoint = Vector3( |
| 133 | GenerateFloat(-1.0f, 1.0f), |
| 134 | GenerateFloat(-1.0f, 1.0f), |
| 135 | GenerateFloat(-1.0f, 1.0f)); |
| 136 | } |
| 137 | while (relPoint.LengthSquared() > 1.0f); |
| 138 | |
| 139 | return (sphere.Center + (relPoint * sphere.Radius)); |
| 140 | } |
| 141 | |
| 142 | Vector3 GeneratePointOnSphere(const BoundingSphere& sphere) |
| 143 | { |
no test coverage detected