As an amateur coder many years ago, I wrote some libre software called ePiX ("epic" with a soft k) to create mathematically-accurate, typographically-matching figures for a paper.
An ePiX source file is a C++ program containing high-level picture commands. When the program is compiled and run, it writes a LaTeX picture environment and optionally compiles that into a stand-alone PDF file; shell scripts manage the details.
There is 3D capability, but it often needs human supervision. Although the code base works, modifying the internals would be difficult. I recommend against looking in there.
That said, writing new high-level features is straightforward. I use ePiX to create all T-shirt and poster designs in my online shop; all images and animations I post on social media; all diagrams in my papers, books, and teaching materials since 2007. I used ePiX to create illustrations for "Lie Sphere Geometry" by Tom Cecil, "Complex Function Theory" by Don Sarason, and two issues (2008 and 2021) of "What's Happening in the Mathematical Sciences" by Dana MacKenzie.
<>
If there is a current ePiX package for your operating system I recommend installing that; otherwise, install from sources. The project page (below) links to the source tarball.
There is a very short blog post here: https://www.diffgeom.com/blogs/free-online-math-materials/epix-drawing-for-latex/
The project page is: https://diffgeom.org/epix/index.html
There is a gallery of 80 sample images/animations and their source files (the sample files are included with the source tarball): https://diffgeom.org/epix/images/index.html
The sources come with a tutorial/manual. There is also a short Tips and Tricks document linked from the project page (not included with the source package): https://diffgeom.org/epix/epix_tips_and_tricks.pdf