Skip to content

A 3D surface and conics visualizer made using OpenGL and C

License

Notifications You must be signed in to change notification settings

ranaxdev/3d-conics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

3d-conics

A 3D surface and conics visualizer made using OpenGL and C

Video Demos · Report Bug


Preview - Future Releases - Some More Renders - Installation
3b1b SoME1 - Libraries Used - License - Contact
Example Usage - Users - Developers

Preview

preview.mp4

As of 15/08/2021, 3d-conics features mesh generation based on multivaraible functions and live interaction with their properties (such as controlling the domain/range & applying transformations) with a handful of 3D surfaces and conics.

The mesh properties can be adjusted via a GUI overlay (Dear Imgui integration) and viewed through a controllable 3D perspective projection camera, which are implemented as separate modes (edit and normal respectively).

A mesh generating menu allows you to select a handful of prefabricated functions (such as PARABOLOID, HYPERBOLIC PARABOLOID, SINGLE CONE, DOUBLE CONE, CYLINDER, SPHERE and a couple more) and their initialization properties.

Future Releases

Features that I would like to work towards implementing

  • Live delaunay triangulation
  • Rendering multiple meshes in the same application instance
  • Live mesh vertex editor
  • Live mesh painting
  • Custom transformations

Feel free to suggest some features in the issues tab!

Example Usage

Users

Below are some of the things you can do with the meshes which you generate from a spawner menu.

Level Of Detail

There is an universal option to increase or decrease the "level of detail" of the currently rendered mesh. This causes uniform generation of extra vertices, which makes the mesh more tightly/loosely packed. This may also increase resource usage.

LOD.mp4

Properties

Various meshes have their own custom properties which may not apply to all of them. For example, rendering a conic (such as a cylinder) contains adjustable angles to "wrap" itself, radius and height. A surface such as a hyperboloid, which is not generated parametrically has adjustable properties for the maximum domain and range.

Properties.mp4

Transformations

Currently, there is support for rotating the mesh in all 3-axis using Euler angles (might look into replacing with Quaternions). There are buttons to automate the rotations as well, so that you can adjust other properties while watching the mesh transform.

Rotation.mp4

Breathing

This feature allows you to automate viewing how the mesh changes as you adjust their domain/range live. An amplitude slider allows you to control the speed at which this happens.

Breathing.mp4

Developers

Creating your own App instance using the conics harness

class App : public conics::Harness{
  Camera* camera = new Camera();
  Spawner* spawner = new Spawner();
  // override startup to initialize rendering data
  void startup() override{
    // Sets up data buffer for a cone shape (starting mesh)
    R->default_mesh = new Mesh(surface::CONE...);
  }
  // override render to call renderer routines
  void render() override{
    VP = camera->calc_VP(delta);
    // GUI
    R->renderGUI(*spawner);
    // MESH
    R->renderMesh(*R->default_mesh);
  }
}

Creating your own GUI overlay window

// Creating your own GUI
class MyGUI : public GUI {
  void update() override;
  ...
}
MyGUI::MyGUI(){
  MyGUI::flag_list {/* your ImGUI flags here */};
  MyGUI::updateFlags();
  
  // If you want to change GUI with events attach to the KL
  KeyListener::listeners.push_back(this);
}

Some More Renders

HYPERBOLIC PARABOLOID (saddle) generated with    

saddle_o

PARABOLOID generated with    

paraboloid_o

SINGLE CONE generated parametrically with

The cone is stretching because I was live-editing the t-factor

cone_o

TORUS generated parametrically with

The torus "wraps" in the render because I was live-editing the value of theta

torus_o

Installation

Linux

Dependencies include OpenGL 4.50, libdl, glfw3, pthread, sqlite3, glm

git clone https://github.com/ranaxdev/3d-conics
cd 3d-conics
mkdir Release
cd Release
cmake -DCMAKE_BUILD_TYPE=Release ../
make

Windows

I'm currently working on releasing an executable so that you don't have to use cmake to build it on windows

3Blue1Brown SoME1

This project was inspired by the math educator and content creator 3Blue1Brown's online competition SoME1 (The Summer of Math Exposition). It has been submitted as an entry.

I made this tool because I believe math educators can benefit from it by using it to demonstrate 3D surfaces/conics to their students as it is often difficult to plot them by hand, as you have to think about perspective and shading. This tool allows you to view these surfaces in various angles and see how they change by adjusting their many properties.

Libraries Used

  • GLAD : OpenGL Loading Library

  • GLM : OpenGL Mathematics

  • GLFW : A multi-platform library for OpenGL, OpenGL ES, Vulkan, window and input

  • Dear ImGui : Bloat-free Graphical User interface for C with minimal dependencies

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

Contact

S.R. Qaiser - @pitu_dev - [email protected]

Project Link: https://github.com/ranaxdev/3d-conics