Skip to content

Rotation3d.interpolate lerps incorrectly #8523

@TheComputer314

Description

@TheComputer314

Describe the bug
When Rotation3d.interpolate(Rotation3d, double) is called with t = 1, the output is nonsensical instead of being identical to the lerp endpoint rotation.

To Reproduce

var a = new Rotation3d(1,0,0);
var b = new Rotation3d(0,1,0);
var lerp = a.interpolate(b, 1);
System.out.println(a.toString());
System.out.println(b.toString());
System.out.println(lerp.toString());

Expected console output:

Rotation3d(Quaternion(0.8775825618903728, 0.479425538604203, 0.0, 0.0))
Rotation3d(Quaternion(0.8775825618903728, 0.0, 0.479425538604203, 0.0))
Rotation3d(Quaternion(0.8775825618903728, 0.0, 0.479425538604203, 0.0))

Actual console output:

Rotation3d(Quaternion(0.8775825618903728, 0.479425538604203, 0.0, 0.0))
Rotation3d(Quaternion(0.8775825618903728, 0.0, 0.479425538604203, 0.0))
Rotation3d(Quaternion(0.8775825618903728, 1.1102230246251568E-16, 0.2590347239999257, -0.40342268011133486))

Quaternion visualization for b:
Image
Quaternion visualization for lerp: (Should be identical to b but isn't)
Image

Additional context
Originally discovered by truher on CD. Credit for the above visualizations go to them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions