Short and long slerp

버전 1.0.1 (81 KB) 작성자: Sofía Miñano
Compute the slerp rotation path between two quaternions, with the option of going the short way or the long way
다운로드 수: 30
업데이트 날짜: 2022/6/16

Short and long SLERP interpolation

View Short and long slerp  on File Exchange

Computes the slerp interpolated path between two quaternions p0 and p1. Because any rotation can be represented by a quaternion p or its opposite -p, the rotation path between two quaternions may be the 'long way' or the 'short way'. This function allows to compute one or the other. If not specified, the short way is computed. Slerp interpolation guarantees a constant angular velocity rotation from the start quaternion to the end. If quaternions are too close to each other (almost parallel), linear interpolation is used instead.

A demo is included that compares a simple rotation path computed with slerp, going the short way or the long way

For more information about short vs long slerp: https://en.wikipedia.org/wiki/Slerp (Quaternion Slerp section)

Inputs

  • p0 - 1x4 double representing quaternion starting point
  • p1 - 1x4 double representing quaternion end point
  • t - 1xN double representing parameter t, interpolation coefficient from 0 to 1 (inclusive). At t=0, p_interp = p0_unit; at t=1, p_interp=p1_unit;
  • path_str - [OPTIONAL, default = 'short'] a string, either 'short' or 'long', indicating whether we want to compute the slerp path the 'short way' or the 'long way'. If not specified, the short way is computed.
  • DOT_THRESHOLD - [OPTIONAL, default = 0.9995]. If the absolute value of the dot product between p0 and p1 is above this threshold, the quaternions are considered almost parallel and a linear interpolation is computed instead

Outputs

  • p_interp - Nx4 double, each row representing a normalised quaternion in the interpolated path. Start and end points are included: p_interp(1,:) = p0_unit; p_interp(end,:) = p1_unit;

alt text

인용 양식

Sofía Miñano (2024). Short and long slerp (https://github.com/sfmig/short-and-long-slerp/releases/tag/v1.0.1), GitHub. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2020b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.1

See release notes for this release on GitHub: https://github.com/sfmig/short-and-long-slerp/releases/tag/v1.0.1

1.0.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.