Appearance
fossil_facet_object
FOSSIL, facet class definition.
Source: src/lib/fossil_facet_object.f90
Dependencies
Contents
- facet_object
- load_from_file_interface
- save_into_file_interface
- compute_distance
- compute_metrix
- compute_normal
- compute_pseudo_normals
- compute_vertices_nearby
- connect_nearby_vertices
- destroy
- destroy_connectivity
- initialize
- load_from_file_ascii
- load_from_file_binary
- make_normal_consistent
- resize
- reverse_normal
- save_into_file_ascii
- save_into_file_binary
- translate
- update_connectivity
- flip_edge
- mirror_by_normal
- mirror_by_matrix
- rotate_by_axis_angle
- rotate_by_matrix
- edge_connection_in_other_ref
- facet_assign_facet
- merge_vertices
- put_in_list
- centroid_part
- check_normal
- do_ray_intersect
- largest_edge_len
- smallest_edge_len
- solid_angle
- tetrahedron_volume
- vertex_angle
- vertex_global_id
- face_id
- vertex_local_id
Derived Types
facet_object
FOSSIL, facet class.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
normal | type(vector_R8P) | Facet (outward) normal (versor), (v2-v1).cross.(v3-v1). | |
vertex | type(vector_R8P) | Facet vertices. | |
centroid | type(vector_R8P) | Facet's centroid. | |
E12 | type(vector_R8P) | Edge 1-2, V2-V1. | |
E13 | type(vector_R8P) | Edge 1-3, V3-V1. | |
a | real(kind=R8P) | E12.dot.E12. | |
b | real(kind=R8P) | E12.dot.E13. | |
c | real(kind=R8P) | E13.dot.E13. | |
det | real(kind=R8P) | a*c - b*b. | |
d | real(kind=R8P) | normal.dot.vertex(1) | |
bb | type(vector_R8P) | Axis-aligned bounding box (AABB), bb(1)=min, bb(2)=max. | |
id | integer(kind=I4P) | Facet global ID. | |
fcon_edge_12 | integer(kind=I4P) | Connected face ID along edge 1-2. | |
fcon_edge_23 | integer(kind=I4P) | Connected face ID along edge 2-3. | |
fcon_edge_31 | integer(kind=I4P) | Connected face ID along edge 3-1. | |
vertex_occurrence | type(list_id_object) | List of vertices "occurrencies", list of facets global ID containing them. | |
vertex_nearby | type(list_id_object) | List of vertices "nearby", list of vertices global ID nearby them. | |
edge_12_pnormal | type(vector_R8P) | Edge 1-2 pseudo-normal. | |
edge_23_pnormal | type(vector_R8P) | Edge 2-3 pseudo-normal. | |
edge_31_pnormal | type(vector_R8P) | Edge 3-3 pseudo-normal. | |
vertex_pnormal | type(vector_R8P) | Vertices pseudo-normals. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
centroid_part | pass(self) | Return facet's part to build up STL centroid. |
check_normal | pass(self) | Check normal consistency. |
compute_distance | pass(self) | Compute the (unsigned, squared) distance from a point to facet. |
compute_metrix | pass(self) | Compute local (plane) metrix. |
compute_normal | pass(self) | Compute normal by means of vertices data. |
compute_pseudo_normals | pass(self) | Compute pseudo normals. |
compute_vertices_nearby | pass(self) | Compute vertices nearby comparing to ones of other facet. |
connect_nearby_vertices | pass(self) | Connect nearby vertices of disconnected edges. |
destroy | pass(self) | Destroy facet. |
destroy_connectivity | pass(self) | Destroy facet connectivity. |
do_ray_intersect | pass(self) | Return true if facet is intersected by a ray. |
initialize | pass(self) | Initialize facet. |
largest_edge_len | pass(self) | Return the largest edge length. |
load_from_file_ascii | pass(self) | Load facet from ASCII file. |
load_from_file_binary | pass(self) | Load facet from binary file. |
make_normal_consistent | pass(self) | Make normal of other facet consistent with self. |
mirror | Mirror facet. | |
reverse_normal | pass(self) | Reverse facet normal. |
resize | pass(self) | Resize (scale) facet by x or y or z or vectorial factors. |
rotate | Rotate facet. | |
save_into_file_ascii | pass(self) | Save facet into ASCII file. |
save_into_file_binary | pass(self) | Save facet into binary file. |
smallest_edge_len | pass(self) | Return the smallest edge length. |
solid_angle | pass(self) | Return the (projected) solid angle of the facet with respect point. |
tetrahedron_volume | pass(self) | Return the volume of tetrahedron built by facet and a given apex. |
translate | pass(self) | Translate facet given vectorial delta. |
update_connectivity | pass(self) | Update facet connectivity. |
vertex_angle | pass(self) | Return the subtended angle of given vertex. |
vertex_global_id | pass(self) | Return the vertex global id given the local one. |
assignment(=) | Overload =. | |
edge_connection_in_other_ref | pass(self) | Return the edge of connection in the other reference. |
facet_assign_facet | pass(lhs) | Operator =. |
flip_edge | pass(self) | Flip facet edge. |
mirror_by_normal | pass(self) | Mirror facet given normal of mirroring plane. |
mirror_by_matrix | pass(self) | Mirror facet given matrix. |
rotate_by_axis_angle | pass(self) | Rotate facet given axis and angle. |
rotate_by_matrix | pass(self) | Rotate facet given matrix. |
Interfaces
load_from_file_interface
load_from_file_interface
Load facet from file, generic interface.
fortran
subroutine load_from_file_interface(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
save_into_file_interface
save_into_file_interface
Save facet into file, generic interface.
fortran
subroutine save_into_file_interface(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
Subroutines
compute_distance
Compute the (unsigned, squared) distance from a point to the facet surface.
@note Facet's metrix must be already computed.
@note Algorithm by David Eberly, Geometric Tools LLC, http://www.geometrictools.com.
Attributes: pure
fortran
subroutine compute_distance(self, point, distance)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
point | type(vector_R8P) | in | Point. | |
distance | real(kind=R8P) | out | Closest distance from point to the facet. |
Call graph
compute_metrix
Compute local (plane) metrix.
Attributes: elemental
fortran
subroutine compute_metrix(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
compute_normal
Compute normal by means of vertices data.
fortran
type(facet_object) :: facet
facet%vertex(1) = -0.231369_R4P * ex_R4P + 0.0226865_R4P * ey_R4P + 1._R4P * ez_R4P
facet%vertex(2) = -0.227740_R4P * ex_R4P + 0.0245457_R4P * ey_R4P + 0._R4P * ez_R4P
facet%vertex(2) = -0.235254_R4P * ex_R4P + 0.0201881_R4P * ey_R4P + 0._R4P * ez_R4P
call facet%sanitize_normal
print "(3(F3.1,1X))", facet%normal%x, facet%normal%y, facet%normal%zAttributes: elemental
fortran
subroutine compute_normal(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
compute_pseudo_normals
Compute pseudo normals.
@note Connectivity must be already computed.
Attributes: pure
fortran
subroutine compute_pseudo_normals(self, facet)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
facet | type(facet_object) | in | Facets list. |
Call graph
compute_vertices_nearby
Compute vertices nearby comparing to ones of other facet.
Attributes: pure
fortran
subroutine compute_vertices_nearby(self, other, tolerance_to_be_identical, tolerance_to_be_nearby)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
other | type(facet_object) | inout | Other facet. | |
tolerance_to_be_identical | real(kind=R8P) | in | Tolerance to identify identical vertices. | |
tolerance_to_be_nearby | real(kind=R8P) | in | Tolerance to identify nearby vertices. |
Call graph
connect_nearby_vertices
Connect nearby vertices of disconnected edges.
Attributes: pure
fortran
subroutine connect_nearby_vertices(self, facet)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
facet | type(facet_object) | inout | All facets in STL. |
Call graph
destroy
Destroy facet.
Attributes: elemental
fortran
subroutine destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
destroy_connectivity
Destroy facet connectivity.
Attributes: elemental
fortran
subroutine destroy_connectivity(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
initialize
Initialize facet.
Attributes: elemental
fortran
subroutine initialize(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
load_from_file_ascii
Load facet from ASCII file.
fortran
subroutine load_from_file_ascii(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
Call graph
load_from_file_binary
Load facet from binary file.
fortran
subroutine load_from_file_binary(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
Call graph
make_normal_consistent
Make normal of other facet consistent with self.
Attributes: pure
fortran
subroutine make_normal_consistent(self, edge_dir, other)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
edge_dir | character(len=*) | in | Edge (in self numeration) along which other is connected. | |
other | type(facet_object) | inout | Other facet to make consistent with self. |
Call graph
resize
Resize (scale) facet by x or y or z or vectorial factors.
@note The name scale has not been used, it been a Fortran built-in.
Attributes: elemental
fortran
subroutine resize(self, factor, center)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet | |
factor | type(vector_R8P) | in | Vectorial factor. | |
center | type(vector_R8P) | in | Center of resize. |
Call graph
reverse_normal
Reverse facet normal.
Attributes: elemental
fortran
subroutine reverse_normal(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
save_into_file_ascii
Save facet into ASCII file.
fortran
subroutine save_into_file_ascii(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
Call graph
save_into_file_binary
Save facet into binary file.
fortran
subroutine save_into_file_binary(self, file_unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
file_unit | integer(kind=I4P) | in | File unit. |
Call graph
translate
Translate facet given vectorial delta.
Attributes: elemental
fortran
subroutine translate(self, delta, recompute_metrix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
delta | type(vector_R8P) | in | Translation delta. | |
recompute_metrix | logical | in | optional | Sentinel to activate metrix recomputation. |
Call graph
update_connectivity
Update facet connectivity.
@note Vertices occurrencies list must be already computed.
Attributes: pure
fortran
subroutine update_connectivity(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. |
Call graph
flip_edge
Flip facet edge.
Attributes: pure
fortran
subroutine flip_edge(self, edge_dir)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
edge_dir | character(len=*) | in | Edge to be flipped. |
Call graph
mirror_by_normal
Mirror facet given normal of mirroring plane.
Attributes: pure
fortran
subroutine mirror_by_normal(self, normal, recompute_metrix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
normal | type(vector_R8P) | in | Normal of mirroring plane. | |
recompute_metrix | logical | in | optional | Sentinel to activate metrix recomputation. |
Call graph
mirror_by_matrix
Mirror facet given matrix (of mirroring).
Attributes: pure
fortran
subroutine mirror_by_matrix(self, matrix, recompute_metrix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
matrix | real(kind=R8P) | in | Mirroring matrix. | |
recompute_metrix | logical | in | optional | Sentinel to activate metrix recomputation. |
Call graph
rotate_by_axis_angle
Rotate facet given axis and angle.
Angle must be in radiants.
Attributes: pure
fortran
subroutine rotate_by_axis_angle(self, axis, angle, recompute_metrix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
axis | type(vector_R8P) | in | Axis of rotation. | |
angle | real(kind=R8P) | in | Angle of rotation. | |
recompute_metrix | logical | in | optional | Sentinel to activate metrix recomputation. |
Call graph
rotate_by_matrix
Rotate facet given matrix (of ratation).
Attributes: pure
fortran
subroutine rotate_by_matrix(self, matrix, recompute_metrix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | inout | Facet. | |
matrix | real(kind=R8P) | in | Rotation matrix. | |
recompute_metrix | logical | in | optional | Sentinel to activate metrix recomputation. |
Call graph
edge_connection_in_other_ref
Return the edge of connection in the other reference.
Attributes: pure
fortran
subroutine edge_connection_in_other_ref(self, other, edge_dir, edge)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
other | type(facet_object) | in | Other facet. | |
edge_dir | character(len=*) | out | Edge (in other numeration) along which self is connected. | |
edge | type(vector_R8P) | out | Edge (in other numeration) along which self is connected. |
Call graph
facet_assign_facet
Operator =.
Attributes: pure
fortran
subroutine facet_assign_facet(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(facet_object) | inout | Left hand side. | |
rhs | type(facet_object) | in | Right hand side. |
merge_vertices
Merge nearby vertices.
Attributes: pure
fortran
subroutine merge_vertices(vertex, facet, nearby)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
vertex | type(vector_R8P) | inout | Reference vertex. | |
facet | type(facet_object) | inout | All facets in STL. | |
nearby | type(list_id_object) | inout | List of nearby vertices global ID. |
Call graph
put_in_list
Put ID into a list.
Attributes: pure
fortran
subroutine put_in_list(id, list)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
id | integer(kind=I4P) | in | ID to insert. | |
list | integer(kind=I4P) | inout | allocatable | List. |
Functions
centroid_part
Return facet's part to build up STL centroid.
@note Facet's normal should already computed/sanitized.
Attributes: pure
Returns: type(vector_R8P)
fortran
function centroid_part(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. |
Call graph
check_normal
Check normal consistency.
Attributes: elemental
Returns: logical
fortran
function check_normal(self) result(is_consistent)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. |
Call graph
do_ray_intersect
Return true if facet is intersected by ray from origin and oriented as ray direction vector.
This based on Moller–Trumbore intersection algorithm.
@note Facet's metrix must be already computed.
Attributes: pure
Returns: logical
fortran
function do_ray_intersect(self, ray_origin, ray_direction) result(intersect)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
ray_origin | type(vector_R8P) | in | Ray origin. | |
ray_direction | type(vector_R8P) | in | Ray direction. |
Call graph
largest_edge_len
Return the largest edge length.
Attributes: pure
Returns: real(kind=R8P)
fortran
function largest_edge_len(self) result(largest)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. |
Call graph
smallest_edge_len
Return the smallest edge length.
Attributes: pure
Returns: real(kind=R8P)
fortran
function smallest_edge_len(self) result(smallest)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. |
Call graph
solid_angle
Return the (projected) solid angle of the facet with respect the point.
Attributes: pure
Returns: real(kind=R8P)
fortran
function solid_angle(self, point)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
point | type(vector_R8P) | in | Point. |
Call graph
tetrahedron_volume
Return the volume of tetrahedron built by facet and a given apex.
Attributes: pure
Returns: real(kind=R8P)
fortran
function tetrahedron_volume(self, apex) result(volume)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
apex | type(vector_R8P) | in | Tetrahedron apex. |
Call graph
vertex_angle
Return the subtened angle of given vertex.
Attributes: pure
Returns: real(kind=R8P)
fortran
function vertex_angle(self, vertex_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
vertex_id | integer(kind=I4P) | in | Local vertex id. |
Call graph
vertex_global_id
Return the vertex global id given the local one.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function vertex_global_id(self, vertex_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(facet_object) | in | Facet. | |
vertex_id | integer(kind=I4P) | in | Local vertex id. |
Call graph
face_id
Return the face id containing the given vertex global id.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function face_id(vertex_global_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
vertex_global_id | integer(kind=I4P) | in | Global vertex id. |
Call graph
vertex_local_id
Return the vertex global id given the local one.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function vertex_local_id(face_id, vertex_global_id)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
face_id | integer(kind=I4P) | in | Face id. | |
vertex_global_id | integer(kind=I4P) | in | Global vertex id. |
Call graph