Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation, and use of non-templated type in geometryt.h #1430

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/yocto/yocto_math.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ assumed to be orthonormal and used as is, unless specifically requested as
for inverses.

For convenience, Yocto/Math provides several functions to construct transform
frames and matrices. Translation, rotation and scaling frames are created with
frames and matrices. Translation, rotation and scaling frames are created with
`translation_frame(t)`, `rotation_frame(r)` and `scaling_frame(s)`. Rotation
frames can be derived from axis-angle, quaternion and matrix representations.
To define camera frames, one can use `lookat_frame(from,to,up)`.

```cpp
auto f = tranlation_frame({1,0,0}) * rotation_frame({0,1,0},pi/2); // transform
auto f = translation_frame({1,0,0}) * rotation_frame({0,1,0},pi/2); // transform
auto lp = vec3f{1,2,3}, lv = vec3f{0,2,3}; // point and vector in local coords
auto wp = transform_point(f, lp); // point in world coords
auto wv = transform_vector(f, lv); // vector in world coords
Expand Down
8 changes: 4 additions & 4 deletions libs/yocto/yocto_geometryt.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,13 +309,13 @@ namespace yocto {

// Generate a ray from a camera
template <typename T>
inline ray<T, 3> camera_ray(const frame3f& frame, T lens, const vec<T, 2>& film,
inline ray<T, 3> camera_ray(const frame<T, 3>& frame, T lens, const vec<T, 2>& film,
const vec<T, 2>& image_uv);

// Generate a ray from a camera
template <typename T>
inline ray<T, 3> camera_ray(
const frame3f& frame, T lens, T aspect, T film, const vec<T, 2>& image_uv);
const frame<T, 3>& frame, T lens, T aspect, T film, const vec<T, 2>& image_uv);

} // namespace yocto

Expand Down Expand Up @@ -777,7 +777,7 @@ namespace yocto {

// Generate a ray from a camera
template <typename T>
inline ray<T, 3> camera_ray(const frame3f& frame, T lens, const vec<T, 2>& film,
inline ray<T, 3> camera_ray(const frame<T, 3>& frame, T lens, const vec<T, 2>& film,
const vec<T, 2>& image_uv) {
auto e = vec<T, 3>{0, 0, 0};
auto q = vec<T, 3>{
Expand All @@ -791,7 +791,7 @@ inline ray<T, 3> camera_ray(const frame3f& frame, T lens, const vec<T, 2>& film,

// Generate a ray from a camera
template <typename T>
inline ray<T, 3> camera_ray(const frame3f& frame, T lens, T aspect, T film_,
inline ray<T, 3> camera_ray(const frame<T, 3>& frame, T lens, T aspect, T film_,
const vec<T, 2>& image_uv) {
auto film = aspect >= 1 ? vec<T, 2>{film_, film_ / aspect}
: vec<T, 2>{film_ * aspect, film_};
Expand Down