Page MenuHome

BLI: Adjust interpolation to support integers, other tweaks
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Mar 25 2022, 5:00 AM.

Details

Summary

In order to allow interpolation of integers with a float, add a separate
template parameter for the factor and multiplication types.
Also move some helper constexpr variables to the "base" header
(reversing the dependency to "base" -> "vector").

This also adds a distance function for scalar types, which is
helpful to allow sharing code between vectors and basic types.

Diff Detail

Repository
rB Blender

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Mar 25 2022, 5:00 AM
Hans Goudey (HooglyBoogly) created this revision.
Hans Goudey (HooglyBoogly) added inline comments.
source/blender/blenlib/BLI_math_vec_types.hh
329

This same change could be applied to other operations here, but maybe it's better to just do it where necessary?

source/blender/blenlib/BLI_math_base.hh
95

Doesn't seem to be used.

source/blender/blenlib/BLI_math_vec_types.hh
15

Including that here seems unnecessary. You might have to add it in BLI_math_vector.hh and BLI_float4x4.hh though.

329

Doing it when necessary is fine.

Looks like this should replace the function above though.

Jacques Lucke (JacquesLucke) requested changes to this revision.Mar 25 2022, 12:31 PM
This revision now requires changes to proceed.Mar 25 2022, 12:31 PM
source/blender/blenlib/BLI_math_base.hh
95

Also I would expect distance to return a scalar distance between two points. Maybe there is instances where this is useful for scalar types?

source/blender/blenlib/BLI_math_base.hh
95

Ah, I forgot to mention that in the patch description. I'm using this in D14382 so the same code can work for vector and scalar types. I know it makes less sense to have a distance function for scalars, but the consistency is very helpful.

Hans Goudey (HooglyBoogly) edited the summary of this revision. (Show Details)
  • Only one multiplication method
  • Rearrange includes a bit
This revision is now accepted and ready to land.Mar 25 2022, 3:43 PM