FOSSIL STL file class.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| character(len=:), | public, | allocatable | :: | file_name | File name |
||
| integer(kind=I4P), | public | :: | file_unit | = | 0 | File unit. |
|
| character(len=FRLEN), | public | :: | header | File header. |
|||
| integer(kind=I4P), | public | :: | facets_number | = | 0 | Facets number. |
|
| type(facet_object), | public, | allocatable | :: | facet(:) | Facets. |
||
| type(aabb_tree_object), | public | :: | aabb | AABB tree. |
|||
| type(vector_R8P), | public | :: | bmin | Minimum point of STL. |
|||
| type(vector_R8P), | public | :: | bmax | Maximum point of STL. |
|||
| real(kind=R8P), | public | :: | volume | = | 0._R8P | Volume bounded by STL surface. |
|
| logical, | public | :: | is_ascii | = | .true. | Sentinel to check if file is ASCII. |
|
| logical, | public | :: | is_open | = | .false. | Sentinel to check if file is open. |
Analize STL.
Analize STL.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Build facets connectivity.
Build facets connectivity.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Close file.
Close file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Compute facets metrix.
Compute facets metrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Compute facets normals by means of vertices data.
Compute facets normals by means of vertices data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Compute volume bounded by STL surface.
Compute volume bounded by STL surface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Create the AABB tree.
Create AABB tree.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| integer(kind=I4P), | intent(in), | optional | :: | refinement_levels | Total number of refinement levels used. |
Destroy file.
Destroy file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Compute the (minimum) distance from point to triangulated surface.
Compute the (minimum) distance from a point to the triangulated surface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(in) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | point | Point coordinates. |
||
| logical, | intent(in), | optional | :: | is_signed | Sentinel to trigger signed distance. |
|
| character(len=*), | intent(in), | optional | :: | sign_algorithm | Algorithm used for "point in polyhedron" test. |
|
| logical, | intent(in), | optional | :: | is_square_root | Sentinel to trigger square-root distance. |
Minimum distance from point to the triangulated surface.
Initialize file.
Initialize file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| logical, | intent(in), | optional | :: | skip_destroy | Flag to skip destroy file. |
|
| character(len=*), | intent(in), | optional | :: | file_name | File name. |
|
| logical, | intent(in), | optional | :: | is_ascii | Sentinel to check if file is ASCII. |
Determinate is point is inside or not STL facets by ray intersect.
Determinate is a point is inside or not to a polyhedron described by STL facets by means ray intersections count.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(in) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | point | Point coordinates. |
Check result.
Determinate is point is inside or not STL facets by solid angle.
Determinate is a point is inside or not to a polyhedron described by STL facets by means of the solid angle criteria.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(in) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | point | Point coordinates. |
Check result.
Load from file.
Load from file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| character(len=*), | intent(in), | optional | :: | file_name | File name. |
|
| logical, | intent(in), | optional | :: | is_ascii | Sentinel to check if file is ASCII. |
|
| logical, | intent(in), | optional | :: | guess_format | Sentinel to try to guess format directly from file. |
|
| logical, | intent(in), | optional | :: | disable_analysis | Sentinel to disable STL analysis. |
Mirror facets.
Mirror facets given normal of mirroring plane.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | normal | Normal of mirroring plane. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Mirror facet given matrix (of mirroring).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Mirroring matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Open file, once initialized.
Open file, once initialized.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| character(len=*), | intent(in) | :: | file_action | File action, "read" or "write". |
||
| logical, | intent(in), | optional | :: | guess_format | Sentinel to try to guess format directly from file. |
Reverse facets normals.
Reverse facets normals.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Resize (scale) facets by x or y or z or vectorial factors.
Resize (scale) facets by x or y or z or vectorial factors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in), | optional | :: | x | Factor along x axis. |
|
| real(kind=R8P), | intent(in), | optional | :: | y | Factor along y axis. |
|
| real(kind=R8P), | intent(in), | optional | :: | z | Factor along z axis. |
|
| type(vector_R8P), | intent(in), | optional | :: | factor | Vectorial factor. |
|
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facets.
Rotate facets given axis and angle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | axis | Axis of rotation. |
||
| real(kind=R8P), | intent(in) | :: | angle | Angle of rotation. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facet given matrix (of ratation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Rotation matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Sanitize facets normals, make them consistent.
Sanitize facets normals, make them consistent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Save into file.
Save into file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| character(len=*), | intent(in), | optional | :: | file_name | File name. |
|
| logical, | intent(in), | optional | :: | is_ascii | Sentinel to check if file is ASCII. |
Return STL statistics.
Return STL statistics.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(in) | :: | self | File STL. |
||
| character(len=*), | intent(in), | optional | :: | prefix | Lines prefix. |
STL statistics.
Translate facet given vectorial delta.
Translate facets x or y or z or vectorial delta increments.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in), | optional | :: | x | Increment along x axis. |
|
| real(kind=R8P), | intent(in), | optional | :: | y | Increment along y axis. |
|
| real(kind=R8P), | intent(in), | optional | :: | z | Increment along z axis. |
|
| type(vector_R8P), | intent(in), | optional | :: | delta | Vectorial increment. |
|
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Overload =.
Operator =.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | lhs | Left hand side. |
||
| type(file_stl_object), | intent(in) | :: | rhs | Right hand side. |
Operator =.
Operator =.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | lhs | Left hand side. |
||
| type(file_stl_object), | intent(in) | :: | rhs | Right hand side. |
Allocate facets.
Allocate facets.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Load facets number from file.
Load facets number from file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Load header from file.
Load header from file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Mirror facets given normal of mirroring plane.
Mirror facets given normal of mirroring plane.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | normal | Normal of mirroring plane. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Mirror facets given matrix.
Mirror facet given matrix (of mirroring).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Mirroring matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facets given axis and angle.
Rotate facets given axis and angle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| type(vector_R8P), | intent(in) | :: | axis | Axis of rotation. |
||
| real(kind=R8P), | intent(in) | :: | angle | Angle of rotation. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facets given matrix.
Rotate facet given matrix (of ratation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Rotation matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Save header into file.
Save header into file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
Save trailer into file.
Save trailer into file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(file_stl_object), | intent(inout) | :: | self | File STL. |
type :: file_stl_object
!< FOSSIL STL file class.
character(len=:), allocatable :: file_name !< File name
integer(I4P) :: file_unit=0 !< File unit.
character(FRLEN) :: header !< File header.
integer(I4P) :: facets_number=0 !< Facets number.
type(facet_object), allocatable :: facet(:) !< Facets.
type(aabb_tree_object) :: aabb !< AABB tree.
type(vector_R8P) :: bmin !< Minimum point of STL.
type(vector_R8P) :: bmax !< Maximum point of STL.
real(R8P) :: volume=0._R8P !< Volume bounded by STL surface.
logical :: is_ascii=.true. !< Sentinel to check if file is ASCII.
logical :: is_open=.false. !< Sentinel to check if file is open.
contains
! public methods
procedure, pass(self) :: analize !< Analize STL.
procedure, pass(self) :: build_connectivity !< Build facets connectivity.
procedure, pass(self) :: close_file !< Close file.
procedure, pass(self) :: compute_metrix !< Compute facets metrix.
procedure, pass(self) :: compute_normals !< Compute facets normals by means of vertices data.
procedure, pass(self) :: compute_volume !< Compute volume bounded by STL surface.
procedure, pass(self) :: create_aabb_tree !< Create the AABB tree.
procedure, pass(self) :: destroy !< Destroy file.
procedure, pass(self) :: distance !< Compute the (minimum) distance from point to triangulated surface.
procedure, pass(self) :: initialize !< Initialize file.
procedure, pass(self) :: is_point_inside_polyhedron_ri !< Determinate is point is inside or not STL facets by ray intersect.
procedure, pass(self) :: is_point_inside_polyhedron_sa !< Determinate is point is inside or not STL facets by solid angle.
procedure, pass(self) :: load_from_file !< Load from file.
generic :: mirror => mirror_by_normal, &
mirror_by_matrix !< Mirror facets.
procedure, pass(self) :: open_file !< Open file, once initialized.
procedure, pass(self) :: reverse_normals !< Reverse facets normals.
procedure, pass(self) :: resize !< Resize (scale) facets by x or y or z or vectorial factors.
generic :: rotate => rotate_by_axis_angle, &
rotate_by_matrix !< Rotate facets.
procedure, pass(self) :: sanitize_normals !< Sanitize facets normals, make them consistent.
procedure, pass(self) :: save_into_file !< Save into file.
procedure, pass(self) :: statistics !< Return STL statistics.
procedure, pass(self) :: translate !< Translate facet given vectorial delta.
! operators
generic :: assignment(=) => file_stl_assign_file_stl !< Overload `=`.
procedure, pass(lhs), private :: file_stl_assign_file_stl !< Operator `=`.
! private methods
procedure, pass(self), private :: allocate_facets !< Allocate facets.
procedure, pass(self), private :: load_facets_number_from_file !< Load facets number from file.
procedure, pass(self), private :: load_header_from_file !< Load header from file.
procedure, pass(self), private :: mirror_by_normal !< Mirror facets given normal of mirroring plane.
procedure, pass(self), private :: mirror_by_matrix !< Mirror facets given matrix.
procedure, pass(self), private :: rotate_by_axis_angle !< Rotate facets given axis and angle.
procedure, pass(self), private :: rotate_by_matrix !< Rotate facets given matrix.
procedure, pass(self), private :: save_header_into_file !< Save header into file.
procedure, pass(self), private :: save_trailer_into_file !< Save trailer into file.
endtype file_stl_object