Coder Social home page Coder Social logo

hafidzazmi / dual-quaternion-library Goto Github PK

View Code? Open in Web Editor NEW
5.0 0.0 1.0 28 KB

Dual Quaternion (i.e Rotation & Translation) Library for c++

C++ 94.88% Makefile 5.12%
dual-quaternion quaternion quaternion-algebra quaternion-library quaternion-calculation c-plus-plus kinematics orientation translation

dual-quaternion-library's Introduction

Dual-Quaternion-Library-C++

This library was build for Quaternion & Dual Quaternion Calculation Tutorial.

Quaternion::

Name Type Description
Create std::array<double, 4> Create Quaternion Rotation, Angle in Degree
Conjugate std::array<double, 4> Quaternion Conjugate
Normalize double Normalize Quaternion , Unit Quaternion = 1
Add std::array<double, 4> Add Two Quaternions
Subtract std::array<double, 4> Subtract Two Quaternions
Multiply std::array<double, 4> Multiply Two Quaternions
MultiplyScalar std::array<double, 4> Multiply Quaternion with scalar value

DualQuaternion::

Name Type Description
Create std::array<double, 8> Create Dual Quaternion Rotation and Translation, Angle in Degree
Rotation std::array<double, 8> Return Dual Quaternion Pure Rotation
Translation std::array<double, 4> Return Vector Quaternion Translation
Conjugate std::array<double, 8> Dual Quaternion Conjugate
Add std::array<double, 8> Add Two Dual Quaternions
Subtract std::array<double, 8> Subtract Two Dual Quaternions
Multiply std::array<double, 8> Multiply Two Dual Quaternions

Quaternion::Create

Create a quaternion rotation based on the equation below :

q= [cos( \theta /2), d*sin( \theta /2)]
where :
 q_{s} = cos( \theta /2)
 q_{v} = d*sin( \theta /2)

Example :
double Angle = 90; //in Degrees
std::array<int, 3> DirectionOfRotation = {0,1,0};
std::array<double, 4> Quaternion1;
Quaternion1 = Quaternion::Create(Angle,DirectionOfRotation);

Quaternion::Conjugate

Return Quaternion Conjugate based on the equation below :
q = [cos( \theta /2), -d*sin( \theta /2)]

Example :
Quaternion::Conjugate(Quaternion1);

Quaternion::Normalize

Return Quaternion Normalize based on the equation below :
||q|| = \sqrt{q0^{2} + q1^{2} + q2^{2} + q3^{2}}
Note : Normalize Unit Quaternion will return 1

Example :
Quaternion::Normalize(Quaternion1);

Quaternion::Add

Add two Quaternions (P + Q) based on the equation below :
 p + q = [p_{s} + q_{s},p_{v} + q_{v}]

Example :
Quaternion::Add(Quaternion1,Quaternion2);

Note :

This library used std::array<>
Any improvment are appreciated

dual-quaternion-library's People

Contributors

hafidzazmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

gatsby23

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.