Skip to content

fossil_facet_object

FOSSIL, facet class definition.

Source: src/lib/fossil_facet_object.f90

Dependencies

Contents

Derived Types

facet_object

FOSSIL, facet class.

Components

NameTypeAttributesDescription
normaltype(vector_R8P)Facet (outward) normal (versor), (v2-v1).cross.(v3-v1).
vertextype(vector_R8P)Facet vertices.
centroidtype(vector_R8P)Facet's centroid.
E12type(vector_R8P)Edge 1-2, V2-V1.
E13type(vector_R8P)Edge 1-3, V3-V1.
areal(kind=R8P)E12.dot.E12.
breal(kind=R8P)E12.dot.E13.
creal(kind=R8P)E13.dot.E13.
detreal(kind=R8P)a*c - b*b.
dreal(kind=R8P)normal.dot.vertex(1)
bbtype(vector_R8P)Axis-aligned bounding box (AABB), bb(1)=min, bb(2)=max.
idinteger(kind=I4P)Facet global ID.
fcon_edge_12integer(kind=I4P)Connected face ID along edge 1-2.
fcon_edge_23integer(kind=I4P)Connected face ID along edge 2-3.
fcon_edge_31integer(kind=I4P)Connected face ID along edge 3-1.
vertex_occurrencetype(list_id_object)List of vertices "occurrencies", list of facets global ID containing them.
vertex_nearbytype(list_id_object)List of vertices "nearby", list of vertices global ID nearby them.
edge_12_pnormaltype(vector_R8P)Edge 1-2 pseudo-normal.
edge_23_pnormaltype(vector_R8P)Edge 2-3 pseudo-normal.
edge_31_pnormaltype(vector_R8P)Edge 3-3 pseudo-normal.
vertex_pnormaltype(vector_R8P)Vertices pseudo-normals.

Type-Bound Procedures

