The C library API¶
Defines
-
STL_MAX
(A, B)¶
-
STL_MIN
(A, B)¶
-
ABS
(X)¶
-
LABEL_SIZE
¶
-
NUM_FACET_SIZE
¶
-
HEADER_SIZE
¶
-
STL_MIN_FILE_SIZE
¶
-
ASCII_LINES_PER_FACET
¶
-
SIZEOF_EDGE_SORT
¶
-
SIZEOF_STL_FACET
¶
Typedefs
-
typedef char
stl_extra
[2]¶
Functions
-
void
stl_open
(stl_file *stl, char *file)¶ Open an STL file and load it’s contents.
- Warning
- As IO operation, this could result in an error, always check the error flag with stl_get_error() or use stl_exit_on_error() after using stl_open()
- Parameters
stl
-The struct to load the file data to
file
-Path to the STL file
-
void
stl_close
(stl_file *stl)¶ Perform cleanup on stl_file.
This function frees memory, always use it, when you no longer needs the stl_file instance
- Parameters
stl
-What to close
-
void
stl_stats_out
(stl_file *stl, FILE *file, char *input_file)¶ Print statistics in human readable form to some file.
- Parameters
stl
-Where to obtain the statisctics
file
-Where to print the statisctics to (can be stdout)
input_file
-What filename to use in the human readable output
-
void
stl_print_edges
(stl_file *stl, FILE *file)¶ Print edges to some file.
- Warning
- This prints from edge_start array, that is never populated and thus this will never actually work
- Parameters
stl
-From what data
file
-Where to print the edges to (can be stdout)
-
void
stl_put_little_int
(FILE *fp, int value_in)¶
-
void
stl_put_little_float
(FILE *fp, float value_in)¶
-
void
stl_write_edge
(stl_file *stl, char *label, stl_hash_edge edge)¶
-
void
stl_normalize_vector
(float v)¶
-
void
stl_repair
(stl_file *stl, int fixall_flag, int exact_flag, int tolerance_flag, float tolerance, int increment_flag, float increment, int nearby_flag, int iterations, int remove_unconnected_flag, int fill_holes_flag, int normal_directions_flag, int normal_values_flag, int reverse_all_flag, int verbose_flag)¶
-
struct
stl_vertex
¶ - #include <admesh/stl.h>
Vertex of a facet, defined by 3D coordinates.
-
struct
stl_normal
¶ - #include <admesh/stl.h>
Normal vector of a facet, defined by 3D coordinates.
-
struct
stl_facet
¶ - #include <admesh/stl.h>
Facet, one triangle of the mesh.
-
struct
stl_edge
¶ - #include <admesh/stl.h>
Edge between two vertices.
Public Members
-
stl_vertex
p1
¶ start vertex
-
stl_vertex
p2
¶ end vertex
-
int
facet_number
¶ id of facet this edge belongs to
-
stl_vertex
-
struct
stl_hash_edge
¶ - #include <admesh/stl.h>
-
struct
stl_neighbors
¶ - #include <admesh/stl.h>
-
struct
stl_stats
¶ - #include <admesh/stl.h>
Statistics about the STL mesh.
Some of them are populated on stl_open() and after some operations, others, such as volume, have to be calculated by appropriate functions.
Public Members
-
char
header
[81]¶ header of the STL file
-
int
number_of_facets
¶ total number of facets
-
stl_vertex
max
¶ maximal dimensions of the mesh
-
stl_vertex
min
¶ minimal dimensions of the mesh
-
stl_vertex
size
¶ size of the bounding box
-
float
bounding_diameter
¶ diameter of the bounding box
-
float
shortest_edge
¶ length of the shortest edge
-
float
volume
¶ volume of the mesh, has to be calculated by stl_calculate_volume()
-
unsigned
number_of_blocks
¶ should be number of blocks, but is never set
-
int
connected_edges
¶ how many edges have been connected by ADMesh
-
int
connected_facets_1_edge
¶ how many facets are connected by at least 1 edge, get’s calculated during stl_check_facets_nearby()
-
int
connected_facets_2_edge
¶ how many facets are connected by at least 2 edges, get’s calculated during stl_check_facets_nearby()
-
int
connected_facets_3_edge
¶ how many facets are connected by all 3 edges, get’s calculated during stl_check_facets_nearby()
-
int
facets_w_1_bad_edge
¶ how many facets have exactly 1 unconnected edge, get’s calculated during stl_repair()
-
int
facets_w_2_bad_edge
¶ how many facets have exactly 2 unconnected edges, get’s calculated during stl_repair()
-
int
facets_w_3_bad_edge
¶ how many facets have exactly 3 unconnected edges, get’s calculated during stl_repair()
-
int
original_num_facets
¶ original number of facets when the file was loaded
-
int
edges_fixed
¶ how many edges were fixed by ADMesh
-
int
degenerate_facets
¶ number of removed degenerate facets
-
int
facets_removed
¶ number of removed degenerate facets
-
int
facets_added
¶ number of facets removed by stl_remove_unconnected_facets()
-
int
facets_reversed
¶ number of facets reversed by stl_fix_normal_directions()
-
int
backwards_edges
¶ number of edges that are backwards counted during stl_verify_neighbors()
-
int
normals_fixed
¶ number of normals fixed during stl_fix_normal_values()
-
int
number_of_parts
¶ number of parts (distinguished shells), calculated during stl_fix_normal_directions()
-
int
malloced
¶ how many edges have been malloced during stl_check_facets_nearby()
-
int
freed
¶ how many edges have been freed during stl_check_facets_nearby()
-
int
facets_malloced
¶ how many facets have been malloced
-
int
collisions
¶ internal collision counter for stl_check_facets_nearby()
number of shared vertices, populated by stl_generate_shared_vertices()
how many shared vertices have been malloced by stl_generate_shared_vertices()
-
char
-
struct
stl_file
¶ - #include <admesh/stl.h>
STL file.
The main structure representing the mesh. All functions take reference to this as a first argument.
Public Members
-
FILE *
fp
¶ pointer to associated file
-
stl_hash_edge **
heads
¶ head of linked list of edges, used internally by some repairs
-
stl_hash_edge *
tail
¶ tail of linked list of edges, used internally by some repairs
-
int
M
¶ magic variable, used internally by some repairs
-
stl_neighbors *
neighbors_start
¶ array of neighbors populated by various repairs
-
v_indices_struct *
v_indices
¶ internal array used by stl_generate_shared_vertices()
vertices array used by stl_generate_shared_vertices()
-
char
error
¶ error flag, when something went wrong, this is not 0
-
FILE *