Skip to content

Graphite is simple 2D/3D math visual app like geogebra, desoms, matplotlib in python. It works on c++ scripting language. It is based how scripts works via using interfaces and dll loading. Allows how swap dll on runtime for easy and nice experience. It uses my own rendering library CWindow.

License

Notifications You must be signed in to change notification settings

Daynlight/Graphite

⚪️ Graphite ⚪️

Simple, fast 2D/3D math visual app (like GeoGebra) using C++ scripting and hot-reloadable DLLs.

About

Graphite is a lightweight 2D/3D math visualization app similar to GeoGebra or matplotlib, but built with C++ scripting and hot-reloadable DLLs for fast interactive development. It uses the author's rendering library CWindow.

Why it exists:

  • I dislike Python 🐍
  • GeoGebra can be slow 🐢
  • I enjoy building my own tools 💻
  • Learning & experimentation 🎓

Who it's for:

  • People who want a faster graphical math app ⚡
  • People who hate Python ❤️

Screenshots

Bezier Sin

Table of Contents

Installation

git clone --recursive https://github.com/daynlight/Graphite.git
cd Graphite

mkdir -p build
cd build
cmake ..
cmake --build . --config Release
cd ..

cd bin/
sudo ./GraphiteInstaller

cd ../..

Usage

Run

  1. Start Graphite:
Graphite <flags> <path>
  1. Example script (Graphite.cpp)
// Graphite
// Copyright 2025 Daynlight
// Licensed under the Apache License, Version 2.0.
// See LICENSE file for details.

#define  BUILDING_SCRIPT_DLL
#include <Graphite/ScriptInterface.h>
#include <Graphite/Math.h>

#include <math.h>

#define SAMPLES 1000

class Script : ScriptInterface {
  Graphite::Math::Point points[SAMPLES];
  float f(float x) { return (1/2.0f) * sin(x * M_PI * 2); }

  void Init() {
    for (int i = 0; i < SAMPLES; i++) {
      float x = (i / (SAMPLES - 1.0f) * 2) - 1;
      float y = f(x);
      points[i].setPos({x, y});
    }
  }

  void Update() { }

  void Draw() {
    for (int i = 0; i < SAMPLES; i++)
      points[i].drawPoint();
  }

  void Destroy() { }
};

extern "C" ScriptInterface* SCRIPT_API GetScript() {
  Script* script = new Script();
  return (ScriptInterface*)script;
};

extern "C" void SCRIPT_API DeleteScript(ScriptInterface* script) {
  Script* temp_script = (Script*)script;
  delete temp_script;
};

Flags

  • -h, --help — show program help
  • -i, --init — initialize default files
  • -s, --sandbox — enable sandbox mode (recommended for editing)
  • -v, -d, --verbose, --debug — verbose / debug output

Path

The final path is the last argument. If a filename is specified it will create a directory instead.

Important Note ⚠️

  • Use sandbox mode for development and live-editing to avoid crashes: Graphite -s <path> or Graphite -s -v <path>.
  • Sandbox runs the script in a fork for safer testing; if the script crashes, it won't take down the host process.
  • Always end all threads and free allocations in Destroy() to avoid leaks and undefined behavior.
  • When your script is stable, run in normal mode for better performance.
  • Sandbox performs an initial test run in the fork before the main execution to catch runtime issues early.

Prerequisites

  • CMake (for building)
  • C++17 (compiler)
  • Git (for cloning repo and submodules)

Versions and features

v2.0.0
  • Installer
  • Plots
  • Math Interface for Plots
  • Better Point Class
  • Line Class
  • Polynomial Class
  • Ui
  • Templates
v1.0.1
  • ScriptController edge-case handling
  • Sandbox mode now tests before execution
  • Edge-case fixes for Graphite, Flags, AppRenderer, ScriptLoader
v1.0.0
  • Sandbox mode
  • Script sandbox last-write detection
  • Separate CWindow renderer via AppRenderer
  • Safer script destroy
Prototype
  • Hot script loading
  • Help flag
  • Init flag
  • Verbose flag
  • Points rendering
  • Multiple point prints
  • Installation guide
  • Docs
  • Auto create path

Other Docs

Cat 🐱

cat

About

Graphite is simple 2D/3D math visual app like geogebra, desoms, matplotlib in python. It works on c++ scripting language. It is based how scripts works via using interfaces and dll loading. Allows how swap dll on runtime for easy and nice experience. It uses my own rendering library CWindow.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project