/Gimbal-lock

An OpenGL visualisation of Gimbal lock and how quaternions can be used to solve it.

Primary LanguageC++MIT LicenseMIT

Gimbal lock and quaternions

A visualisation and comparison of normal and bump mapping models in OpenGL and how they alter the original appearance.

About this repo

Gimbal lock is a phenomenon that occurs in three-dimensional rotational systems, such as those used in computer graphics, animation, and aerospace applications. It arises when using Euler angles to represent the orientation of an object in three-dimensional space. Euler angles describe rotations about three distinct axes (pitch, yaw, and roll). However, when the pitch angle approaches +90 or -90 degrees, the rotation axes align, leading to a loss of one degree of freedom and making it impossible to represent specific orientations uniquely. This results in a situation where rotations around one axis affect the other two, causing unexpected and undesirable behaviour in animations or control systems.

This repository contains an OpenGL environment designed for visualising Gimbal lock and demonstrating the corrective capabilities of quaternions. With this implementation, users can dynamically adjust real-time rotation angles, offering an interactive platform to visualise these cases.

Demo video

Watch the video

Getting Started

Dependencies

Installing

  1. Clone this repository.
git clone https://github.com/borjagq/Gimbal-lock/
  1. Open the project Lab1.xcodeproj

  2. Build and run

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

This repository incorporates essential components from the open-source libraries stb and Dear ImGui. These libraries provide the file read/write and GUI functionalities. For further details about these libraries, visit their GitHub repositories.