Skip to content

chaos-polymtl/cesogen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cesogen

Cellular solid generator.

NOTE: Cesogen is currently unreleased and under active development. It is made available only for the convenience of the author and for evaluation by readers and reviewers of the paper presenting it. All branches including the main branch may be rebased at any time and patches will be disregarded until an initial version is released.

Description

Cesogen is a mesh generator for cellular solids and general signed distance functions (SDFs). It knows the SDFs of various primitive shapes and also triply periodic, minimal surface (TPMS)–like surfaces (TPMS-likes) — a kind of cellular solid — which it can combine via SDF operations like the standard mathematical transformations and boolean operators to finally generate a triangle mesh via the marching cubes algorithm.

Installing the utility

The Cesogen utility is not packaged for any operating systems, so you must download, build and install it manually.

Cesogen depends on SBCL and various Common Lisp dependencies which may be fetched automatically. Fetching the dependencies depends on curl and tar, both of which are installed by default in Ubuntu, macOS and Windows. If curl is missing or of a version earlier than 7.67.0, which is possible on various Unix-likes, install it with a variant of

apt-get install curl # Debian
brew install curl    # macOS

Install SBCL according to your platform:

apt-get install sbcl     # Debian
brew install sbcl        # macOS
winget install SBCL.SBCL # Windows

Download and extract the latest commit of Cesogen:

curl https://git.sr.ht/~paulapatience/cesogen/archive/draft.tar.gz | tar -xzf-

From within the extracted directory, fetch the Common Lisp dependencies:

sbcl --script scripts/passel-fetch.lisp -o ext -v qlfile

On Windows, tar may complain about the asdf-*/contrib/debug.lisp file. It is a symbolic link which is not created, and it is unnecessary for Cesogen.

Build the utility:

sbcl --script scripts/build.lisp

On Linux you may also build Cesogen in a container, for which you will need Podman and make. Cesogen can be built statically, or linked against musl (for musl-based Linux distributions) or glibc (for most Linux distributions, including Ubuntu), with one of the following commands:

make container-static
make container-musl
make container-glibc

Examples

Generate a cubic gyroid, writing to file out.ply:

cesogen tpms.gyroid

Generate a spherical P surface, writing to file p.ply:

cesogen -o p.ply tpms.p ball intersection

Generate a Neovius surface with a smaller cell size and more samples to improve the resolution:

cesogen -s 50^3 tpms.neovius scale 1/2

Expand the bounds instead of shrinking the cell size to generate just as many, though larger, Neovius cells:

cesogen -s 50^3 -b -2,-2,-2,2,2,2 tpms.neovius

Generate an F-RD endoskeleton:

cesogen tpms.frd offset 0.5

And the corresponding exoskeleton:

cesogen tpms.frd offset 0.5 complement

Generate a gyroid shell:

cesogen tpms.gyroid shell 1

And an eccentric version:

cesogen tpms.gyroid offset 0.4 shell 1

Generate a P surface via its explicit expression:

cesogen expression 'cos(2pi*x)+cos(2pi*y)+cos(2pi*z)'

Generate an hourglass-like object:

cesogen -b -1,-1,-1,1,1,1 \
        cylinder scale 1/2 orient 1,0,0 move 0,-1,0 \
        cylinder scale 1/2 orient 1,0,0 move 0,1,0 \
        union complement

Another way to generate the same object:

cesogen -b -1,-1,-1,1,1,1 \
        cylinder move 0,-2,0 cylinder move 0,2,0 union \
        scale 1/2 orient 1,0,0 complement

Documentation

Cesogen is documented in the cesogen(1) manual page (render it with man -l cesogen.1 on a Unix-like), which is also available in Markdown form.

See also

Other cellular solid generators include:

Of those, only Scaffolder and ASLI have command-line interfaces.

Acknowledgments

The API of the CESOGEN/FIELDS package is inspired by fogleman/sdf's, and some of the operations are implemented in the same way.

Some of the SDF formulas are from Inigo Quilez's list of signed distance functions.

The CESOGEN/PROXIMITY package contains a refactored port of parts of the MIT licensed, TriangleMeshDistance C++ library.

meshio was invaluable in developing and testing the CESOGEN/SERDES package.

License

This project is licensed under the MIT license (Expat).

Unless you explicitly state otherwise, any contribution intentionally submitted by you for inclusion in this project shall be licensed as above, without any additional terms or conditions.

About

Mirror of sr.ht repository

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published