heyx3 / Bplus.jl

A modern OpenGL 4.6 rendering framework, written in Julia.
Other
72 stars 3 forks source link

Field that embeds a lower-dimensional field in a higher-dimensional one #12

Open heyx3 opened 1 year ago

heyx3 commented 1 year ago

For example, it would let you make a 3D field which transforms the position into some 2D plane, then evaluate a 2D field.

More generally, I think the idea should be to define an N Dimensional field which owns an N-M Dimensional field, and an N+1 x N+1 transform matrix (using homogeneous coordinates). To evaluate the field, the position is transformed by the matrix, then its last M components are dropped to project it into the N-M Dimensional field. Finally, the N-M Dimensional field is evaluated.

We should be able to make an analytical derivative for it, by getting the derivative of the N-M Dimensional field and projecting it backwards into the N Dimensional field. I think this requires that the transform matrix is invertible; if it's not, then warn the user (see #11) and fall back to finite differences.