Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a6cbe07
The changes required to compile one program with modular maths
sebsjames Mar 4, 2026
f9a38ad
Removes some unnecessary headers
sebsjames Mar 4, 2026
447a015
gcc 14 or probably higher
sebsjames Mar 4, 2026
005cce3
Attempting to compile any VIsual other than CoordArrows causes circul…
sebsjames Mar 4, 2026
7966abd
Minor change in maths
sebsjames Mar 5, 2026
3ce2211
Updates before batch upgrades
sebsjames Mar 5, 2026
fa82e13
Converts to imports
sebsjames Mar 5, 2026
c75f9fc
Changes required to compile showcase with moduled maths
sebsjames Mar 5, 2026
7686f17
Welcome to circular dependency hell.
sebsjames Mar 5, 2026
c892bd7
The circular dependency problem is that VisualBase needs to know abou…
sebsjames Mar 5, 2026
d4b27ca
Trying to write VisualModels out of mplot::Visual
sebsjames Mar 5, 2026
e91c76a
The VisualModel-based coords is now called CoordsVisual
sebsjames Mar 5, 2026
8c3ed3f
Still got the circ dep.
sebsjames Mar 5, 2026
fa2728d
The start if an idea to allow VisualModels to get state from VisualRe…
sebsjames Mar 5, 2026
afe49bf
More hacking, needto be more awake really
sebsjames Mar 5, 2026
8bdb664
Removing base classes where unnecessary
sebsjames Mar 6, 2026
af3c1ef
WIP
sebsjames Mar 6, 2026
40c7d8f
Compiles to objects now - just got to figure out linking
sebsjames Mar 6, 2026
c4f305a
Compile glad as a lib and link
sebsjames Mar 6, 2026
44c4bfd
And that gets the fonts into a library
sebsjames Mar 6, 2026
15313c5
Helloworld now runssgit add -u
sebsjames Mar 6, 2026
9312e7a
Trying to make helloworld and rod work in clang-20 and gcc-15. Not th…
sebsjames Mar 6, 2026
679c6e6
Clang23 now builds both helloworld AND rod!
sebsjames Mar 6, 2026
cbad5a1
Prefer static linking of glad
sebsjames Mar 6, 2026
f8e2e40
Forgotten files
sebsjames Mar 6, 2026
73c7518
grid_simple now works. VisualModel, VisualDataModel modularized.
sebsjames Mar 8, 2026
891e12e
graph1 now compiles
sebsjames Mar 8, 2026
e1ba0f3
modularize GraphVisual
sebsjames Mar 8, 2026
0d0461b
Preemptive update of readme
sebsjames Mar 8, 2026
4338b73
Breadcrumbs example works
sebsjames Mar 8, 2026
ea9609f
modularize GridVisual
sebsjames Mar 8, 2026
2b582bb
Modularlized RodVisual
sebsjames Mar 8, 2026
47115bc
Back to just one CoordArrows, and that one derived from VisualModel
sebsjames Mar 8, 2026
6fa7c60
Modularizes VectorVisual
sebsjames Mar 8, 2026
0982102
Modularizes InstancedScatterVisual
sebsjames Mar 8, 2026
ada6c9c
MOdularize EyeVisual and SphereVisual
sebsjames Mar 8, 2026
90aa679
Modularize NormalsVisual, VerticesVisual, all towards compiling antpov
sebsjames Mar 8, 2026
76778bd
Makes some colourmaps into modules to sidestep gcc-15 errors
sebsjames Mar 9, 2026
b25cdf1
Uses ifstream and fstream
sebsjames Mar 9, 2026
54f394a
cstdint for uint8_t
sebsjames Mar 9, 2026
6cc37aa
Undoes a wrong change
sebsjames Mar 9, 2026
4c5d9d6
Changes for g++. location of nlohmann makes a difference. g++ didn't …
sebsjames Mar 9, 2026
e865b46
Modularizes geodesic visual
sebsjames Mar 9, 2026
b8e5a1e
fixes
sebsjames Mar 9, 2026
91dd350
Trivial
sebsjames Mar 9, 2026
550b6a9
Latest maths
sebsjames Mar 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "maths"]
path = maths
url = https://github.com/sebsjames/maths
[submodule "json"]
path = json
url = https://github.com/nlohmann/json
16 changes: 9 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cmake_minimum_required(VERSION 3.14)
project(mathplot)
cmake_minimum_required(VERSION 3.28.5)
project(mathplot LANGUAGES CXX C)
# Note that the project version is encoded in mplot/version.h and not in this CMakeLists.txt

message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS " (This can be changed with `cmake -DCMAKE_INSTALL_PREFIX=/some/place`")

#
# The base C++ version in mathplot is current C++-17 but I am considering C++20 or 23
# We're firmly at C++20.
#
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -44,9 +44,9 @@ else()
set(CMAKE_CXX_FLAGS "-Wall -g -std=c++20 -xHOST -O3")
else() # GCC or Clang
if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
# Add compiler version check, to ensure gcc is version 11 or later.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11)
message(FATAL_ERROR "GCC version must be at least 11")
# Add compiler version check, to ensure gcc is version 14? 15? or later.
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14)
message(FATAL_ERROR "GCC version must be at least 14")
else()
message(STATUS "GCC version ${CMAKE_CXX_COMPILER_VERSION} OK!")
endif()
Expand Down Expand Up @@ -155,7 +155,9 @@ else()
endif()

