MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / Camera

Method Camera

examples/pde/bhrt.cpp:642–659  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

640 double aspect_ratio;
641
642 Camera(const af::array& position_, const af::array& lookat_, double fov_,
643 double focal_length_, uint32_t viewport_width_,
644 uint32_t viewport_height_)
645 : position(position_)
646 , lookat(lookat_)
647 , fov(fov_)
648 , focal_length(focal_length_)
649 , width(viewport_width_)
650 , height(viewport_height_) {
651 auto global_vertical = af::array(3, {0.0, 0.0, 1.0});
652
653 // Compute the camera three main axes
654 direction = normalize3(lookat - position);
655 horizontal = normalize3(cross_product(direction, global_vertical));
656 vertical = normalize3(cross_product(direction, horizontal));
657
658 aspect_ratio = (double)width / (double)height;
659 }
660
661 /**
662 * @brief Generates the initial rays 4-vector position and velocities

Callers

nothing calls this directly

Calls 3

normalize3Function · 0.85
cross_productFunction · 0.85
arrayClass · 0.50

Tested by

no test coverage detected