|
Orrery
A GPU-accelerated N-body gravitational simulator
|
A vector in three-dimensional Euclidean space. More...
#include <orrery/core/vec3.hpp>
Public Member Functions | |
| constexpr Vec3 & | operator+= (Vec3 other) noexcept |
| constexpr Vec3 & | operator-= (Vec3 other) noexcept |
| constexpr Vec3 & | operator*= (Real scale) noexcept |
| constexpr Vec3 & | operator/= (Real divisor) noexcept |
| constexpr bool | operator== (const Vec3 &other) const =default |
| Exact component-wise equality. | |
Public Attributes | |
| Real | x {} |
| Real | y {} |
| Real | z {} |
A vector in three-dimensional Euclidean space.
An aggregate with public members, because it is data. Wrapping three coordinates in accessors would buy no invariant, since every combination of three finite numbers is a valid vector, and would obstruct the aggregate initialisation that makes analytic test configurations readable.
|
nodiscardconstexprdefault |
Exact component-wise equality.
This answers whether two vectors are the same value, which is the question storage round-trip tests ask. It is not the question physics asks: a comparison between a computed result and an expected one is a comparison against a tolerance, stated at the point of comparison where the reader can see what accuracy is being claimed.