18 x(svec.length * std::cos(svec.azimuth) * std::cos(svec.elevation)),
19 y(svec.length * std::sin(svec.azimuth) * std::cos(svec.elevation)), z(svec.length * std::sin(svec.elevation))
50 const Vec3 v(x, y, z);
51 x = mat[0] * v.
x + mat[1] * v.
y + mat[2] * v.
z;
52 y = mat[3] * v.
x + mat[4] * v.
y + mat[5] * v.
z;
53 z = mat[6] * v.
x + mat[7] * v.
y + mat[8] * v.
z;
75 elevation = std::asin(vec.z / length);
76 azimuth = std::atan2(vec.y, vec.x);
93 RealType new_azimuth = fmod(a.azimuth + b.azimuth, 2 *
PI);
96 new_azimuth += 2 *
PI;
98 RealType new_elevation = fmod(a.elevation + b.elevation,
PI);
99 return {a.length + b.length, new_azimuth, new_elevation};
104 RealType new_azimuth = a.azimuth - b.azimuth;
108 while (new_azimuth <= -
PI)
109 new_azimuth += 2 *
PI;
110 while (new_azimuth >
PI)
111 new_azimuth -= 2 *
PI;
115 RealType new_elevation = fmod(a.elevation - b.elevation,
PI);
116 return {a.length - b.length, new_azimuth, new_elevation};
A class representing a 3x3 matrix.
A class representing a vector in spherical coordinates.
SVec3 & operator/=(RealType b) noexcept
Scalar division assignment for SVec3.
SVec3 & operator*=(RealType b) noexcept
Scalar multiplication assignment for SVec3.
A class representing a vector in rectangular coordinates.
RealType x
The x component of the vector.
RealType z
The z component of the vector.
Vec3 & operator-=(const Vec3 &b) noexcept
Subtraction assignment operator for Vec3.
RealType y
The y component of the vector.
Vec3 & operator+=(const Vec3 &b) noexcept
Addition assignment operator for Vec3.
Vec3 & operator/=(RealType b) noexcept
Scalar division assignment for Vec3.
Vec3 & operator*=(const Vec3 &b) noexcept
Multiplication assignment operator for Vec3.
double RealType
Type for real numbers.
constexpr RealType PI
Mathematical constant π (pi).
Classes and operations for 3D geometry.
Coord operator+(const Coord &a, const Coord &b) noexcept
Adds two Coord objects' positions and copies the time.
Coord operator-(const Coord &a, const Coord &b) noexcept
Subtracts two Coord objects' positions and copies the time.