Returns a random vector of unit size.
| 130 | /// Returns a random vector of unit size. |
| 131 | /// </summary> |
| 132 | Float3 GetUnitVector() const |
| 133 | { |
| 134 | Float3 result; |
| 135 | float l; |
| 136 | do |
| 137 | { |
| 138 | result.X = GetFraction() * 2.0f - 1.0f; |
| 139 | result.Y = GetFraction() * 2.0f - 1.0f; |
| 140 | result.Z = GetFraction() * 2.0f - 1.0f; |
| 141 | l = result.LengthSquared(); |
| 142 | } while (l > 1.0f || l < ZeroTolerance); |
| 143 | return Float3::Normalize(result); |
| 144 | } |
| 145 | |
| 146 | /// <summary> |
| 147 | /// Gets a random <see cref="Vector3"/> with components in a range between [0;1]. |
nothing calls this directly
no test coverage detected