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

Add bivector decomposition #21

Open
porky11 opened this issue Aug 3, 2017 · 6 comments
Open

Add bivector decomposition #21

porky11 opened this issue Aug 3, 2017 · 6 comments

Comments

@porky11
Copy link

porky11 commented Aug 3, 2017

It should be possible to decompose a general bivector into D/2 (rounded downwards) components, where D is the number of dimensions.
Would be nice if a function for doing this would be added to this library, or at least an example. I don't find, how this can be done, anywhere.
The reason for this is, that I want to experiment with at least 4 dimensional rotations, also torques.

@wolftype
Copy link
Owner

wolftype commented Aug 4, 2017

i have an implementation for conformal GA:
https://github.com/wolftype/versor/blob/devel/src/space/vsr_cga3D_op.cpp#L312

a generalization of this would be most welcome. post ideas here!

@porky11
Copy link
Author

porky11 commented Aug 4, 2017

I'll look at it, and when I find a way to generalize it, I'll tell you or try to implement it.

@porky11
Copy link
Author

porky11 commented Aug 6, 2017

It seems to be pretty simple to generate a rotor from a bivector in even 4d, like this: http://www.liquisearch.com/bivector/four_dimensions/rotations_in_%E2%84%9D4
I just need the e function. Is this implemented? I cannot find it.

@porky11
Copy link
Author

porky11 commented Aug 7, 2017

I tired to implement the exponential function myself, but I don't understand how the e function in geometric algebra works.

exp(biv) = sin(norm(biv)) + cos(norm(biv))*biv
but following seems not to be true:
exp(biv0+biv1) = exp(biv0)*exp(biv1) = exp(biv1)*exp(biv0)
I wonder why

@wolftype
Copy link
Owner

As I understand it, the above is true iff biv0 and biv1 commute (biv0biv1 = biv1biv0).
I believe the Gen::bst function in vsr_generic_op.h could be repurposed into a generic exp function.

@wolftype
Copy link
Owner

wolftype commented Aug 13, 2017

the above Gen::bst is defined on line 459 and takes a Pair, though it should work for any 2-blade. If you have a general bivector, and are unsure whether it is a 2-blade, you would decompose it into two commuting 2-blades, and exponentialize each separately, then multiply the results to get a more general rotor.

     /*!
          Generate Boost as exponential of a Point Pair
          Implemented from "Square Root and Logarithm of Rotors. . ." by Dorst and Valkenburg, 2011
          e^-B/2 = cosh(B/2) - sinh(B/2)
          @param Point Pair generator
      */
      template<class A>
      static auto bst(const GAPar<A>& tp) -> decltype( tp + 1 ) {

          VSR_PRECISION norm; VSR_PRECISION sn; VSR_PRECISION cn;

          VSR_PRECISION td = tp.wt();

          if (td < 0) { norm =  sqrt( - td );  sn = sin(norm) / norm; cn = cos(norm);  } //note, changed to sin from -sin
          else if (td > 0) { norm = sqrt(td);  sn = sinh(norm) / norm; cn = cosh(norm); }
          else if (td == 0) { norm = 0; sn = 1; cn = 1; }

          return (tp * sn) + cn;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants