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

Missing math functions #63

Closed
natevm opened this issue Sep 15, 2020 · 2 comments
Closed

Missing math functions #63

natevm opened this issue Sep 15, 2020 · 2 comments

Comments

@natevm
Copy link
Contributor

natevm commented Sep 15, 2020

owl::math is missing some functionality that I find I need for outside projects.

I need projection matrices so that I can match projects outside OWL. In computer vision applications for example, projection matrices (often called intrinsic matrices) are returned from a calibration step in OpenCV. In hybrid raster / raytracer setups, projection matrices are important for generating primary rays that match up with the rasterized image.

Right now, owl::math lacks a 4x4 matrix type. Currently, all that exists is a LinearSpace2 and LinearSpace3 which sort of act like 2x2 and 3x3 matrices. A projection matrix is a 4x4 matrix though, and cannot be represented with the AffineSpaceT class.

Many functions are undocumented (eg dot, cross, normalize) in vec.h

Basic utility functions seem to be missing as well.

It is unclear how to combine AffineT together like a regular 4x4 matrix multiplication
No decompose functions for extracting scale, rotation, translation from a 4x4
AffineT missing an invert function, as they are not 4x4 matrices
No max/min functions for vector types, greaterThan, greaterThanEqual, lessThan, lessThanEqual

Many other functionality is missing as well. The goal of this issue is to hopefully keep track of pain points as we run into them and then hopefully fix them.

#64 Is keeping track of missing docs for vec classes

@ingowald
Copy link
Contributor

ingowald commented Nov 9, 2020

General non-affine 4x4 matrix types are indeed not supported, we use the embree-style types of matrices where an affine matrix is a 4x3 matrix represented as linear transform+offset. This can be added, though.

dot, cross, normalize are not documented .... but kind of self-explanatory.

Combining matrices works by multiplying them, e.g., affine3f::scale(..) * affine3f::translate(...) would be the product of a translation- and a scale-matrix.

decompose i'd have to check - the translate part is obvious (i'ts the translational part of an affine, Affine3f::p); the scale isn't.

min/max for vector types do exist, bot per-elemnt as well as reduce_min/reduce_max.

comparators do exist, using the standard operator< operator== etc operators; unlike explicit greater_than/less_than functions this allows those to be used even in std::map etc classes (though adding functors to do that wouldn't hurt).

From this list, the only thing i find really missing are

  • decomposing an affine3f into scale/rotate/translate, and
  • general matrix4x4 class for those that want to use projection matrices in their own codes (owl itself doesn't use any)

@ingowald
Copy link
Contributor

ingowald commented Apr 4, 2022

closing this for now; if/once you have these functions, pls add them through a PR

@ingowald ingowald closed this as completed Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants