{"id":15056187,"url":"https://github.com/miho/jcsg","last_synced_at":"2025-04-07T13:06:24.163Z","repository":{"id":14865019,"uuid":"17588440","full_name":"miho/JCSG","owner":"miho","description":"Java implementation of BSP based CSG (Constructive Solid Geometry)","archived":false,"fork":false,"pushed_at":"2023-06-03T20:17:46.000Z","size":5223,"stargazers_count":170,"open_issues_count":21,"forks_count":50,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-02-12T17:03:24.170Z","etag":null,"topics":["cad","constructive-solid-geometries","csg","geometry-library","java","javafx","javafx-library","jcsg","vrl"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miho.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2014-03-10T10:03:02.000Z","updated_at":"2024-02-12T17:03:24.171Z","dependencies_parsed_at":"2024-01-06T22:29:51.094Z","dependency_job_id":"8e3de5c2-fa3b-4238-83f4-28efe6937abe","html_url":"https://github.com/miho/JCSG","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FJCSG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FJCSG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FJCSG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miho%2FJCSG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miho","download_url":"https://codeload.github.com/miho/JCSG/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657277,"owners_count":20974344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cad","constructive-solid-geometries","csg","geometry-library","java","javafx","javafx-library","jcsg","vrl"],"created_at":"2024-09-24T21:48:49.079Z","updated_at":"2025-04-07T13:06:24.129Z","avatar_url":"https://github.com/miho.png","language":"Java","readme":"JCSG\n=======\n\n[![Build Status](https://travis-ci.org/miho/JCSG.png?branch=master)](https://travis-ci.org/miho/JCSG)\n[![Javadocs](https://www.javadoc.io/badge/eu.mihosoft.vrl.jcsg/jcsg.svg)](https://www.javadoc.io/doc/eu.mihosoft.vrl.jcsg/jcsg)\n\u003ca href=\"https://foojay.io/today/works-with-openjdk\"\u003e\n   \u003cimg align=\"right\" \n        src=\"https://github.com/foojayio/badges/raw/main/works_with_openjdk/Works-with-OpenJDK.png\"   \n        width=\"100\"\u003e\n\u003c/a\u003e\n\n\u003cbr\u003e\n\n\nJava implementation of BSP based CSG (Constructive Solid Geometry). It is the only simple and free Java implementation I am aware of. This implementation uses an optimized CSG algorithm based on [csg.js](https://github.com/evanw/csg.js) (see `CSG` and `Node` classes). Thanks to the author for creating the [csg.js](https://github.com/evanw/csg.js) library.\n\nThere's also the related [VCSG](https://github.com/miho/VCSG) library, a [plugin for VRL-Studio](https://github.com/VRL-Studio/VRL-JCSG) and two extension libraries: [JCSG-MeshExtension](https://github.com/miho/JCSG-MeshExtensions) and [JCSG-PathExtension](https://github.com/miho/JCSG-PathExtensions).\n\nIn addition to CSG this library provides the following features:\n\n- optimized `difference()` and `union()` operations (many thanks to Sebastian Reiter)\n- extrusion of concave, non-intersecting polygons (uses [Poly2Tri](https://code.google.com/p/poly2tri/) for triangulation)\n- convex hull (uses [QuickHull3D](https://www.cs.ubc.ca/~lloyd/java/quickhull3d.html))\n- weighted transformations (Scale, Rotation, Translation and Mirror)\n- STL import and export (STLLoader from [Fiji](https://github.com/fiji/fiji/blob/master/src-plugins/3D_Viewer/src/main/java/customnode/STLLoader.java))\n- OBJ export including material information (see screenshot below)\n- supports conversion of CSG's to `JavaFX 3D` nodes\n- 3d text support (using [FXyz](https://github.com/FXyz/FXyz))\n\n**JCSG** on [stackoverflow](http://stackoverflow.com/search?q=jcsg).\n\n![](/resources/screenshot2.png)\n\nTo see what's possible with JCSG try [JFXScad](https://github.com/miho/JFXScad).\n\n![](https://raw.githubusercontent.com/miho/JFXScad/master/resources/img/screenshot-02.png)\n\n## How to Build JCSG\n\n### Requirements\n\n- Java \u003e= 11\n- Internet connection (dependencies are downloaded automatically)\n- IDE: [Gradle](http://www.gradle.org/) Plugin (not necessary for command line usage)\n\n### IDE\n\nOpen the `JCSG` [Gradle](http://www.gradle.org/) project in your favourite IDE (tested with NetBeans 7.4) and build it\nby calling the `assemble` task.\n\n### Command Line\n\nNavigate to the [Gradle](http://www.gradle.org/) project (e.g., `path/to/JCSG`) and enter the following command\n\n#### Bash (Linux/OS X/Cygwin/other Unix-like shell)\n\n    bash gradlew assemble\n    \n#### Windows (CMD)\n\n    gradlew assemble\n\n## Code Sample:\n\n\n```java\n\n// we use cube and sphere as base geometries\nCSG cube = new Cube(2).toCSG();\nCSG sphere = new Sphere(1.25).toCSG();\n\n// perform union, difference and intersection\nCSG cubePlusSphere = cube.union(sphere);\nCSG cubeMinusSphere = cube.difference(sphere);\nCSG cubeIntersectSphere = cube.intersect(sphere);\n        \n// translate geometries to prevent overlapping \nCSG union = cube.\n        union(sphere.transformed(Transform.unity().translateX(3))).\n        union(cubePlusSphere.transformed(Transform.unity().translateX(6))).\n        union(cubeMinusSphere.transformed(Transform.unity().translateX(9))).\n        union(cubeIntersectSphere.transformed(Transform.unity().translateX(12)));\n        \n// save union as stl\ntry {\n    FileUtil.write(\n            Paths.get(\"sample.stl\"),\n            union.toStlString()\n    );\n} catch (IOException ex) {\n    Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);\n}\n```\n\n## Thanks to\n\n - [JetBrains](https://www.jetbrains.com) for their [IntelliJ IDEA](https://www.jetbrains.com/idea/) license(s)\n\n - Evan Wallace for creating the JavaScript library [csg.js](https://github.com/evanw/csg.js)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiho%2Fjcsg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiho%2Fjcsg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiho%2Fjcsg/lists"}