* give the vector v a spherical coordinate system(rho, theta, phi) view. * http://en.wikipedia.org/wiki/Spherical_coordinate_system * r ≥ 0, 0° ≤ θ ≤ 180° (π rad), 0° ≤ φ < 360° (2π rad) * However, the azimuth φ is often restricted to the interval (−180°, +180°], * or (−π, +π] in radians, instead of [0, 360°). This is the standard * convention for geographic longitude. * * @return ve
| 121 | */ |
| 122 | //FIXME |
| 123 | vec3<T> polar() const |
| 124 | { |
| 125 | T _rho = length(), _theta = 0, _phi = 0; |
| 126 | if(!isZero<T>(_rho)) |
| 127 | { |
| 128 | _theta = std::acos(z/rho); |
| 129 | // _theta == 0 means vector parallel to y axis in OpenGL |
| 130 | _phi = (isZero<T>(theta))? 0 : std::atan2(y, x); |
| 131 | } |
| 132 | return vec3<T>(_rho, _theta, _phi); |
| 133 | } |
| 134 | |
| 135 | vec3<T> project(vec3<T>& direction, bool normalized = false) const |
| 136 | { |
nothing calls this directly
no outgoing calls
no test coverage detected