GameAnimationProgramming icon indicating copy to clipboard operation
GameAnimationProgramming copied to clipboard

`Transform::combine` is not robust.

Open Des-Nerger opened this issue 2 years ago • 0 comments

Not any two Transforms can be combined into one. For instance, you can't combine these two: Tranform(vec3(0, 0, 0), angleAxis(45.0f * QUAT_DEG2RAD, vec3(0, 0, 1)), vec3(1, 1, 1)) Tranform(vec3(0, 0, 0), quat(), vec3(1, 0.5, 1)) To illustrate, here's an example of applying these two Transforms to an axis-aligned square with the origin in the center: videogame_isometry So Transform::combine doesn't give the expected result in this case.

Possible solutions:

  1. Either narrow the definition of Transform to prohibit non-uniform scales:
struct Transform {
	vec3 position;
	quat rotation;
	float scale;
  1. Or the opposite: widen the definition:
struct Transform {
	vec3 position;
	mat3 linear;
  1. Or give up the idea of implementing Transform::combine at all.

Des-Nerger avatar Nov 26 '23 05:11 Des-Nerger