fossil_file_stl_object Module

module~~fossil_file_stl_object~~UsesGraph module~fossil_file_stl_object fossil_file_stl_object module~fossil_aabb_tree_object fossil_aabb_tree_object module~fossil_aabb_tree_object->module~fossil_file_stl_object module~fossil_utils fossil_utils module~fossil_utils->module~fossil_file_stl_object module~fossil_facet_object fossil_facet_object module~fossil_utils->module~fossil_facet_object module~fossil_aabb_object fossil_aabb_object module~fossil_utils->module~fossil_aabb_object iso_fortran_env iso_fortran_env iso_fortran_env->module~fossil_file_stl_object iso_fortran_env->module~fossil_aabb_tree_object iso_fortran_env->module~fossil_facet_object module~fossil_aabb_node_object fossil_aabb_node_object iso_fortran_env->module~fossil_aabb_node_object iso_fortran_env->module~fossil_aabb_object penf penf penf->module~fossil_file_stl_object penf->module~fossil_aabb_tree_object penf->module~fossil_utils penf->module~fossil_facet_object penf->module~fossil_aabb_node_object penf->module~fossil_aabb_object vecfor vecfor vecfor->module~fossil_file_stl_object vecfor->module~fossil_aabb_tree_object vecfor->module~fossil_facet_object vecfor->module~fossil_aabb_node_object vecfor->module~fossil_aabb_object module~fossil_facet_object->module~fossil_file_stl_object module~fossil_facet_object->module~fossil_aabb_tree_object module~fossil_facet_object->module~fossil_aabb_node_object module~fossil_facet_object->module~fossil_aabb_object module~fossil_aabb_node_object->module~fossil_aabb_tree_object module~fossil_aabb_object->module~fossil_aabb_tree_object module~fossil_aabb_object->module~fossil_aabb_node_object
Help

FOSSIL, STL file class definition.

Used By

module~~fossil_file_stl_object~~UsedByGraph module~fossil_file_stl_object fossil_file_stl_object module~fossil fossil module~fossil_file_stl_object->module~fossil program~fossil_test_distance fossil_test_distance module~fossil->program~fossil_test_distance program~fossil_test_sanitize_normals fossil_test_sanitize_normals module~fossil->program~fossil_test_sanitize_normals program~fossil_test_load_save_ascii fossil_test_load_save_ascii module~fossil->program~fossil_test_load_save_ascii program~fossil_test_load_save_binary fossil_test_load_save_binary module~fossil->program~fossil_test_load_save_binary program~fossil_test_rotate fossil_test_rotate module~fossil->program~fossil_test_rotate program~fossil_test_mirror fossil_test_mirror module~fossil->program~fossil_test_mirror program~fossil_test_translate fossil_test_translate module~fossil->program~fossil_test_translate program~fossil_test_resize fossil_test_resize module~fossil->program~fossil_test_resize
Help


Derived Types

type, public :: file_stl_object

FOSSIL STL file class.

Components

TypeVisibility AttributesNameInitial
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.

Type-Bound Procedures

procedure, public, pass(self) :: analize

Analize STL.

procedure, public, pass(self) :: build_connectivity

Build facets connectivity.

procedure, public, pass(self) :: close_file

Close file.

procedure, public, pass(self) :: compute_metrix

Compute facets metrix.

procedure, public, pass(self) :: compute_normals

Compute facets normals by means of vertices data.

procedure, public, pass(self) :: compute_volume

Compute volume bounded by STL surface.

procedure, public, pass(self) :: create_aabb_tree

Create the AABB tree.

procedure, public, pass(self) :: destroy

Destroy file.

procedure, public, pass(self) :: distance

Compute the (minimum) distance from point to triangulated surface.

procedure, public, pass(self) :: initialize

Initialize file.

procedure, public, pass(self) :: is_point_inside_polyhedron_ri

Determinate is point is inside or not STL facets by ray intersect.

procedure, public, pass(self) :: is_point_inside_polyhedron_sa

Determinate is point is inside or not STL facets by solid angle.

procedure, public, pass(self) :: load_from_file

Load from file.

generic, public :: mirror => mirror_by_normal, mirror_by_matrix

Mirror facets.

procedure, public, pass(self) :: open_file

Open file, once initialized.

procedure, public, pass(self) :: reverse_normals

Reverse facets normals.

procedure, public, pass(self) :: resize

Resize (scale) facets by x or y or z or vectorial factors.

generic, public :: rotate => rotate_by_axis_angle, rotate_by_matrix

Rotate facets.

procedure, public, pass(self) :: sanitize_normals

Sanitize facets normals, make them consistent.

procedure, public, pass(self) :: save_into_file

Save into file.

procedure, public, pass(self) :: statistics

Return STL statistics.

procedure, public, pass(self) :: translate

Translate facet given vectorial delta.

generic, public :: assignment(=) => file_stl_assign_file_stl

Overload =.

procedure, private, pass(lhs) :: file_stl_assign_file_stl

