Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • i should note that "input_vector" is the camera direction vector Commented Mar 5, 2025 at 6:36
  • 1
    NOTE : std::vector in C++ is NOT a mathematical vector. Do NOT use it for matrix/vector calculations. Use a math or better 3D graphics library for that. The math you need is explained in many online source. But this might get you started wrt to th e concepts you need : Maths for game development Commented Mar 5, 2025 at 8:07
  • 1
    std::vector is a C++ container, think of it as a resizable array. What you need is a struct or class that models a vector with at least an x,y and z component (and probably a homogeneous component as well). Commented Mar 5, 2025 at 8:28
  • 1
    library for linear algebra in C++: stackoverflow.com/questions/1380371/… and en.wikipedia.org/wiki/Comparison_of_linear_algebra_libraries (tldr: eigen) Commented Mar 5, 2025 at 11:02
  • I believe you may need not just the position of the camera in the world coordinate system, but also the orientation of the camera in world space, e.g. the coordinates of the horizontal vector aligned with the screen and the vertical vector aligned with the screen of the camera (in world space), or something like that. In some cases you may also need the focal distance from the camera's center to the screen... Commented Mar 6, 2025 at 19:24