crertel / graphmath

An Elixir library for performing 2D and 3D mathematics.
The Unlicense
79 stars 14 forks source link

Quaternions #1

Closed Host32 closed 8 years ago

Host32 commented 9 years ago

This submodule handles Quaternion using tuples of floats. i.e. a rotation around an axis.

Consider the quatern format: { w, x, y, z } where w is the angle, and x y z are the axis coordinates

@type quatern :: {float, float, float, float}

An implementation in C ++ to serve as inspiration: https://bitbucket.org/sinbad/ogre/src/5ee010d450fd064007b61442124222bfb3d57a58/OgreMain/include/OgreQuaternion.h?at=default

crertel commented 9 years ago

I've got a few quaternion implementations from old projects (C and C++) lying around. :)

Do you want this for 1.0.0?

crertel commented 9 years ago

Oh, hah. I get it. It isn't a PR yet. :)

Host32 commented 9 years ago

actualy, I forked your project to implement, I began to study Elixir recently and would like to contribute something :D

crertel commented 9 years ago

Hey, no worries!

So, if you'd like to submit a pull request, we can go through it.

I'm mainly concerned about having 100% doc and test coverage; from what I've seen so far, your fork is looking good. :)

Host32 commented 9 years ago

hehe tnx,

I have some doubts about design, i start the project https://github.com/Host32/elx-physics to do some tests before find yours, and as you can see, i use structs in place of tuples for the simplicity of use for exemple vec.x or vec.y, what you think about it?

crertel commented 9 years ago

Hm.

Behind the scenes, if I remember correctly, structs are stored as tuples. I'll do a bit of research to figure out if there is some easy way of making that conversion.

I'm mainly concerned that we have easy access to the data in memory so that native extensions for better performance are easier later.

Regardless, open up an issue so I can track the suggestion better. Good thinking.

Host32 commented 9 years ago

okay. :)

crertel commented 9 years ago

Here's a good resource I found on quaternions:

http://3dgep.com/understanding-quaternions/

I think we're missing a few things:

If we can get those knocked out, I think we're ready to go. What do you think?

crertel commented 9 years ago

Alright, we're down to just slerp as of 5c06816f4887c053a7e29f8602ecf0a33f83ead2

Host32 commented 9 years ago

Okay, done.

Sorry for my english, I'm struggling

there are also some other operations that judged less important and would like to know what you think about:

Then later i would like to know how you plan to design rigid body module :D

crertel commented 9 years ago

I'm guessing you saw Blow's [http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/](Understanding Slerp, Then Not Using IT)?

Anyways, I think that we should put squad, exp, normalized lerp, and log interpolation on our wishlist, and save the rest for later.

Last thing we're going to need is the Matrix33 and Matrix44 inverses, and we're good for 1.0.0!

(also: you're English is quite fine for this--thank you for using a tongue you aren't familiar with. I wish I could do that.)

Host32 commented 9 years ago

although the link that you spent not working here, I read this article a few days before find your project, then yes I am aware about this.

Still, if you think we should change something feel free to correct me :)

(also if you want experiment a new language, we can talk in portuguese hehe)