# Use packaged nlohmann json
find_package(nlohmann_json REQUIRED)
# find_package(nlohmann_json REQUIRED)
# Now nlohmann is submoduled to get an up-to-date version (for C++ modules)
include_directories("${PROJECT_SOURCE_DIR}/json/include")

# If Qt5 is present, then some optional Qt examples will be compiled
find_package(Qt5 QUIET COMPONENTS Gui Core Widgets)
Expand Down
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,45 +36,47 @@ This quick start shows dependency installation for Linux, because on this platfo
sudo apt install build-essential cmake git wget \
nlohmann-json3-dev librapidxml-dev \
freeglut3-dev libglu1-mesa-dev libxmu-dev libxi-dev \
libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev
libglfw3-dev libfreetype-dev libarmadillo-dev libhdf5-dev clang-23 # yes, it's bleeding edge, no this won't work

git clone --recurse-submodules git@github.com:sebsjames/mathplot # Get your copy of the morphologica code
cd mathplot
mkdir build # Create a build directory
cd build
cmake .. # Call cmake to generate the makefiles
make graph1 # Compile a single one of the examples. Add VERBOSE=1 to see the compiler commands.
cmake .. -GNinja # Call cmake to generate the makefiles
ninja graph1 # Compile a single one of the examples. Add VERBOSE=1 to see the compiler commands.
./examples/graph1 # Run the program. You should see a graph of a cubic function.
# After closing the graph1 program, open its source code and modify something (see examples/graph2.cpp for ideas)
gedit ../examples/graph1.cpp
```
The program graph1.cpp is:
```c++
// Visualize a graph. Minimal example showing how a default graph appears
#include <sm/vvec> // vvec is part of Seb's maths library
#include <mplot/Visual.h>
#include <mplot/GraphVisual.h>
#include <memory>
import mplot.visual;
import mplot.graphvisual; // exports sm.vvec and sm.vec

int main()
{
// Set up your mplot::Visual 'scene environment'.
// Set up a mplot::Visual 'scene environment'.
mplot::Visual v(1024, 768, "Made with mplot::GraphVisual");
// Create a new GraphVisual object with offset within the scene of 0,0,0
// Create a GraphVisual object (obtaining a unique_ptr to the object) with a spatial offset within the scene of 0,0,0
auto gv = std::make_unique<mplot::GraphVisual<double>> (sm::vec<float>({0,0,0}));
// Boilerplate bindmodel function call - do this for every model you add to a Visual
v.bindmodel (gv);
// Data for the x axis. sm::vvec is like std::vector, but with built-in maths methods
// This mandatory line of boilerplate code sets the parent pointer in GraphVisual and binds some functions
gv->set_parent (v.get_id());
// Data for the x axis. A vvec is like std::vector, but with built-in maths methods
sm::vvec<double> x;
// This works like numpy's linspace() (the 3 args are "start", "end" and "num"):
x.linspace (-0.5, 0.8, 14);
// Set a graph up of y = x^3
gv->setdata (x, x.pow(3));
// finalize() makes the GraphVisual compute the vertices of the OpenGL model
gv->finalize();
// Add the GraphVisual OpenGL model to the Visual scene (which takes ownership of the unique_ptr)
// Add the GraphVisual OpenGL model to the Visual scene, transferring ownership of the unique_ptr
v.addVisualModel (gv);
// Render the scene on the screen until user quits with 'Ctrl-q'
v.keepOpen();
// Because v owns the unique_ptr to the GraphVisual, its memory will be deallocated when v goes out of scope.
return 0;
}
```
The program generates a clean looking graph...
Expand Down
8 changes: 4 additions & 4 deletions doxygen/Doxyfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = morphologica
PROJECT_NAME = mathplot
PROJECT_NUMBER = git main
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doc_doxygen/
OUTPUT_LANGUAGE = English
Expand Down Expand Up @@ -63,11 +63,11 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = ../morph ../morph/nn ../morph/bn ../README.md ../morph/gl ../morph/qt ../morph/wx ../morph/linuxos
INPUT = ../mplot ../mplot/compoundray ../mplot/fonts ../README.md ../mplot/fps ../mplot/gl ../mplot/glad ../mplot/healpix ../mplot/jcvoronoi ../mplot/qt ../mplot/wx ../maths/sm
USE_MDFILE_AS_MAINPAGE = README.md
FILE_PATTERNS = *.h
FILE_PATTERNS = *
RECURSIVE = NO
EXCLUDE = ../morph/nlohmann ../morph/rapidxml.hpp ../morph/rapidxml_iterators.hpp ../morph/rapidxml_print.hpp ../morph/rapidxml_utils.hpp ../morph/lodepng.h
EXCLUDE = ../mplot/nlohmann
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
Expand Down
4 changes: 2 additions & 2 deletions doxygen/Doxyfile_local.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = morphologica
PROJECT_NAME = mathplot
PROJECT_NUMBER = @VERSION@
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doc_doxygen/
OUTPUT_LANGUAGE = English
Expand Down Expand Up @@ -63,7 +63,7 @@ WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/morph/ @CMAKE_CURRENT_SOURCE_DIR@/tests @CMAKE_CURRENT_SOURCE_DIR@/README.md
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/mplot/ @CMAKE_CURRENT_SOURCE_DIR@/tests @CMAKE_CURRENT_SOURCE_DIR@/README.md
USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/README.md
FILE_PATTERNS = *.h
RECURSIVE = NO
Expand Down
Loading
Loading