Module containing Signed Distance Functions.
|
subroutine, public | signed_distance_field (field_data, object, max_distance) |
| Signed distance field. More...
|
|
subroutine | signed_distance_field_tri_mesh (field_data, mesh, max_distance) |
| Signed distance field for a triangular mesh. More...
|
|
real(kind=dp) function | tri_mesh_brute_force (mesh, p, max_distance) |
| Signed distance function. More...
|
|
real(kind=dp) function | tri_mesh_aabb_tree (tree, object_list, p, max_distance) |
| Signed distance function using an AABB tree. More...
|
|
subroutine | element_distance (element, p, distance, weighted_sign) |
| Main interface for the signed distance function for an element. More...
|
|
subroutine | element_distance_triangle (triangle, p, distance, weighted_sign) |
| Signed distance function for a triangle. More...
|
|
pure real(kind=dp) function, dimension(3) | cross (a, b) |
| Compute cross product of two vectors. More...
|
|
◆ cross()
pure real(kind=dp) function, dimension(3) signed_distance::cross |
( |
real(kind=dp), dimension(3), intent(in) |
a, |
|
|
real(kind=dp), dimension(3), intent(in) |
b |
|
) |
| |
|
private |
- Parameters
-
[in] | a | First vector |
[in] | b | Second vector |
- Returns
- Cross product \( a \times b \)
Definition at line 426 of file signed_distance.f90.
◆ element_distance()
subroutine signed_distance::element_distance |
( |
class(*), intent(in) |
element, |
|
|
real(kind=dp), dimension(3), intent(in) |
p, |
|
|
real(kind=dp), intent(out) |
distance, |
|
|
real(kind=dp), intent(out), optional |
weighted_sign |
|
) |
| |
◆ element_distance_triangle()
subroutine signed_distance::element_distance_triangle |
( |
type(tri_t), intent(in) |
triangle, |
|
|
real(kind=dp), dimension(3), intent(in) |
p, |
|
|
real(kind=dp), intent(out) |
distance, |
|
|
real(kind=dp), intent(out), optional |
weighted_sign |
|
) |
| |
|
private |
This routine computes the signed distance function for the current triangle. We compute the barycentric coordinate of the point projected onto the triangle. If the projection is inside the triangle, the distance is the distance to the plane. If the projection is outside the triangle, the distance is the distance to the nearest edge or vertex.
In order to improve precision of the sign estimation, we also compute the weighted sign, which is the perpendicular distance to the plane divided by the distance to the nearest point.
@Note The returned distance is signed if the weighted_sign is not present.
- Parameters
-
- Returns
- Distance value
-
[optional] Weighted sign
Definition at line 350 of file signed_distance.f90.
◆ signed_distance_field()
subroutine, public signed_distance::signed_distance_field |
( |
type(field_t), intent(inout) |
field_data, |
|
|
class(*), intent(in) |
object, |
|
|
real(kind=dp), intent(in), optional |
max_distance |
|
) |
| |
This routine computes the signed distance field for a given object.
Currently supported objects are:
- Triangular mesh (tri_mesh_t)
- Parameters
-
[in,out] | field_data | Field data |
[in] | object | Object |
| [in,optional] | max_distance Maximum distance outside the mesh |
Definition at line 60 of file signed_distance.f90.
◆ signed_distance_field_tri_mesh()
subroutine signed_distance::signed_distance_field_tri_mesh |
( |
type(field_t), intent(inout) |
field_data, |
|
|
type(tri_mesh_t), intent(in) |
mesh, |
|
|
real(kind=dp), intent(in) |
max_distance |
|
) |
| |
|
private |
This routine computes the signed distance field for a given triangular mesh. The algorithm utilizes an AABB tree to accelerate the earch for potential elements. The signed distance is computed using the brute force approach, where we compute the signed distance to each element found through the AABB tree, and return the minimum distance.
- Parameters
-
[in,out] | field_data | Field data |
[in] | mesh | Triangular mesh |
[in] | max_distance | Maximum distance outside the mesh |
Definition at line 93 of file signed_distance.f90.
◆ tri_mesh_aabb_tree()
real(kind=dp) function signed_distance::tri_mesh_aabb_tree |
( |
class(aabb_tree_t), intent(in) |
tree, |
|
|
class(tri_t), dimension(:), intent(in) |
object_list, |
|
|
real(kind=dp), dimension(3), intent(in) |
p, |
|
|
real(kind=dp), intent(in) |
max_distance |
|
) |
| |
This routine computes the signed distance function for the boundary mesh, to a given point (x, y, z). The algorithm utilizes an AABB tree to accelerate the search for potential elements. The signed distance is computed using the brute force approach, where we compute the signed distance to each element found through the AABB tree, and return the minimum distance.
- Parameters
-
tree | AABB tree |
object_list | List of objects |
p | Point |
max_distance | Maximum distance outside the mesh |
- Returns
- Signed distance value
Definition at line 194 of file signed_distance.f90.
◆ tri_mesh_brute_force()
real(kind=dp) function signed_distance::tri_mesh_brute_force |
( |
type(tri_mesh_t), intent(in) |
mesh, |
|
|
real(kind=dp), dimension(3), intent(in) |
p, |
|
|
real(kind=dp), intent(in) |
max_distance |
|
) |
| |
|
private |
- Deprecated:
- This routine is deprecated and will be removed in the future.
This routine computes the signed distance function for the boundary mesh, to a given point (x, y, z). The algorithm is a brute force approach, where we compute the signed distance to each element in the mesh, and return the minimum distance.
- Parameters
-
- Returns
- Signed distance value
Definition at line 145 of file signed_distance.f90.