|
NetDEM v1.0
|
Class for representing a level set function on a regular grid. More...
#include <level_set_function.hpp>
Public Member Functions | |
| LevelSetFunction () | |
| Default constructor. | |
| Vec3d const & | GetCorner () const |
| double | GetSpacing () const |
| Vec3i const & | GetDimensions () const |
| double | GetSignedDistance (int id_x, int id_y, int id_z) |
| Get the signed distance value of a certian cell of the grid. | |
| VecXT< VecXT< VecXT< double > > > const & | GetSignedDistanceTable () const |
| void | SetCorner (double corner_x, double corner_y, double corner_z) |
| Set the corner of the grid. | |
| void | SetSpacing (double sp) |
| Set the spacing between grid points. | |
| void | SetDimension (double dim_x, double dim_y, double dim_z) |
| Set the dimensions of the grid. | |
| void | SetSignedDistance (int id_x, int id_y, int id_z, double sdf) |
| Set the signed distance value of a certian cell of the grid. | |
| void | InitFromSDFCalculator (const SDFCalculator &sdf_calculator) |
| Initialize from a signed distance field. | |
| double | SignedDistance (Vec3d const &pos) const |
| Compute the signed distance at a point in space. | |
| Vec3d | GradientInterpolate (Vec3d const &pos) |
| Compute the gradient at a point in space using interpolation. | |
| Vec3d | GradientMinus (int i, int j, int k) |
| Compute the gradient at the grid point (i, j, k) using backward differences. | |
| Vec3d | GradientPlus (int i, int j, int k) |
| Compute the gradient at the grid point (i, j, k) using forward differences. | |
| void | Reinitialization (int iter, double dt) |
| Perform reinitialization to maintain properties of the level set function. | |
| void | Reinitialization () |
| Perform reinitialization with default parameters. | |
Protected Attributes | |
| Vec3d | corner {-0.5, -0.5, -0.5} |
| Coordinates of the corner of the grid. | |
| double | spacing {0.05} |
| Spacing between grid points. | |
| Vec3i | dim {21, 21, 21} |
| Dimensions of the grid. | |
| VecXT< VecXT< VecXT< double > > > | signed_distance_table |
| Table containing the signed distance values. | |
Class for representing a level set function on a regular grid.
This class represents a level set function on a regular grid with constant spacing in each dimension. It provides methods for initializing the function from a signed distance field, computing the signed distance and gradient at arbitrary points in space, and performing reinitialization to maintain the properties of the level set function.
| LevelSetFunction::LevelSetFunction | ( | ) |
Default constructor.
This creates an empty LevelSetFunction; it must be initialized before it can be used to compute signed distances or gradients.
| Vec3d const & LevelSetFunction::GetCorner | ( | ) | const |
| Vec3i const & LevelSetFunction::GetDimensions | ( | ) | const |
| double LevelSetFunction::GetSignedDistance | ( | int | id_x, |
| int | id_y, | ||
| int | id_z ) |
Get the signed distance value of a certian cell of the grid.
| id_x | The index of grid cell in the x-dimension. |
| id_y | The index of grid cell in the y-dimension. |
| id_z | The index of grid cell in the z-dimension. |
| double LevelSetFunction::GetSpacing | ( | ) | const |
Compute the gradient at a point in space using interpolation.
This method computes the gradient at a given point in space by interpolating the gradients computed using GradientMinus and GradientPlus at the neighboring grid points.
| pos | The point at which to compute the gradient. |
| Vec3d LevelSetFunction::GradientMinus | ( | int | i, |
| int | j, | ||
| int | k ) |
Compute the gradient at the grid point (i, j, k) using backward differences.
This method computes the gradient at the grid point (i, j, k) using backward differences.
| i | The x-coordinate of the grid point. |
| j | The y-coordinate of the grid point. |
| k | The z-coordinate of the grid point. |
| Vec3d LevelSetFunction::GradientPlus | ( | int | i, |
| int | j, | ||
| int | k ) |
Compute the gradient at the grid point (i, j, k) using forward differences.
This method computes the gradient at the grid point (i, j, k) using forward differences.
| i | The x-coordinate of the grid point. |
| j | The y-coordinate of the grid point. |
| k | The z-coordinate of the grid point. |
| void LevelSetFunction::InitFromSDFCalculator | ( | const SDFCalculator & | sdf_calculator | ) |
Initialize from a signed distance field.
This method initializes the LevelSetFunction from a signed distance field represented by an SDFCalculator object. It samples the signed distance at each point on the grid and stores it in the signed_distance_table.
| sdf_calculator | The SDFCalculator containing the signed distance field. |
| void LevelSetFunction::Reinitialization | ( | ) |
Perform reinitialization with default parameters.
This method performs reinitialization on the signed distance values stored in the signed_distance_table. It uses default parameters for the number of iterations and time step.
| void LevelSetFunction::Reinitialization | ( | int | iter, |
| double | dt ) |
Perform reinitialization to maintain properties of the level set function.
This method performs reinitialization on the signed distance values stored in the signed_distance_table. It iteratively updates the values using a finite difference scheme until the level set function becomes sufficiently smooth.
| iter | The number of iterations to perform. |
| dt | The time step used in the finite difference scheme. |
| void LevelSetFunction::SetCorner | ( | double | corner_x, |
| double | corner_y, | ||
| double | corner_z ) |
Set the corner of the grid.
This method sets the coordinates of the corner of the grid, which is the point where the (0, 0, 0) grid cell is located.
| corner_x | The x-coordinate of the corner. |
| corner_y | The y-coordinate of the corner. |
| corner_z | The z-coordinate of the corner. |
| void LevelSetFunction::SetDimension | ( | double | dim_x, |
| double | dim_y, | ||
| double | dim_z ) |
Set the dimensions of the grid.
This method sets the dimensions of the grid in each dimension.
| dim_x | The number of grid cells in the x-dimension. |
| dim_y | The number of grid cells in the y-dimension. |
| dim_z | The number of grid cells in the z-dimension. |
| void LevelSetFunction::SetSignedDistance | ( | int | id_x, |
| int | id_y, | ||
| int | id_z, | ||
| double | sdf ) |
Set the signed distance value of a certian cell of the grid.
| id_x | The index of grid cell in the x-dimension. |
| id_y | The index of grid cell in the y-dimension. |
| id_z | The index of grid cell in the z-dimension. |
| sdf | The new signed distance value of grid cell. |
| void LevelSetFunction::SetSpacing | ( | double | sp | ) |
Set the spacing between grid points.
This method sets the spacing between grid points in each dimension.
| sp | The spacing between grid points. |
| double LevelSetFunction::SignedDistance | ( | Vec3d const & | pos | ) | const |
Compute the signed distance at a point in space.
This method computes the signed distance at a given point in space by interpolating the signed distances stored in the signed_distance_table.
| pos | The point at which to compute the signed distance. |
|
protected |
Coordinates of the corner of the grid.
|
protected |
Dimensions of the grid.
Table containing the signed distance values.
|
protected |
Spacing between grid points.