#include <imesh_imls_surface.h>
Classes | |
struct | integral_data |
a data structure to hold the integral terms. More... | |
Public Member Functions | |
imesh_imls_surface (const imesh_mesh &mesh, double eps=0.01, double lambda=0.1, bool enforce_bounded=false, const vcl_set< unsigned int > &no_normal_faces=vcl_set< unsigned int >()) | |
Constructor. | |
imesh_imls_surface (const imesh_imls_surface &other) | |
Copy Constructor. | |
double | operator() (const vgl_point_3d< double > &p) const |
evaluate the implicit surface at a point. | |
double | operator() (double x, double y, double z) const |
evaluate the implicit surface at a point. | |
double | w2 (double dist2) const |
evaluate the squared weighting function given a squared distance. | |
vgl_box_3d< double > | bounding_box () const |
return a bounding box for the original input mesh. | |
double | deriv (const vgl_point_3d< double > &p, vgl_vector_3d< double > &dp) const |
evaluate the function and its derivative (returned by reference). | |
double | deriv2 (const vgl_point_3d< double > &p, vgl_vector_3d< double > &dp, vnl_double_3x3 &ddp) const |
evaluate the function and its first and second derivatives (returned by reference). | |
void | set_epsilon (double eps) |
change the epsilon (smoothness) of the surface. | |
void | set_lambda (double lambda) |
change the lambda (accuracy parameter). | |
Static Public Member Functions | |
static void | line_integrals (double k1, double k2, double &I1, double &Ix) |
integrals of f(x)dx and x*f(x)dx over [0,1] where f(x)= 1/((x+k1)^2 + k2)^2. | |
static void | line_integrals (double k1, double k2, double &I1, double &Ix, double &dI1, double &dIx, double &dIx2) |
integrals of f(x)dx and x*f(x)dx over [0,1] where f(x)= 1/((x+k1)^2 + k2)^2. | |
static double | line_integral (const vgl_point_3d< double > &x, const vgl_point_3d< double > &p0, const vgl_point_3d< double > &p1, double v0, double v1, double eps) |
line integral of the squared weight function times a linear value on the line from p0 to p1. | |
static vgl_vector_3d< double > | line_integral_deriv (const vgl_point_3d< double > &x, const vgl_point_3d< double > &p0, const vgl_point_3d< double > &p1, double v0, double v1, double eps2) |
The derivative of the line integral with respect to x. | |
static vgl_vector_2d< double > | split_triangle_quadrature (const vgl_point_3d< double > &x, const vgl_point_3d< double > &m, const vgl_point_3d< double > &pp, const vgl_point_3d< double > &pm, double v0, double v1, double v2, double eps) |
area integral of the squared weight function times a linearly interpolated value. | |
template<class T , class F > | |
static T | triangle_quadrature (F quad_func, const vgl_point_3d< double > &x, const vgl_point_3d< double > &p0, const vgl_point_3d< double > &p1, const vgl_point_3d< double > &p2, const vgl_vector_3d< double > &n, double v0, double v1, double v2, double eps) |
area integral of the squared weight function times a linearly interpolated value. | |
static integral_data | split_triangle_quadrature_with_deriv (const vgl_point_3d< double > &x, const vgl_point_3d< double > &m, const vgl_point_3d< double > &pp, const vgl_point_3d< double > &pm, double v0, double v1, double v2, double eps) |
area integral of the squared weight function times a linearly interpolated value. | |
Private Member Functions | |
void | compute_centroids_rec (const vcl_auto_ptr< imesh_kd_tree_node > &node, const vcl_set< unsigned int > &no_normal_faces) |
recursively compute the area weighted centroids. | |
void | compute_unweighed_rec (const vcl_auto_ptr< imesh_kd_tree_node > &node) |
recursively compute the unweighted integrals. | |
void | compute_iso_level () |
compute the iso value such that the mean value at the vertices is zero. | |
void | compute_enclosing_phi () |
adjust the phi values until all vertices are within the iso surface. | |
Private Attributes | |
vcl_vector< vgl_point_3d < double > > | verts_ |
vcl_auto_ptr < imesh_regular_face_array< 3 > > | triangles_ |
vcl_auto_ptr< imesh_kd_tree_node > | kd_tree_ |
vcl_vector< double > | phi_ |
vcl_vector< double > | area_ |
vcl_vector< double > | unweighted_ |
vcl_vector< vgl_point_3d < double > > | centroid_ |
vcl_vector< vgl_vector_3d < double > > | normals_ |
vcl_vector< double > | normal_len_ |
double | eps2_ |
double | lambda_ |
double | iso_level_ |
bool | bounded_ |
Definition at line 25 of file imesh_imls_surface.h.
imesh_imls_surface::imesh_imls_surface | ( | const imesh_mesh & | mesh, |
double | eps = 0.01 , |
||
double | lambda = 0.1 , |
||
bool | enforce_bounded = false , |
||
const vcl_set< unsigned int > & | no_normal_faces = vcl_set<unsigned int>() |
||
) |
Constructor.
Definition at line 19 of file imesh_imls_surface.cxx.
imesh_imls_surface::imesh_imls_surface | ( | const imesh_imls_surface & | other | ) |
Copy Constructor.
Definition at line 94 of file imesh_imls_surface.cxx.
vgl_box_3d< double > imesh_imls_surface::bounding_box | ( | ) | const |
return a bounding box for the original input mesh.
Definition at line 231 of file imesh_imls_surface.cxx.
void imesh_imls_surface::compute_centroids_rec | ( | const vcl_auto_ptr< imesh_kd_tree_node > & | node, |
const vcl_set< unsigned int > & | no_normal_faces | ||
) | [private] |
recursively compute the area weighted centroids.
Definition at line 165 of file imesh_imls_surface.cxx.
void imesh_imls_surface::compute_enclosing_phi | ( | ) | [private] |
adjust the phi values until all vertices are within the iso surface.
Also computes the iso level
Definition at line 127 of file imesh_imls_surface.cxx.
void imesh_imls_surface::compute_iso_level | ( | ) | [private] |
compute the iso value such that the mean value at the vertices is zero.
Definition at line 116 of file imesh_imls_surface.cxx.
void imesh_imls_surface::compute_unweighed_rec | ( | const vcl_auto_ptr< imesh_kd_tree_node > & | node | ) | [private] |
recursively compute the unweighted integrals.
Definition at line 209 of file imesh_imls_surface.cxx.
double imesh_imls_surface::deriv | ( | const vgl_point_3d< double > & | p, |
vgl_vector_3d< double > & | dp | ||
) | const |
evaluate the function and its derivative (returned by reference).
Definition at line 368 of file imesh_imls_surface.cxx.
double imesh_imls_surface::deriv2 | ( | const vgl_point_3d< double > & | p, |
vgl_vector_3d< double > & | dp, | ||
vnl_double_3x3 & | ddp | ||
) | const |
evaluate the function and its first and second derivatives (returned by reference).
Definition at line 467 of file imesh_imls_surface.cxx.
double imesh_imls_surface::line_integral | ( | const vgl_point_3d< double > & | x, |
const vgl_point_3d< double > & | p0, | ||
const vgl_point_3d< double > & | p1, | ||
double | v0, | ||
double | v1, | ||
double | eps2 | ||
) | [static] |
line integral of the squared weight function times a linear value on the line from p0 to p1.
(value at p0 is v0 and at p1 is v1) eps2 is epsilon^2
Definition at line 563 of file imesh_imls_surface.cxx.
vgl_vector_3d< double > imesh_imls_surface::line_integral_deriv | ( | const vgl_point_3d< double > & | x, |
const vgl_point_3d< double > & | p0, | ||
const vgl_point_3d< double > & | p1, | ||
double | v0, | ||
double | v1, | ||
double | eps2 | ||
) | [static] |
The derivative of the line integral with respect to x.
Definition at line 581 of file imesh_imls_surface.cxx.
void imesh_imls_surface::line_integrals | ( | double | k1, |
double | k2, | ||
double & | I1, | ||
double & | Ix | ||
) | [static] |
integrals of f(x)dx and x*f(x)dx over [0,1] where f(x)= 1/((x+k1)^2 + k2)^2.
These equations are wrong in the paper, they should be (for a=1): Beta = atan( k1/sqrt(k2) ) - atan( (k1+1)/sqrt(k2) ) I1 = -Beta * 1/(2*k2^(3/2)) + (k2 - k1*(k1+1)) / (2*k2*(k1^2+k2)*((k1+1)^2+k2)) Ix = Beta * k1/(2*k2^(3/2)) + (k1 + 1) / (2*k2*((k1+1)^2+k2))
Definition at line 496 of file imesh_imls_surface.cxx.
void imesh_imls_surface::line_integrals | ( | double | k1, |
double | k2, | ||
double & | I1, | ||
double & | Ix, | ||
double & | dI1, | ||
double & | dIx, | ||
double & | dIx2 | ||
) | [static] |
integrals of f(x)dx and x*f(x)dx over [0,1] where f(x)= 1/((x+k1)^2 + k2)^2.
Also compute the integrals when f(x)=1/((x+k1)^2 + k2)^3 (for use in derivatives)
Also compute the integrals when f(x)=1/((x+k1)^2 + k2)^3 (for use in derivatives)
Beta = atan( k1/sqrt(k2) ) - atan( (k1+1)/sqrt(k2) ) I1 = -Beta * 1/(2*k2^(3/2)) + (k2 - k1*(k1+1)) / (2*k2*(k1^2+k2)*((k1+1)^2+k2)) Ix = Beta * k1/(2*k2^(3/2)) + (k1 + 1) / (2*k2*((k1+1)^2+k2)) dI1 = 1/8 * ( -Beta*3/k2^(5/2) + (5*k2^3 - (k1*(k1+1)-3)*k2^2 - k1*(k1+1)*(9*k1*(k1+1)+5)*k2 - 3*k1^3*(k1+1)^3) / (k2^2*(k1^2+k2)^2*((k1+1)^2+k2)^2) ) dIx = 1/8 * ( Beta*3*k1/k2^(5/2) + ((k1^2+k2)*((3*(k1+1)+1)*k2^2 + (k1+1)*(6*k1^2+3*k1+2)*k2 + 3*k1^2*(k1+1)^3)) /(k2^2*(k1^2+k2)^2*((k1+1)^2+k2)^2) ) dIx2 = 1/8 * ( -Beta*(3*k1^2+k2)/k2^(5/2) - ((k1^2+k2)^2*(k2^2 + (k1+1)*(4*k1-1)*k2 + 3*k1*(k1+1)^3)) /(k2^2*(k1^2+k2)^2*((k1+1)^2+k2)^2) )
Definition at line 526 of file imesh_imls_surface.cxx.
double imesh_imls_surface::operator() | ( | const vgl_point_3d< double > & | p | ) | const |
evaluate the implicit surface at a point.
Definition at line 288 of file imesh_imls_surface.cxx.
double imesh_imls_surface::operator() | ( | double | x, |
double | y, | ||
double | z | ||
) | const [inline] |
evaluate the implicit surface at a point.
Definition at line 41 of file imesh_imls_surface.h.
void imesh_imls_surface::set_epsilon | ( | double | eps | ) |
change the epsilon (smoothness) of the surface.
Definition at line 238 of file imesh_imls_surface.cxx.
void imesh_imls_surface::set_lambda | ( | double | lambda | ) | [inline] |
change the lambda (accuracy parameter).
Definition at line 67 of file imesh_imls_surface.h.
vgl_vector_2d< double > imesh_imls_surface::split_triangle_quadrature | ( | const vgl_point_3d< double > & | x, |
const vgl_point_3d< double > & | pm, | ||
const vgl_point_3d< double > & | p1, | ||
const vgl_point_3d< double > & | p2, | ||
double | vm, | ||
double | v1, | ||
double | v2, | ||
double | eps | ||
) | [static] |
area integral of the squared weight function times a linearly interpolated value.
m is the point closest point on the triangle to sample point x pp is second closest vertex and pm is the furthest call triangle_quadrature to first split an arbitrary triangle eps2 is epsilon^2
m is the point closest point on the triangle to sample point x p0 and p1 are the other vertices call triangle_quadrature to first split an arbitrary triangle eps2 is epsilon^2
Definition at line 606 of file imesh_imls_surface.cxx.
imesh_imls_surface::integral_data imesh_imls_surface::split_triangle_quadrature_with_deriv | ( | const vgl_point_3d< double > & | x, |
const vgl_point_3d< double > & | pm, | ||
const vgl_point_3d< double > & | p1, | ||
const vgl_point_3d< double > & | p2, | ||
double | vm, | ||
double | v1, | ||
double | v2, | ||
double | eps | ||
) | [static] |
area integral of the squared weight function times a linearly interpolated value.
Also computes vector term used in the derivative m is the point closest point on the triangle to sample point x pp is second closest vertex and pm is the furthest call triangle_quadrature to first split an arbitrary triangle eps2 is epsilon^2
Also computes vector term used in the derivative m is the point closest point on the triangle to sample point x p0 and p1 are the other vertices call triangle_quadrature to first split an arbitrary triangle eps2 is epsilon^2
Definition at line 690 of file imesh_imls_surface.cxx.
T imesh_imls_surface::triangle_quadrature | ( | F | quad_func, |
const vgl_point_3d< double > & | x, | ||
const vgl_point_3d< double > & | p0, | ||
const vgl_point_3d< double > & | p1, | ||
const vgl_point_3d< double > & | p2, | ||
const vgl_vector_3d< double > & | n, | ||
double | v0, | ||
double | v1, | ||
double | v2, | ||
double | eps | ||
) | [static] |
area integral of the squared weight function times a linearly interpolated value.
eps2 is epsilon^2
Definition at line 18 of file imesh_imls_surface.txx.
double imesh_imls_surface::w2 | ( | double | dist2 | ) | const [inline] |
evaluate the squared weighting function given a squared distance.
Definition at line 47 of file imesh_imls_surface.h.
vcl_vector<double> imesh_imls_surface::area_ [private] |
Definition at line 186 of file imesh_imls_surface.h.
bool imesh_imls_surface::bounded_ [private] |
Definition at line 195 of file imesh_imls_surface.h.
vcl_vector<vgl_point_3d<double> > imesh_imls_surface::centroid_ [private] |
Definition at line 188 of file imesh_imls_surface.h.
double imesh_imls_surface::eps2_ [private] |
Definition at line 192 of file imesh_imls_surface.h.
double imesh_imls_surface::iso_level_ [private] |
Definition at line 194 of file imesh_imls_surface.h.
vcl_auto_ptr<imesh_kd_tree_node> imesh_imls_surface::kd_tree_ [private] |
Definition at line 184 of file imesh_imls_surface.h.
double imesh_imls_surface::lambda_ [private] |
Definition at line 193 of file imesh_imls_surface.h.
vcl_vector<double> imesh_imls_surface::normal_len_ [private] |
Definition at line 190 of file imesh_imls_surface.h.
vcl_vector<vgl_vector_3d<double> > imesh_imls_surface::normals_ [private] |
Definition at line 189 of file imesh_imls_surface.h.
vcl_vector<double> imesh_imls_surface::phi_ [private] |
Definition at line 185 of file imesh_imls_surface.h.
vcl_auto_ptr<imesh_regular_face_array<3> > imesh_imls_surface::triangles_ [private] |
Definition at line 182 of file imesh_imls_surface.h.
vcl_vector<double> imesh_imls_surface::unweighted_ [private] |
Definition at line 187 of file imesh_imls_surface.h.
vcl_vector<vgl_point_3d<double> > imesh_imls_surface::verts_ [private] |
Definition at line 181 of file imesh_imls_surface.h.