FOSSIL, facet class.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| type(vector_R8P), | public | :: | normal | Facet (outward) normal (versor), |
|||
| type(vector_R8P), | public | :: | vertex_1 | Facet vertex 1. |
|||
| type(vector_R8P), | public | :: | vertex_2 | Facet vertex 2. |
|||
| type(vector_R8P), | public | :: | vertex_3 | Facet vertex 3. |
|||
| type(vector_R8P), | public | :: | E12 | Edge 1-2, |
|||
| type(vector_R8P), | public | :: | E13 | Edge 1-3, |
|||
| real(kind=R8P), | public | :: | a | = | 0._R8P |
|
|
| real(kind=R8P), | public | :: | b | = | 0._R8P |
|
|
| real(kind=R8P), | public | :: | c | = | 0._R8P |
|
|
| real(kind=R8P), | public | :: | det | = | 0._R8P |
|
|
| real(kind=R8P), | public | :: | d | = | 0._R8P |
|
|
| type(vector_R8P), | public | :: | bb(2) | Axis-aligned bounding box (AABB), bb(1)=min, bb(2)=max. |
|||
| integer(kind=I4P), | public | :: | id | Facet global ID. |
|||
| integer(kind=I4P), | public | :: | fcon_edge_12 | = | 0_I4P | Connected face ID along edge 1-2. |
|
| integer(kind=I4P), | public | :: | fcon_edge_23 | = | 0_I4P | Connected face ID along edge 2-3. |
|
| integer(kind=I4P), | public | :: | fcon_edge_31 | = | 0_I4P | Connected face ID along edge 3-1. |
|
| integer(kind=I4P), | public, | allocatable | :: | vertex_1_occurrence(:) | List of vertex 1 "occurrencies", list of facets global ID containing it. |
||
| integer(kind=I4P), | public, | allocatable | :: | vertex_2_occurrence(:) | List of vertex 2 "occurrencies", list of facets global ID containing it. |
||
| integer(kind=I4P), | public, | allocatable | :: | vertex_3_occurrence(:) | List of vertex 3 "occurrencies", list of facets global ID containing it. |
Add vertex occurence.
Add vertex occurrence.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | vertex_id | Vertex ID in local numeration, 1, 2 or 3. |
||
| integer(kind=I4P), | intent(in) | :: | facet_id | Other facet ID containing vertex. |
Check normal consistency.
Check normal consistency.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
Consistency check result.
Check if vertices of facet are identical to ones of other facet.
Check if vertices of facet are identical (with tollerance) to the ones of other facet.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| type(facet_object), | intent(inout) | :: | other | Other facet. |
Compute local (plane) metrix.
Compute local (plane) metrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Compute normal by means of vertices data.
Compute normal by means of vertices data.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Destroy facet.
Destroy AABB.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Compute the (unsigned, squared) distance from a point to facet.
Compute the (unsigned, squared) distance from a point to the facet surface.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | point | Point. |
Closest distance from point to the facet.
Return true if facet is intersected by a ray.
Return true if facet is intersected by ray from origin and oriented as ray direction vector.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | ray_origin | Ray origin. |
||
| type(vector_R8P), | intent(in) | :: | ray_direction | Ray direction. |
Intersection test result.
Initialize facet.
Initialize facet.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Load facet from ASCII file.
Load facet from ASCII file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | file_unit | File unit. |
Load facet from binary file.
Load facet from binary file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | file_unit | File unit. |
Make normal of other facet consistent with self.
Make normal of other facet consistent with self.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| character(len=*), | intent(in) | :: | edge_dir | Edge (in self numeration) along which other is connected. |
||
| type(facet_object), | intent(inout) | :: | other | Other facet to make consistent with self. |
Mirror facet.
Mirror facet given normal of mirroring plane.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| 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(facet_object), | intent(inout) | :: | self | Facet. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Mirroring matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Reverse facet normal.
Reverse facet normal.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Resize (scale) facet by x or y or z or vectorial factors.
Resize (scale) facet by x or y or z or vectorial factors.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet |
||
| type(vector_R8P), | intent(in) | :: | factor | Vectorial factor. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facet.
Rotate facet given axis and angle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| 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(facet_object), | intent(inout) | :: | self | Facet. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Rotation matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Save facet into ASCII file.
Save facet into ASCII file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | file_unit | File unit. |
Save facet into binary file.
Save facet into binary file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | file_unit | File unit. |
Return the (projected) solid angle of the facet with respect point.
Return the (projected) solid angle of the facet with respect the point.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | point | Point. |
Solid angle.
Return the volume of tetrahedron built by facet and a given apex.
Return the volume of tetrahedron built by facet and a given apex.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | apex | Tetrahedron apex. |
Tetrahedron volume.
Translate facet given vectorial delta.
Translate facet given vectorial delta.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| type(vector_R8P), | intent(in) | :: | delta | Translation delta. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Update facet connectivity.
Update facet connectivity.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
Return the vertex global id given the local one.
Return the vertex global id given the local one.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| integer(kind=I4P), | intent(in) | :: | vertex_id | Local vertex id. |
Gloval vertex id.
Overload =.
Operator =.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | lhs | Left hand side. |
||
| type(facet_object), | intent(in) | :: | rhs | Right hand side. |
Return the edge of connection in the other reference.
Return the edge of connection in the other reference.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(in) | :: | self | Facet. |
||
| type(facet_object), | intent(in) | :: | other | Other facet. |
||
| character(len=*), | intent(out) | :: | edge_dir | Edge (in other numeration) along which self is connected. |
||
| type(vector_R8P), | intent(out) | :: | edge | Edge (in other numeration) along which self is connected. |
Operator =.
Operator =.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | lhs | Left hand side. |
||
| type(facet_object), | intent(in) | :: | rhs | Right hand side. |
Flip facet edge.
Flip facet edge.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| character(len=*), | intent(in) | :: | edge_dir | Edge to be flipped. |
Mirror facet given normal of mirroring plane.
Mirror facet given normal of mirroring plane.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| 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.
Mirror facet given matrix (of mirroring).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Mirroring matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
Rotate facet given axis and angle.
Rotate facet given axis and angle.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| 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.
Rotate facet given matrix (of ratation).
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(facet_object), | intent(inout) | :: | self | Facet. |
||
| real(kind=R8P), | intent(in) | :: | matrix(3,3) | Rotation matrix. |
||
| logical, | intent(in), | optional | :: | recompute_metrix | Sentinel to activate metrix recomputation. |
type :: facet_object
!< FOSSIL, facet class.
type(vector_R8P) :: normal !< Facet (outward) normal (versor), `(v2-v1).cross.(v3-v1)`.
type(vector_R8P) :: vertex_1 !< Facet vertex 1.
type(vector_R8P) :: vertex_2 !< Facet vertex 2.
type(vector_R8P) :: vertex_3 !< Facet vertex 3.
! metrix
! triangle plane parametric equation: T(s,t) = B + s*E12 + t*E13
type(vector_R8P) :: E12 !< Edge 1-2, `V2-V1`.
type(vector_R8P) :: E13 !< Edge 1-3, `V3-V1`.
real(R8P) :: a=0._R8P !< `E12.dot.E12`.
real(R8P) :: b=0._R8P !< `E12.dot.E13`.
real(R8P) :: c=0._R8P !< `E13.dot.E13`.
real(R8P) :: det=0._R8P !< `a*c - b*b`.
! triangle plane equation: nx*x + ny*y + nz*z - d = 0, normal == [nx, ny, nz]
real(R8P) :: d=0._R8P !< `normal.dot.vertex_1`
! auxiliary
type(vector_R8P) :: bb(2) !< Axis-aligned bounding box (AABB), bb(1)=min, bb(2)=max.
! connectivity
integer(I4P) :: id !< Facet global ID.
integer(I4P) :: fcon_edge_12=0_I4P !< Connected face ID along edge 1-2.
integer(I4P) :: fcon_edge_23=0_I4P !< Connected face ID along edge 2-3.
integer(I4P) :: fcon_edge_31=0_I4P !< Connected face ID along edge 3-1.
integer(I4P), allocatable :: vertex_1_occurrence(:) !< List of vertex 1 "occurrencies", list of facets global ID containing it.
integer(I4P), allocatable :: vertex_2_occurrence(:) !< List of vertex 2 "occurrencies", list of facets global ID containing it.
integer(I4P), allocatable :: vertex_3_occurrence(:) !< List of vertex 3 "occurrencies", list of facets global ID containing it.
contains
! public methods
procedure, pass(self) :: add_vertex_occurrence !< Add vertex occurence.
procedure, pass(self) :: check_normal !< Check normal consistency.
procedure, pass(self) :: check_vertices_occurrencies !< Check if vertices of facet are *identical* to ones of other facet.
procedure, pass(self) :: compute_metrix !< Compute local (plane) metrix.
procedure, pass(self) :: compute_normal !< Compute normal by means of vertices data.
procedure, pass(self) :: destroy !< Destroy facet.
procedure, pass(self) :: distance !< Compute the (unsigned, squared) distance from a point to facet.
procedure, pass(self) :: do_ray_intersect !< Return true if facet is intersected by a ray.
procedure, pass(self) :: initialize !< Initialize facet.
procedure, pass(self) :: load_from_file_ascii !< Load facet from ASCII file.
procedure, pass(self) :: load_from_file_binary !< Load facet from binary file.
procedure, pass(self) :: make_normal_consistent !< Make normal of other facet consistent with self.
generic :: mirror => mirror_by_normal, &
mirror_by_matrix !< Mirror facet.
procedure, pass(self) :: reverse_normal !< Reverse facet normal.
procedure, pass(self) :: resize !< Resize (scale) facet by x or y or z or vectorial factors.
generic :: rotate => rotate_by_axis_angle, &
rotate_by_matrix !< Rotate facet.
procedure, pass(self) :: save_into_file_ascii !< Save facet into ASCII file.
procedure, pass(self) :: save_into_file_binary !< Save facet into binary file.
procedure, pass(self) :: solid_angle !< Return the (projected) solid angle of the facet with respect point.
procedure, pass(self) :: tetrahedron_volume !< Return the volume of tetrahedron built by facet and a given apex.
procedure, pass(self) :: translate !< Translate facet given vectorial delta.
procedure, pass(self) :: update_connectivity !< Update facet connectivity.
procedure, pass(self) :: vertex_global_id !< Return the vertex global id given the local one.
! operators
generic :: assignment(=) => facet_assign_facet !< Overload `=`.
! private methods
procedure, pass(self), private :: edge_connection_in_other_ref !< Return the edge of connection in the other reference.
procedure, pass(lhs), private :: facet_assign_facet !< Operator `=`.
procedure, pass(self), private :: flip_edge !< Flip facet edge.
procedure, pass(self), private :: mirror_by_normal !< Mirror facet given normal of mirroring plane.
procedure, pass(self), private :: mirror_by_matrix !< Mirror facet given matrix.
procedure, pass(self), private :: rotate_by_axis_angle !< Rotate facet given axis and angle.
procedure, pass(self), private :: rotate_by_matrix !< Rotate facet given matrix.
endtype facet_object