summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-04-12 10:44:00 +0800
committerKeuin <[email protected]>2022-04-12 10:44:00 +0800
commite83da6c36b39e6f8de35fc7e1c3caf8041cfe325 (patch)
treea44063f61168465e411a6b0cde6f3d220f39b226
parent78a65f44df3d0109eddb2d6835adda0ed4d36859 (diff)
Add comments in class ray3.
-rw-r--r--ray.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/ray.h b/ray.h
index 3281c6e..5a68557 100644
--- a/ray.h
+++ b/ray.h
@@ -17,14 +17,17 @@ public:
ray3() = delete;
ray3(const vec3<T> &source, const vec3<T> &direction) : source_(source), direction_(direction.unit_vec()) {}
+ // Get the source point from where the ray emits.
vec3<T> source() const {
return source_;
}
+ // Get the unit vector along the ray's direction.
vec3<T> direction() const {
return direction_;
}
+ // Compute the point this ray reaches at the time `t`.
template<typename U>
vec3<T> at(U t) const {
return source_ + direction_ * t;