- FOSSIL is a pure Fortran (KISS) library for IO and manipulation of STL (Stereo Litography) files for modern (2003+) Fortran projects;
- FOSSIL is Fortran 2003+ standard compliant;
- FOSSIL is OOP designed;
- FOSSIL is TDD designed;
- FOSSIL is a Free, Open Source Project.
What is FOSSIL? | Main features | Copyrights | Documentation | A Taste of FOSSIL
FOSSIL is a pure Fortran (KISS) library for IO and manipulation of STL (Stereo Litography) files for modern (2003+) Fortran projects.
FOSSIL provides a simple API to IO STL files and also to manipulate the triangulated surface contained into the STL file.
the dragon STL test (src/tests/dragon.stl) is composed by 6588 triangular facets. The signed distance computation on a uniform grid of
64^3
is accelerated by a factor of 7x using AABB algorithm with respect the simple brute force.
automatic repair of disconnected edges.
Go to Top
- User-friendly methods for IO STL files:
- input:
- automatic guessing of file format (ASCII or BINARY);
- load STL file effortless;
- output:
- save STL file effortless;
- input:
- powerful surface analysis and manipulation:
- build facets connectivity;
- sanitize normals:
- reverse normals:
- make normals consistent:
- compute volume;
- clip surface outside a bounding box;
- merge STL files;
- rotate facets;
- translate facets;
- mirror facets;
- resize (scale) facets;
- compute minimal distance:
- square distance;
- square root distance;
- signed distance:
- by means of solid angle computation;
- by means of rays intersection count;
- AABB (Axis-Aligned Bounding Box) tree acceleration with user defined refinement levels;
- point-in-polyhedra test:
- by means of solid angle computation;
- by means of rays intersection count;
- fill holes;
- check surface watertight:
- identify disconected edges;
- connect nearby facets;
- errors trapping mechanism.
Any feature request is welcome.
Go to Top
FOSSIL is an open source project, it is distributed under a multi-licensing system:
- for FOSS projects:
- for closed source/commercial projects:
Anyone is interest to use, to develop or to contribute to FOSSIL is welcome, feel free to select the license that best matches your soul!
More details can be found on wiki.
Go to Top
Besides this README file the FOSSIL documentation is contained into its own wiki. Detailed documentation of the API is contained into the GitHub Pages that can also be created locally by means of ford tool.
FOSSIL is an KISS library:
effortless load of file (with STL surface analysis)
use fossil
type(file_stl_object) :: file_stl ! STL file handler.
type(surface_stl_object) :: surface_stl ! STL surface handler.
call file_stl%initialize(file_name='cube.stl')
call file_stl%load_from_file(surface=surface_stl, guess_format=.true.)
print main informations of STL
print '(A)', file_stl%statistics()
print '(A)', surface_stl%statistics()
upon exection will print something like
Mesh_1
file name: src/tests/cube.stl
file format: ascii
X extents: [ 0.000000000000000E+000, +0.100000000000000E+001]
Y extents: [ 0.000000000000000E+000, +0.100000000000000E+001]
Z extents: [ 0.000000000000000E+000, +0.100000000000000E+001]
volume: -0.100000000000000E+001
centroid: [+0.500000000000000E+000, +0.500000000000000E+000, +0.500000000000000E+000]
number of facets: +12
number of facets with 1 edges disconnected: +0
number of facets with 2 edges disconnected: +0
number of facets with 3 edges disconnected: +0
number of AABB refinement levels: +2
make normals consistent
call surface_stl%sanitize_normals
simply manipulate geometry
call surface_stl%resize(factor=3.4*ex + 2*ey + 0.5*ez) ! ex, ey, ez being axis versors
call surface_stl%resize(x=0.5, z=1.2) ! scale only x and z axis
call surface_stl%mirror(normal=ex) ! mirror respect yz-plane
call surface_stl%mirror(normal=ex+ey) ! mirror respect plane with normal ex+ey
call surface_stl%mirror(matrix=matrix) ! mirror by a given mirroring matrix
call surface_stl%rotate(axis=ex, angle=1.57) ! rotate around x axis by pi/2
call surface_stl%rotate(matrix=matrix) ! rotati by a given rotating matrix
call surface_stl%translate(delta=3*ex + 2*ey + 0.5*ez) ! translate by a vectorial delta
call surface_stl%translate(x=0.5, z=1.2) ! translate by only x and z delta
Go to Top