Giter VIP home page Giter VIP logo

Comments (5)

JohanLarsson avatar JohanLarsson commented on June 15, 2024

Sounds interesting, thanks for creating the issue.
@MaLiN2223 what do you think?

from mathnet-spatial.

MaLiN2223 avatar MaLiN2223 commented on June 15, 2024

Yeah, why not? Expanding is mostly a good idea especially if one have need.
@djowatts could you provide example or some related books? It's very interesting.
How can I help you with it?

from mathnet-spatial.

djowatts avatar djowatts commented on June 15, 2024

The code I have using the .Net Numerics stuff is as follows

var roty = Quaternion.Normalize(new Quaternion(0.0f, 0.0f, (float)Math.Sin(rpy.Z / 2.0), (float)Math.Cos(rpy.Z / 2.0))); // yaw is rotation around Z axis
            var rotp = Quaternion.Normalize(new Quaternion(0.0f, (float)Math.Sin(rpy.Y / 2.0), 0.0f, (float)Math.Cos(rpy.Y / 2.0))); // pitch is rotation around Y axis
            var rotr = Quaternion.Normalize(new Quaternion((float)Math.Sin(rpy.X / 2.0), 0.0f, 0.0f, (float)Math.Cos(rpy.X / 2.0))); // roll is rotation around X axis

            //apply in order of roll, pitch, then yaw        
            var first = rotp.RotateRotationQuat(rotr);
            var second = roty.RotateRotationQuat(first);
            return second;

And here is some test data to help you verify

 yield return new object[]
            {
                new Vector3(2.1114570353895603f, -2.585985022981525f, 0.6664081165354347f), // rpy
                new Quaternion(0.3804738214831853f, -0.3695932081905471f, 0.8350484129621588f, -0.14606395734328323f) // expected quat
            };
            yield return new object[]
            {
                new Vector3(1.2221363972810417f, 2.7458063901769885f, -1.1425980259781825f),
                new Quaternion(0.5291170318308547f, 0.6145316070072362f, -0.5602830425963242f, -0.16872754011902086f)
            };
            yield return new object[]
            {
                new Vector3(-1.1211016954494437f, -0.004126944712585345f, 1.9222979397169384f),
                new Quaternion(-0.30297942912094916f, -0.4368753181928898f, 0.6937524685292732f, 0.4858507325228037f)
            };

I'll have a root around and see if I can find the materials we used when writing this and get back to you

from mathnet-spatial.

rubenvb avatar rubenvb commented on June 15, 2024

If you think quaternions are the sh*t, check out geometric algebra ;)!

from mathnet-spatial.

MaLiN2223 avatar MaLiN2223 commented on June 15, 2024

I did some research and in my opinion this is no good idea to put any euler angles (a.k.a. roll, pitch, yaw) to this library - the reason for it is that there at least two possible representations for the same rotation see: this link
I have implemented this approach already and I am ready to make a pull request however it will not be compatibile with already written method (ToEulerAngles()) because (as it appears) I am using different algorithm.

and since it would be suprise to users if they would start getting different results after library update I do not think that is recommended.

Ofcourse for sake of compatibility I can implement a wikipedia's version of the algorithm however I cannot vouch if it is a propper one.

Furthermore I would advise to remove ToEulerAngles() method entirely just to avoid confusion.

from mathnet-spatial.

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.