======================================================================
µ-MATH EFFECTS
High-Performance Vala / GTK3 Mathematical Animation Port
======================================================================

µ-Math Effects is a high-performance, configurable Vala and GTK3 port 
of classic BASIC animation curves ("Moermann Curves"). It features 
smooth Cairo batch-rendering, multi-color rainbow modes, window 
transparency, layer hints, and a fully modular mathematical plugin 
architecture.

----------------------------------------------------------------------
FEATURES
----------------------------------------------------------------------
* High-Performance Rendering: Accelerated 2D graphics powered by Cairo 
  and GLib tick callbacks.
* Modular Math Plugins: Easily extendable architecture using the 
  'EffectFunction' interface (mathfunction.vala).
* Interactive Settings Dialog: Right-click anywhere on the window to 
  access speed controls, effect selection, transparency sliders, 
  phase toggles, custom color pickers, and window behavior options.
* Advanced Window Management: Configure window types (Normal, Dock, 
  Utility), keep-above (Always on Top), sticky mode (all workspaces), 
  and persistent geometry via ~/.config/mu-math-effects.conf.
* Rainbow & Phase Modes: Full point-density rainbow coloring using HSV 
  color interpolation alongside customizable phase toggles.

----------------------------------------------------------------------
BUILDING AND INSTALLATION
----------------------------------------------------------------------
Prerequisites (Vala compiler and GTK+ 3 development libraries):
- Debian / Ubuntu / Mint: sudo apt install valac libgtk-3-dev build-essential
- Arch Linux: sudo pacman -S vala gtk3 base-devel

Compilation:
  make

Run:
  ./mu-math-effects

----------------------------------------------------------------------
HOW TO ADD CUSTOM MATHEMATICAL FUNCTIONS
----------------------------------------------------------------------
µ-Math Effects is designed to be easily extensible. You can add your 
own custom mathematical curves (e.g., spirals, harmonographs, fractals) 
in just a few minutes by creating a new plugin file!

Step-by-Step Guide:

1. Create a new plugin file:
   Create a new file in the source directory named 'mathfunction4.vala' 
   (incrementing the number for subsequent plugins).

2. Implement the 'EffectFunction' interface:
   Implement your custom formula inside the 'MuMath' namespace. 
   Template example:

   namespace MuMath {
       public class Effect4 : Object, EffectFunction {
           // Return the display name shown in the settings dropdown
           public string get_name() {
               return "4. My Custom Curve";
           }

           // Define your mathematical calculation formula
           public void calculate(double t1, double t2, double scale_factor, double cx, double cy, out double px, out double py) {
               double x_val = Math.cos(t1) * Math.sin(t2);
               double y_val = Math.sin(t1) * Math.cos(t2);

               px = cx + (180.0 * scale_factor) * x_val;
               py = cy + (180.0 * scale_factor) * y_val;
           }
       }
   }

3. Register the plugin in 'main.vala':
   - Dropdown UI: Add your new option to the effect selection combo box 
     in open_settings_dialog():
     combo_effect.append("4", "4. My Custom Curve");

   - Instance Loader: Update update_effect_instance() to instantiate 
     your new class when selected:
     if (selected_effect_id == 2) {
         current_effect = new MuMath.Effect2();
     } else if (selected_effect_id == 3) {
         current_effect = new MuMath.Effect3();
     } else if (selected_effect_id == 4) {
         current_effect = new MuMath.Effect4();
     } else {
         current_effect = new MuMath.Effect1();
     }

4. Update the Makefile:
   Add 'mathfunction4.vala' to the SOURCES variable in your Makefile:
   SOURCES = main.vala mathfunction.vala mathfunction1.vala mathfunction2.vala mathfunction3.vala mathfunction4.vala

5. Recompile:
   make clean && make

----------------------------------------------------------------------
USING GEMINI.GOOGLE.COM TO CREATE NEW MATH FUNCTIONS
----------------------------------------------------------------------
You can use Gemini to instantly write custom math formulas for µ-Math 
Effects without needing to code them from scratch.

1. Open your browser and go to gemini.google.com.
2. Copy and paste a prompt similar to this:

   "Please write a new Vala plugin class named Effect4 for 'MuMath-Effects' 
    implementing the MuMath.EffectFunction interface. Make it calculate 
    [describe your desired curve here, e.g., a heart shape / a 3D torus / 
    a complex rose curve] using trigonometric formulas with t1 and t2, 
    and map it to screen coordinates using scale_factor, cx, and cy."

3. Gemini will generate the complete Vala code block for mathfunction4.vala.
4. Save the code into your source directory as mathfunction4.vala.
5. Follow steps 3 to 5 from the section above to register and compile it!

----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
Distributed under the GPV2 or later License. See LICENSE for details.