NameAttributesDescription
centroid_partpass(self)Return facet's part to build up STL centroid.
check_normalpass(self)Check normal consistency.
compute_distancepass(self)Compute the (unsigned, squared) distance from a point to facet.
compute_metrixpass(self)Compute local (plane) metrix.
compute_normalpass(self)Compute normal by means of vertices data.
compute_pseudo_normalspass(self)Compute pseudo normals.
compute_vertices_nearbypass(self)Compute vertices nearby comparing to ones of other facet.
connect_nearby_verticespass(self)Connect nearby vertices of disconnected edges.
destroypass(self)Destroy facet.
destroy_connectivitypass(self)Destroy facet connectivity.
do_ray_intersectpass(self)Return true if facet is intersected by a ray.
initializepass(self)Initialize facet.
largest_edge_lenpass(self)Return the largest edge length.
load_from_file_asciipass(self)Load facet from ASCII file.
load_from_file_binarypass(self)Load facet from binary file.
make_normal_consistentpass(self)Make normal of other facet consistent with self.
mirrorMirror facet.
reverse_normalpass(self)Reverse facet normal.
resizepass(self)Resize (scale) facet by x or y or z or vectorial factors.
rotateRotate facet.
save_into_file_asciipass(self)Save facet into ASCII file.
save_into_file_binarypass(self)Save facet into binary file.
smallest_edge_lenpass(self)Return the smallest edge length.
solid_anglepass(self)Return the (projected) solid angle of the facet with respect point.
tetrahedron_volumepass(self)Return the volume of tetrahedron built by facet and a given apex.
translatepass(self)Translate facet given vectorial delta.
update_connectivitypass(self)Update facet connectivity.
vertex_anglepass(self)Return the subtended angle of given vertex.
vertex_global_idpass(self)Return the vertex global id given the local one.
assignment(=)Overload =.
edge_connection_in_other_refpass(self)Return the edge of connection in the other reference.
facet_assign_facetpass(lhs)Operator =.
flip_edgepass(self)Flip facet edge.
mirror_by_normalpass(self)Mirror facet given normal of mirroring plane.
mirror_by_matrixpass(self)Mirror facet given matrix.
rotate_by_axis_anglepass(self)Rotate facet given axis and angle.
rotate_by_matrixpass(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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
file_unitinteger(kind=I4P)inFile 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
file_unitinteger(kind=I4P)inFile 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
pointtype(vector_R8P)inPoint.
distancereal(kind=R8P)outClosest distance from point to the facet.

Call graph

compute_metrix

Compute local (plane) metrix.

Attributes: elemental

fortran
subroutine compute_metrix(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

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%z

Attributes: elemental

fortran
subroutine compute_normal(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

compute_pseudo_normals

Compute pseudo normals.

@note Connectivity must be already computed.

Attributes: pure

fortran
subroutine compute_pseudo_normals(self, facet)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
facettype(facet_object)inFacets 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
othertype(facet_object)inoutOther facet.
tolerance_to_be_identicalreal(kind=R8P)inTolerance to identify identical vertices.
tolerance_to_be_nearbyreal(kind=R8P)inTolerance 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
facettype(facet_object)inoutAll facets in STL.

Call graph

destroy

Destroy facet.

Attributes: elemental

fortran
subroutine destroy(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

destroy_connectivity

Destroy facet connectivity.

Attributes: elemental

fortran
subroutine destroy_connectivity(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

initialize

Initialize facet.

Attributes: elemental

fortran
subroutine initialize(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

load_from_file_ascii

Load facet from ASCII file.

fortran
subroutine load_from_file_ascii(self, file_unit)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
file_unitinteger(kind=I4P)inFile unit.

Call graph

load_from_file_binary

Load facet from binary file.

fortran
subroutine load_from_file_binary(self, file_unit)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
file_unitinteger(kind=I4P)inFile 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
edge_dircharacter(len=*)inEdge (in self numeration) along which other is connected.
othertype(facet_object)inoutOther 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet
factortype(vector_R8P)inVectorial factor.
centertype(vector_R8P)inCenter of resize.

Call graph

reverse_normal

Reverse facet normal.

Attributes: elemental

fortran
subroutine reverse_normal(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

save_into_file_ascii

Save facet into ASCII file.

fortran
subroutine save_into_file_ascii(self, file_unit)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
file_unitinteger(kind=I4P)inFile unit.

Call graph

save_into_file_binary

Save facet into binary file.

fortran
subroutine save_into_file_binary(self, file_unit)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
file_unitinteger(kind=I4P)inFile unit.

Call graph

translate

Translate facet given vectorial delta.

Attributes: elemental

fortran
subroutine translate(self, delta, recompute_metrix)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
deltatype(vector_R8P)inTranslation delta.
recompute_metrixlogicalinoptionalSentinel 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.

Call graph

flip_edge

Flip facet edge.

Attributes: pure

fortran
subroutine flip_edge(self, edge_dir)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
edge_dircharacter(len=*)inEdge 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
normaltype(vector_R8P)inNormal of mirroring plane.
recompute_metrixlogicalinoptionalSentinel 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
matrixreal(kind=R8P)inMirroring matrix.
recompute_metrixlogicalinoptionalSentinel 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
axistype(vector_R8P)inAxis of rotation.
anglereal(kind=R8P)inAngle of rotation.
recompute_metrixlogicalinoptionalSentinel 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inoutFacet.
matrixreal(kind=R8P)inRotation matrix.
recompute_metrixlogicalinoptionalSentinel 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
othertype(facet_object)inOther facet.
edge_dircharacter(len=*)outEdge (in other numeration) along which self is connected.
edgetype(vector_R8P)outEdge (in other numeration) along which self is connected.

Call graph

facet_assign_facet

Operator =.

Attributes: pure

fortran
subroutine facet_assign_facet(lhs, rhs)

Arguments

NameTypeIntentAttributesDescription
lhsclass(facet_object)inoutLeft hand side.
rhstype(facet_object)inRight hand side.

merge_vertices

Merge nearby vertices.

Attributes: pure

fortran
subroutine merge_vertices(vertex, facet, nearby)

Arguments

NameTypeIntentAttributesDescription
vertextype(vector_R8P)inoutReference vertex.
facettype(facet_object)inoutAll facets in STL.
nearbytype(list_id_object)inoutList 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

NameTypeIntentAttributesDescription
idinteger(kind=I4P)inID to insert.
listinteger(kind=I4P)inoutallocatableList.

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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.

Call graph

check_normal

Check normal consistency.

Attributes: elemental

Returns: logical

fortran
function check_normal(self) result(is_consistent)

Arguments

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.

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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
ray_origintype(vector_R8P)inRay origin.
ray_directiontype(vector_R8P)inRay 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.

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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.

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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
pointtype(vector_R8P)inPoint.

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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
apextype(vector_R8P)inTetrahedron 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
vertex_idinteger(kind=I4P)inLocal 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

NameTypeIntentAttributesDescription
selfclass(facet_object)inFacet.
vertex_idinteger(kind=I4P)inLocal 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

NameTypeIntentAttributesDescription
vertex_global_idinteger(kind=I4P)inGlobal 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

NameTypeIntentAttributesDescription
face_idinteger(kind=I4P)inFace id.
vertex_global_idinteger(kind=I4P)inGlobal vertex id.

Call graph