Giter VIP home page Giter VIP logo

Comments (5)

emilk avatar emilk commented on August 26, 2024 1

Thanks @bitshifter !

from glam-rs.

bitshifter avatar bitshifter commented on August 26, 2024

Ah right, handedness has confused me a bit at points. I guess looking at https://www.evl.uic.edu/ralph/508S98/coordinates.html it's more about the convention than what is going on in the math.

from glam-rs.

bitshifter avatar bitshifter commented on August 26, 2024

If you felt like rewording it I'd be happy to accept a PR. Otherwise I will get to it sometime.

from glam-rs.

aloucks avatar aloucks commented on August 26, 2024

For what it's worth, I found the documentation helpful and hope that it's not removed. Wouldn't the angles need to be negated if the rotations were following the right-hand rule?

from glam-rs.

bitshifter avatar bitshifter commented on August 26, 2024

Wouldn't the angles need to be negated if the rotations were following the right-hand rule?

I don't think so, only for a function like from_rotation_ypr which bakes in a notion of coordinate systems (see #79). If you look at the images on https://www.evl.uic.edu/ralph/508S98/coordinates.html rotating unit +Z +90 degrees around +Y will result in unit +X. This is true for both left-handed and right-handed systems. While conceptually in the left-handed system positive rotation is clockwise and in the right-handed system positive rotation is counter-clockwise, mathematically they are the same.

I think that is what @emilk was getting at.

Code wise:

use glam::{Mat3, Vec3};
// rotate +z 90 degrees around y giving +x
let m = Mat3::from_rotation_y(90.0_f32.to_radians());
let v = m * Vec3::unit_z();
assert!(v.abs_diff_eq(Vec3::unit_x(), core::f32::EPSILON));

from glam-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.