Orrery
A GPU-accelerated N-body gravitational simulator
Loading...
Searching...
No Matches
orrery::core::Vec3 Struct Reference

A vector in three-dimensional Euclidean space. More...

#include <orrery/core/vec3.hpp>

Public Member Functions

constexpr Vec3operator+= (Vec3 other) noexcept
constexpr Vec3operator-= (Vec3 other) noexcept
constexpr Vec3operator*= (Real scale) noexcept
constexpr Vec3operator/= (Real divisor) noexcept
constexpr bool operator== (const Vec3 &other) const =default
 Exact component-wise equality.

Public Attributes

Real x {}
Real y {}
Real z {}

Detailed Description

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.

Member Function Documentation

◆ operator==()

bool orrery::core::Vec3::operator== ( const Vec3 & other) const
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.


The documentation for this struct was generated from the following file: