Skip to content

szaghi/FOSSIL

Repository files navigation

FOSSIL

FOrtran Stereo Litography parser

a pure Fortran 2003+ OOP library for reading, writing, and manipulating STL mesh files.

CI Coverage GitHub tag License

📂 ASCII & binary STL
Auto-detect format with guess_format=.true. — no manual selection needed
🔧 Surface manipulation
Translate, rotate, mirror, resize, clip, and merge STL surfaces
📐 Geometry analysis
Volume, centroid, bounding box, connectivity, and disconnected edges
🔨 Mesh repair
Sanitize and reverse facet normals; reconnect nearby vertices automatically
📏 Distance & inside queries
Signed distance and point-in-polyhedron via solid angle or ray intersection
AABB octree
Up to 7× faster distance queries over brute force using an 8-child octree
🏗️ OOP/TDD designed
Three types (file_stl_object, surface_stl_object, facet_object), all functionality as type-bound procedures
🖥️ fossilizer CLI
Companion command-line app for interactive STL analysis and manipulation

For full documentation (guide, API reference, examples, etc...) see the FOSSIL website.

dragon cube
the dragon STL test (src/tests/dragon.stl) is composed by 6588 triangular facets. The signed distance computation on a uniform grid of 64³ is accelerated by a factor of 7× using AABB algorithm with respect the simple brute force. automatic repair of disconnected edges.

Authors

Contributions are welcome — see the Contributing page.

Copyrights

This project is distributed under a multi-licensing system:

Anyone interested in using, developing, or contributing to this project is welcome — pick the license that best fits your needs.


Quick start

use fossil
use penf, only: R8P
implicit none
type(file_stl_object)    :: file_stl
type(surface_stl_object) :: surface

call file_stl%load_from_file(facet=surface%facet, file_name='cube.stl', guess_format=.true.)
call surface%analize
print '(A)', surface%statistics()

call surface%sanitize_normals
call surface%translate(x=1.0_R8P, y=2.0_R8P, z=0.5_R8P)
call file_stl%save_into_file(facet=surface%facet, file_name='cube-moved.stl')

See src/tests/ for more examples including clipping, distance queries, and point-in-polyhedron tests.


Install

FoBiS

Standalone — clone with submodules and build:

git clone https://github.com/szaghi/FOSSIL --recursive && cd FOSSIL
FoBiS.py build -mode static-gnu   # build static library
FoBiS.py build -mode tests-gnu && ./scripts/run_tests.sh  # build and run tests

As a project dependency — declare FOSSIL in your fobos and run fetch:

[dependencies]
deps_dir = src/third_party
FOSSIL = https://github.com/szaghi/FOSSIL
FoBiS.py fetch           # fetch and build
FoBiS.py fetch --update  # re-fetch and rebuild

CMake

git clone https://github.com/szaghi/FOSSIL --recursive && cd FOSSIL
cmake -B build && cmake --build build && ctest --test-dir build

As a CMake subdirectory:

add_subdirectory(FOSSIL)
target_link_libraries(your_target FOSSIL::FOSSIL)

About

FOSSIL, FOrtran Stereo (si) Litography parser

Resources

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors