dimforge / dimforge/nalgebra

How to get a signed angle ?

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

Description

Hi,

I want to calculate the orientation of a `Vector2`. The sign of the angle matters, but `vector2.angle(Vector::x())` doesn't seem to keep that information.

example:

```rust
// assertion fails
assert_eq!(
na::Vector2::new(0f32, -1f32).angle(&na::Vector2::x()),
-std::f32::consts::FRAC_PI_2
);

```

Is there a way to do it with `nalgebra`, maybe with `Rotation` ? Or should I just do it by hand ?

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.