Module containing Signed Distance Functions.
|
subroutine, public | signed_distance_field (field_data, object, max_distance) |
| Signed distance field.
|
|
subroutine | signed_distance_field_tri_mesh (field_data, mesh, max_distance) |
| Signed distance field for a triangular mesh.
|
|
real(kind=dp) function | tri_mesh_brute_force (mesh, p, max_distance) |
| Signed distance function.
|
|
real(kind=dp) function | tri_mesh_aabb_tree (tree, object_list, p, max_distance) |
| Signed distance function using an AABB tree.
|
|
subroutine | element_distance (element, p, distance, weighted_sign) |
| Main interface for the signed distance function for an element.
|
|
subroutine | element_distance_triangle (triangle, p, distance, weighted_sign) |
| Signed distance function for a triangle.
|
|
pure real(kind=dp) function, dimension(3) | cross (a, b) |
| Compute cross product of two vectors.
|
|
◆ cross()
- 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()
◆ element_distance_triangle()
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()
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()
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()
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()
- 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.