Operator =.

procedure, private, pass(self) :: allocate_facets

Allocate facets.

procedure, private, pass(self) :: load_facets_number_from_file

Load facets number from file.

procedure, private, pass(self) :: load_header_from_file

Load header from file.

procedure, private, pass(self) :: mirror_by_normal

Mirror facets given normal of mirroring plane.

procedure, private, pass(self) :: mirror_by_matrix

Mirror facets given matrix.

procedure, private, pass(self) :: rotate_by_axis_angle

Rotate facets given axis and angle.

procedure, private, pass(self) :: rotate_by_matrix

Rotate facets given matrix.

procedure, private, pass(self) :: save_header_into_file

Save header into file.

procedure, private, pass(self) :: save_trailer_into_file

Save trailer into file.


Functions

private pure function distance(self, point, is_signed, sign_algorithm, is_square_root)

Compute the (minimum) distance from a point to the triangulated surface.

Arguments

Type IntentOptional AttributesName
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.

Return Value real(kind=R8P)

Minimum distance from point to the triangulated surface.

private pure function is_point_inside_polyhedron_ri(self, point) result(is_inside)

Determinate is a point is inside or not to a polyhedron described by STL facets by means ray intersections count.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(in) :: self

File STL.

type(vector_R8P), intent(in) :: point

Point coordinates.

Return Value logical

Check result.

private pure function is_point_inside_polyhedron_sa(self, point) result(is_inside)

Determinate is a point is inside or not to a polyhedron described by STL facets by means of the solid angle criteria.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(in) :: self

File STL.

type(vector_R8P), intent(in) :: point

Point coordinates.

Return Value logical

Check result.

private pure function statistics(self, prefix) result(stats)

Return STL statistics.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(in) :: self

File STL.

character(len=*), intent(in), optional :: prefix

Lines prefix.

Return Value character(len=:), allocatable

STL statistics.


Subroutines

private pure subroutine analize(self)

Analize STL.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private pure subroutine build_connectivity(self)

Build facets connectivity.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine close_file(self)

Close file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private pure subroutine compute_metrix(self)

Compute facets metrix.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private elemental subroutine compute_normals(self)

Compute facets normals by means of vertices data.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private elemental subroutine compute_volume(self)

Compute volume bounded by STL surface.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine create_aabb_tree(self, refinement_levels)

Create AABB tree.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

integer(kind=I4P), intent(in), optional :: refinement_levels

Total number of refinement levels used.

private elemental subroutine destroy(self)

Destroy file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private elemental subroutine initialize(self, skip_destroy, file_name, is_ascii)

Initialize file.

Arguments

Type IntentOptional AttributesName
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.

private subroutine load_from_file(self, file_name, is_ascii, guess_format, disable_analysis)

Load from file.

Arguments

Type IntentOptional AttributesName
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.

private subroutine open_file(self, file_action, guess_format)

Open file, once initialized.

Arguments

Type IntentOptional AttributesName
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.

private elemental subroutine reverse_normals(self)

Reverse facets normals.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private pure subroutine sanitize_normals(self)

Sanitize facets normals, make them consistent.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine save_into_file(self, file_name, is_ascii)

Save into file.

Arguments

Type IntentOptional AttributesName
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.

private elemental subroutine resize(self, x, y, z, factor, recompute_metrix)

Resize (scale) facets by x or y or z or vectorial factors.

Arguments

Type IntentOptional AttributesName
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.

private elemental subroutine translate(self, x, y, z, delta, recompute_metrix)

Translate facets x or y or z or vectorial delta increments.

Arguments

Type IntentOptional AttributesName
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.

private pure subroutine file_stl_assign_file_stl(lhs, rhs)

Operator =.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: lhs

Left hand side.

type(file_stl_object), intent(in) :: rhs

Right hand side.

private elemental subroutine allocate_facets(self)

Allocate facets.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine load_facets_number_from_file(self)

Load facets number from file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine load_header_from_file(self)

Load header from file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private elemental subroutine mirror_by_normal(self, normal, recompute_metrix)

Mirror facets given normal of mirroring plane.

Arguments

Type IntentOptional AttributesName
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.

private pure subroutine mirror_by_matrix(self, matrix, recompute_metrix)

Mirror facet given matrix (of mirroring).

Arguments

Type IntentOptional AttributesName
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.

private elemental subroutine rotate_by_axis_angle(self, axis, angle, recompute_metrix)

Rotate facets given axis and angle.

Arguments

Type IntentOptional AttributesName
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.

private pure subroutine rotate_by_matrix(self, matrix, recompute_metrix)

Rotate facet given matrix (of ratation).

Arguments

Type IntentOptional AttributesName
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.

private subroutine save_header_into_file(self)

Save header into file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.

private subroutine save_trailer_into_file(self)

Save trailer into file.

Arguments

Type IntentOptional AttributesName
class(file_stl_object), intent(inout) :: self

File STL.