diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-03-09 21:49:43 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-03-09 21:49:43 +0800 |
| commit | 7aa2a67d8381c9a88d69a3f53d74a7f079214263 (patch) | |
| tree | de149b622a960ffc42bfce1d6a37a81ea3a493a2 /vec3.h | |
| parent | 2a65ece16cd237d56c9dac8d9d3d680e9d34b774 (diff) | |
| download | ray-tracing-7aa2a67d8381c9a88d69a3f53d74a7f079214263.tar.gz ray-tracing-7aa2a67d8381c9a88d69a3f53d74a7f079214263.tar.xz | |
Establish a well-structured modern C++ project architecture
Focus on code quality: Treat strict warnings as errors, memory checks with Sanitizers, Clang formatting and static analysis
Performance optimization: LTO, ccache
Diffstat (limited to 'vec3.h')
| -rw-r--r-- | vec3.h | 41 |
1 files changed, 0 insertions, 41 deletions
@@ -1,41 +0,0 @@ -#ifndef VEC_3 -#define VEC_3 - -#include <cmath> -#include <iostream> - -class vec3{ - public: - double e[3]; - - vec3() : e{0, 0, 0} {} - vec3(double e0, double e1, double e2) : e{e0, e1, e2} {} - - double x() const; - double y() const; - double z() const; - - vec3 operator-() const; - double operator[](int i) const; - double &operator[](int i); - vec3& operator+=(const vec3 & other); - vec3& operator*=(double t); - vec3& operator/=(double t); - double length() const; - double length_squared() const; - - -}; - -inline std::ostream &operator<<(std::ostream &out, const vec3 &v); -inline vec3 operator+(const vec3 &u, const vec3 &v); -inline vec3 operator-(const vec3 &u, const vec3 &v); -inline vec3 operator*(const vec3 &u, const vec3 &v); -inline vec3 operator*(double t, const vec3 &v); -inline vec3 operator*(const vec3 &v, double t); -inline vec3 operator/(const vec3 &v, double t); -inline double dot(const vec3 &u, const vec3 &v); -inline vec3 cross(const vec3 &u, const vec3 &v); -inline vec3 unit_vector(const vec3 &v); - -#endif |
