9#include "components/color.hpp"
10#include "components/position3d.hpp"
14 constexpr float PI = 3.14159265358979323846264338327950288f;
15 constexpr float TAU = 6.28318530717958647692528676655900577f;
18 inline float bounce_lerp(
float a,
float b,
float t) {
19 auto tf = t - floorf(t);
20 if (
static_cast<int32_t
>(t) % 2 == 0) {
21 return (1.0f - tf) * a + tf * b;
23 return tf * a + (1.0f - tf) * b;
30 inline std::vector<T> linspace(T start, T end,
size_t num) {
31 std::vector<T> linspaced(num);
32 std::generate(linspaced.begin(), linspaced.end(), [&, i = 0]()
mutable {
33 return static_cast<T>(
34 start + static_cast<T>(i++) * (end - start) / static_cast<T>(num - 1)
42 template <
typename T,
typename Elem>
43 std::vector<T> grid3d(Elem from, Elem to,
size_t n) {
44 std::vector<T> output;
45 for (Elem z : linspace(from, to, n)) {
46 for (Elem y : linspace(from, to, n)) {
47 for (Elem x : linspace(from, to, n)) {
67 size_t num_points,
float radius,
float angular_step,
float angular_offset,
float z_step,
68 std::vector<components::Position3D>& out_points,
69 std::vector<components::Color>& out_colors
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:17