{"repo":"executionunit/csgjs-cpp","free":true,"listed":false,"github":"https://github.com/executionunit/csgjs-cpp","clone":"git clone https://github.com/executionunit/csgjs-cpp.git","description":"Constructive Solid Geometry utility code in C++ (ported from a JS Library).","language":"C++","stars":24,"topics":["csg","cpp","gamedev","c-plus-plus","graphics-programming","mesh-processing","cmake","polygon"],"license":"MIT","category":"game-templates","readme_excerpt":"csgjs-cpp Building on the work by dabroz who ported the Javascript code to cpp. C onstructive S olid G eometry J ava S cript C P lus P lus. This library uses a fairly robust but not particularly efficient algorithm using BSP trees to perform boolean operations: union subtraction intersection on geometric shapes made from convex polygons. For examples, look at the original JS library which has interactive examples! https://evanw.github.io/csg.js/more.html As with the initial JS implementation and the initial C++ port this code is licensed under the MIT license. The main.cpp file has a simple Timer class that only works on windows. Annoyingly even with C++11 the high resolution timer isn't recommended for use. Building The code uses CMake (version 3.14 or greater). I've tested building on Windows, Linux and macOS. Performance measurements are only done on Windows (see Timer comment above). Running Build the code and run it, there are no options. When you run the executable to saves out numerous 3D PLY files to the current directory. Images These are taken using MeshLab a great viewer for PLY files. auto a = csgsmodel cube({0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f}, white); auto b = csgsmodel sphere({0, 0, 0}, 1.35f, white, 16); auto c = csgsmodel cylinder({-1, 0, 0}, {1, 0, 0}, 0.7f, red); auto d = csgsmodel cylinder({0, -1, 0}, {0, 1, 0}, 0.7f, green); auto e = csgsmodel cylinder({0, 0, -1}, {0, 0, 1}, 0.7f, blue); // JS a.intersect(b).subtract(c.union(d).union(e)) auto model = cs","default_branch":null,"files":null,"tree":[],"storefront":"/r/executionunit","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/executionunit/csgjs-cpp/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}