Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slerp functions for directions (Vec2 and Vec3) #13407

Closed
vveisard opened this issue May 17, 2024 · 2 comments · Fixed by #13451
Closed

slerp functions for directions (Vec2 and Vec3) #13407

vveisard opened this issue May 17, 2024 · 2 comments · Fixed by #13451
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Enhancement A new feature

Comments

@vveisard
Copy link

vveisard commented May 17, 2024

What problem does this solve or what need does it fill?

Linear interpolation is unsuited for transitioning of directions.

What solution would you like?

I would like a spherical interpolation function (slerp) for Vec2 and Vec3 directions.

Additional context

This is a common feature in existing game engines:
https://docs.godotengine.org/en/stable/classes/class_vector3.html#class-vector3-method-slerp
https://docs.unity3d.com/ScriptReference/Vector3.Slerp.html

@vveisard vveisard added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled labels May 17, 2024
@vveisard vveisard changed the title Spherical interpolation for directions (Vec3) slerp functions for directions (Vec2 and Vec3) May 17, 2024
@bugsweeper
Copy link
Contributor

Vec2 and Vec3 is part of glam crate, this problem should be solved there, futhermore there is already long living issue

@mweatherley
Copy link
Contributor

@bugsweeper You're right that the vector types are owned by glam, but on the other hand, we could easily implement slerp functions for the Dir2/Dir3 types that we do own, and I think those would be quite useful.

@pablo-lua pablo-lua added A-Math Fundamental domain-agnostic mathematical operations and removed S-Needs-Triage This issue needs to be labelled labels May 18, 2024
github-merge-queue bot pushed a commit that referenced this issue May 21, 2024
# Objective

- Fixes #13407 .

## Solution

- Used Quat and Rotation2d.

## Testing

- Added tests based on 0°, 30°, 45°, 60° and 90° angles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Math Fundamental domain-agnostic mathematical operations C-Enhancement A new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants