Skip to content

ctschnur/tex_quads

Repository files navigation

tex_quads

Animation engine to play around with mathematical visualization and novel ui ideas.

Afer early attempts at building my own rendering engine in C++, I am for now basing this on the much more complete panda3d game engine (initially developed by Disney, written in C++, having DirectX and OpenGL backends and python bindings).

Samples

Have a look in the samples folder for some screenshots/gifs of renderings.

Long-Term goals

  • an interactive branched podcast user interface and associated file format
  • enable computer-assisted manipulation of mathematical expressions and parallel visualization
  • 3d interactive scratchpad (copy-pasting of images, text, on-screen freehand drawing, collapsable notes, all in 3d)

Development Notes

Integration

  • [X] make the cursor ui element lock it’s orientation to the camera
  • [X] make a text label object that is attached to the render tree but always updates to face the camera
  • [X] make a Frame2d for basic xy parametric curves plotting
    • [X] offset the labels properly from the axes
    • [X] resetting the labels to their correct orientation upon dynamic update of graph
  • [X] make an animated plot in the 2d frame with a queue of frames of of xy data
    • [X] make a set of xy data frames and cycle through these frames, updating the plot
  • [X] stream a FFT of the microphone audio
  • [X] make an orthographic orbiter camera that zooms (changing the ‘film size’ instead of distance to center)
  • [X] create new camera gear that is optimized for 2d viewing and panning over a pdf
  • [ ] make the pdf annotator view better
    • [ ] zoom to 10% (min) and 1000% (max) as in Firefox
  • [ ] make a draw on screen (2d plane) functionality
    • [X] draw a draggable point and plane
    • [ ] make a draggable, snappable window
      • [X] calculate the window’s width and height and make them read-only variables
      • [X] make plane resizable
      • [ ] make a Box
    • [ ] implement sketching on this plane
      • [ ] make an eraser for the plane
      • [ ] draw lines in 2d and smooth

Branched Podcast Interface

  • [X] Plot parametric curves
  • [X] Make blender-like side, top, front view (map to number keys)
  • [X] Make a panning and centering view around selected objects
    • [X] crosshair for Orbiter
    • [X] simple panning in camera plane
  • [X] Plot a dashed parametric curve
  • [X] Draw 2d bezier curve with handles

Force-directed graph plotting

  • [X] draw a graph by using networkx for the layout generation
  • [X] make individual nodes of the graph draggable
  • [ ] implement your own force-direced graph drawing algorithm to optimally distribute the nodes and subnodes
    • [X] implement coulomb interaction of n particles in 3d
      • [X] coulomb interaction of 2 particles in 2d
    • [ ] add infinite potential wells and/or strong damping to confine the nodes (particles)

on-hover cursor for a graph of finite-length edges

  • [X] on-hover highlighting of the closest infinite straight line
  • [X] pin text (parametric value between 0 and 1) to the hovering cursor
  • [X] on-hover highlighting of the closest finite straight line
  • [X] substitute Line1dSolid edges by vector edges
  • [X] write state machine and ui
    • [X] for a single edge player
    • [X] for a single edge recorder
  • [X] accentuate the cursor
  • [X] select an edge and a [0,1] parameter by clicking the mouse
  • [X] implement dragging the cursor an edge

Sync UI with audio recording/playback in parallel threads

  • [X] record an audio file using python
    • [X] using pyaudio, which produces a .wav file
  • [X] implement audio recording parallel to ui
  • [-] implement audio playback parallel to ui
    • [ ] create a small frame in the corner of the screen displaying the audio wave during playback
    • [ ] optimization: use a thread-safe queue in an additional thread to continuously write back fetched frames. This could be better suited for handling the recording of large audio files and for converting between wave and mp3 before saving. Here, one could would use a callback function (created by pyaudio, in yet another thread), which would .put(in_data) to a global queue which would then be accessed by another thread to write back larger chunks to an e.g. .wav file.
    • [X] cutting away spacebar sounds at beginning/end of recording section
  • [-] load and play an external file into an EdgePlayer
    • [X] make EdgePlayerSM (state machine) and call the routines of PlaybackerSM and GraphickerSM from inside of there
    • [X] implement mouse hovering and pickig in the EdgePlayerSM
    • [X] use pyaudio to play audio in a separate thread
    • [X] Make a loading symbol for threads that are processing in the background
      • [X] implement ProcessingBox
      • [X] implement UIThreadLogger (global object) to manage threads display them in the ui
    • [X] Implement the naive approach of calculating the edge length from the duration; worry about node dragging of nodes in re-merging paths later
    • [ ] implement an approach where a manual parameter v2_manual can be set (set_v2_manual -> override v_dir), which when defined has precendence in get_v2() over the v2 calculated from the duration and direction vector.
    • [ ] make an interactive way of scaling the length of an edgeplayer (i.e. vary the weight of the line (thicker in the middle than on the borders) if it’s artificially compressed/elongated) (e.g. hold shift and drag over a square appearing above the player)
    • [ ] show the loading symbol while the wave file is being read and before the events are being registered

Extend the EdgePlayer to a GraphPlayer made of many edges and one EdgePlayer at a time

implement expanding subspaces

select a node press expand -> show the lastest connection but hide everything else

implement freehand drawing onto panes anchored to nodes and edges

Dropped/Deferred dev efforts

  • [ ] triangulation of latex characters. Probe, at what complexity the p3d triangulation breaks. To decrease the complexity (geometry simplification) and check for intersections of hole polygon with boundary polygon, use the shapely library.
  • [ ] Draw a black circle and black dot as part of cone tips
  • [ ] parametric curve picking
    • build a tube mesh along an arbirary path:
      • advance in equidistant path-length segments along the path of a smooth continuous curve and at each point
        • plot a point, and a circle
        • find the tangent vectors, generate the circles perpendicular to them, with naive choice of the start-vertex of each circle
        • bulid the triangle mesh in a for loop (always accessing the last circle’s coordinates last_circle_coords)

      Fixable Problems:

      • the tube folds over when the curvature becomes much larger than the distance between two segments

Installation

  • Clone this repository
  • Create a python virtual environment
  • Activate the virtual environment
  • install the dependencies listed in requirements.txt
pip install -r ./requirements.txt

About

Animation engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published