dimforge / dimforge/nalgebra

Slerp special cases

Open
#657 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

## Colinear, opposite direction inputs

> Returns `None` if the two vectors are almost collinear and with opposite direction
/// (in this case, there is an infinity of possible results).

This is only true for the 3D slerp, for 2D slerp there are only two possibilities. In either case, it might be more useful to return *some* result, rather than `None`. At the moment, the non-try variant will just return the original rotation which is quite surprising. IMO it would be better to return any rotation which is a valid solution rather than the original input.

You could have a slerp variation which returns `Result` where `RotationSet` would be a pair of rotations in 2D, and an implicitly defined "circle" of rotations in 3D, from which the user could pull out a single rotation by specifying a preferred solution in some way. The normal "slerp" function could call this function and then use an arbitrary method of selection.

## Colinear, very close

At the moment, there is a special case for when they are exactly aligned, but there's no special case for when they are just very close - the Wikipedia article on SLERP suggests falling back to linear interpolation when the inputs are very close together. Do you think this is worthwhile?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.