Header file containing functions that compute the analytical solution of the signed distance function (SDF) for a 3D sphere and a 2D disk of defined radius on a grid. More...
#include <iostream>
#include "Vector/vector_dist.hpp"
#include "Grid/grid_dist_id.hpp"
Go to the source code of this file.
Functions | |
template<typename point_type , typename space_type > | |
space_type | get_analytic_sdf_sphere (const point_type coords, const space_type radius, const space_type center_x=0, const space_type center_y=0, const space_type center_z=0) |
Computes the analytical signed distance function of a sphere for a given point in space. | |
template<typename point_type , typename space_type > | |
space_type | get_analytic_sdf_sphere (const point_type coords, const space_type radius, const space_type center[point_type::dims]) |
Based on coordinates, radius and center, returns signed distance function of a sphere. | |
template<size_t SDF_exact, typename grid_type , typename space_type > | |
void | init_analytic_sdf_sphere (grid_type &grid, const space_type radius, const space_type center_x=0, const space_type center_y=0, const space_type center_z=0) |
Initializes the exact solution of the signed distance function of a sphere on an OpenFPM grid. | |
template<size_t SDF_exact, typename grid_type , typename space_type > | |
void | init_analytic_sdf_sphere (grid_type &grid, const space_type radius, const space_type center[grid_type::dims]) |
Computes the analytical signed distance function of a sphere for a given point in space. | |
template<typename point_type , typename space_type > | |
space_type | get_analytic_sdf_circle (point_type coords, const space_type radius, const space_type center_x=0, const space_type center_y=0) |
Computes the analytical signed distance function of a circle for a given point in space. | |
template<typename point_type , typename space_type > | |
space_type | get_analytic_sdf_circle (const point_type coords, const space_type radius, const space_type center[point_type::dims]) |
Based on coordinates, radius and center, returns signed distance function of a disk. | |
template<size_t SDF_exact, typename grid_type , typename space_type > | |
void | init_analytic_sdf_circle (grid_type &grid, const space_type radius, const space_type center_x=0, const space_type center_y=0) |
Initializes the exact solution of the signed distance function of a circle on an OpenFPM grid. | |
template<size_t SDF_exact, typename grid_type , typename space_type > | |
void | init_analytic_sdf_circle (grid_type &grid, const space_type radius, const space_type center[grid_type::dims]) |
Computes the analytical signed distance function of a disk for a given point in space. | |
Header file containing functions that compute the analytical solution of the signed distance function (SDF) for a 3D sphere and a 2D disk of defined radius on a grid.
Definition in file AnalyticalSDF.hpp.
#define ANALYTICAL_SDF_HPP |
Definition at line 21 of file AnalyticalSDF.hpp.
space_type get_analytic_sdf_circle | ( | const point_type | coords, |
const space_type | radius, | ||
const space_type | center[point_type::dims] | ||
) |
Based on coordinates, radius and center, returns signed distance function of a disk.
point_type | Template type of input coordinates. |
space_type | Template type of space. |
coords | Input coordinates of type point_type. |
radius | Radius of type space_type. |
center | Center array of type space_type[2]. |
Definition at line 206 of file AnalyticalSDF.hpp.
space_type get_analytic_sdf_circle | ( | point_type | coords, |
const space_type | radius, | ||
const space_type | center_x = 0 , |
||
const space_type | center_y = 0 |
||
) |
Computes the analytical signed distance function of a circle for a given point in space.
At the center of the circle, φ_SDF_analytic = Radius. Moving outwards from the center on, the value for the SDF decreases steadily, eventually becomes 0 at the circle surface and negative beyond the surface. The analytic SDF for a circle of radius R and center (a, b) is thus:
\[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2)} \]
point_type | Template type of OpenFPM Point<dimension, type>. |
space_type | Template type of radius. |
coords | Point_type coordinates of point. |
radius | Space_type radius of the disk. |
center_x | Space_type x-coordinate of disk center. |
center_y | Space_type y-coordinate of disk center. |
Definition at line 181 of file AnalyticalSDF.hpp.
space_type get_analytic_sdf_sphere | ( | const point_type | coords, |
const space_type | radius, | ||
const space_type | center[point_type::dims] | ||
) |
Based on coordinates, radius and center, returns signed distance function of a sphere.
point_type | Template type of input coordinates. |
space_type | Template type of space. |
coords | Input coordinates of type point_type. |
radius | Radius of type space_type. |
center | Center array of type space_type[3]. |
Definition at line 72 of file AnalyticalSDF.hpp.
space_type get_analytic_sdf_sphere | ( | const point_type | coords, |
const space_type | radius, | ||
const space_type | center_x = 0 , |
||
const space_type | center_y = 0 , |
||
const space_type | center_z = 0 |
||
) |
Computes the analytical signed distance function of a sphere for a given point in space.
At the center of the sphere, φ_SDF_analytic = Radius. Moving outwards from the center on, the value for the SDF decreases steadily, eventually becomes 0 at the sphere surface and negative beyond the surface. The analytic SDF for a sphere of radius R and center (a, b, c) is thus:
\[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} \]
point_type | Template type of OpenFPM Point<dimension, type>. |
space_type | Template type of radius. |
coords | Point_type coordinates of point. |
radius | Space_type radius of the sphere. |
center_x | Space_type x-coordinate of sphere center. |
center_y | Space_type y-coordinate of sphere center. |
center_z | Space_type z-coordinate of sphere center. |
Definition at line 46 of file AnalyticalSDF.hpp.
void init_analytic_sdf_circle | ( | grid_type & | grid, |
const space_type | radius, | ||
const space_type | center[grid_type::dims] | ||
) |
Computes the analytical signed distance function of a disk for a given point in space.
At the center of the circle, φ_SDF_analytic = Radius. Moving outwards from the center on, the value for the SDF decreases steadily, eventually becomes 0 at the circle surface and negative beyond the surface. The analytic SDF for a circle of radius R and center (a, b) is thus:
\[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2)} \]
SDF_exact | Size_t index of property to which analytical SDF of circle will be saved. |
grid_type | Template type of input grid. |
space_type | Template type of space. |
grid | Input grid of type grid_type. |
radius | Radius of type space_type. |
center | Array containing 2 elements for center coordinate in x and y. |
Definition at line 268 of file AnalyticalSDF.hpp.
void init_analytic_sdf_circle | ( | grid_type & | grid, |
const space_type | radius, | ||
const space_type | center_x = 0 , |
||
const space_type | center_y = 0 |
||
) |
Initializes the exact solution of the signed distance function of a circle on an OpenFPM grid.
Solves the exact SDF for each grid nodes and writes the solution to a given property.
SDF_exact | Index of property where the anaytical solution for the SDF should be written to. |
grid_type | Template type of the input grid. |
space_type | Template type of radius and center coordinates. |
grid | Input OpenFPM grid. |
radius | Radius of the filled circle. |
center_x | X-coordinate of the circle center. |
center_y | Y-coordinate of the circle center. |
Definition at line 234 of file AnalyticalSDF.hpp.
void init_analytic_sdf_sphere | ( | grid_type & | grid, |
const space_type | radius, | ||
const space_type | center[grid_type::dims] | ||
) |
Computes the analytical signed distance function of a sphere for a given point in space.
At the center of the circle, φ_SDF_analytic = Radius. Moving outwards from the center on, the value for the SDF decreases steadily, eventually becomes 0 at the circle surface and negative beyond the surface. The analytic SDF for a circle of radius R and center (a, b, c) is thus:
\[ \phi_{SDF}(x, y, z) = R - \sqrt{((x-a)^2 + (y-b)^2 + (z-c)^2)} \]
SDF_exact | Size_t index of property to which analytical SDF of sphere will be saved. |
grid_type | Template type of input grid. |
space_type | Template type of space. |
grid | Input grid of type grid_type. |
radius | Radius of type space_type. |
center | Array containing 3 elements for center coordinate in x, y and z. |
Definition at line 138 of file AnalyticalSDF.hpp.
void init_analytic_sdf_sphere | ( | grid_type & | grid, |
const space_type | radius, | ||
const space_type | center_x = 0 , |
||
const space_type | center_y = 0 , |
||
const space_type | center_z = 0 |
||
) |
Initializes the exact solution of the signed distance function of a sphere on an OpenFPM grid.
Solves the exact SDF for each grid nodes and writes the solution to a given property.
SDF_exact | Index of property where the anaytical solution for the SDF should be written to. |
grid_type | Template type of the input grid. |
space_type | Template type of radius the sphere is supposed to have. |
grid | Input OpenFPM grid. |
radius | Radius of the filled sphere. |
center_x | Space_type x-coordinate of sphere center. |
center_y | Space_type y-coordinate of sphere center. |
center_z | Space_type z-coordinate of sphere center. |
Definition at line 102 of file AnalyticalSDF.hpp.