MLS Surface Library





Abstract

This software was developed by Bruno Madeira during the course 3D Reconstruction Methods, offered at IMPA in 2007, by the professors Thomas Lewiner and Luiz Velho.

    It is a library written in C++, that implements the algorithm presented in the paper “Defining Point-Set Surfaces”, by Nina Amenta and Yong Joo Kil, in the Siggraph 2004. This algorithm allow us to sample points over a surface defined by a point cloud.

    As pointed in the paper above, Moving Least Squares (MLS) Surfaces define a specific class of Extremal Surfaces. Thus, we decided to provide one C++ class to represent Extremal Surfaces, and so, specialize this concept in a class that represents MLS Surfaces. This approach allow us to extend the library in the future, reducing the effort by code reuse, and keeping the compatibility with the general concept of Extremal Surface using the C++ polymorphism.


Requirements

The GNU Scientific Library is required.

API

In order to create an MLS surface we must use the MLSSurface class, which API is explained below:

MLSSurface::MLSSurface( int npoints, Vector3 *points )
A construtor that creates an MLS surface instance defined by the array of vectors points, wich has npoints.
void MLSSurface::h( float hh )
It changes the smoothness parameter h related to the MLS surface.

Some members functions from the superclass ExtremalSurface must be used too:

virtual Vector3 ExtremalSurface::proj( const Vector3 &p )
It returns the projection of the point p over the surface.
void ExtremalSurface::optimization_radius( float r )
Since we are using the golden section algorithm to perform optimizations, we need to select previously an interval wich contains the minimum.
This function defines the size of this interval. It should be small enough to contain only one local minimun inside, and large enough to avoid performance problems.
void ExtremalSurface::convergency_tol( float c )
It defines the size of the interval that must be achieved to stop the splitting process done by the golden section algorithm.
void ExtremalSurface::max_niter( int m )
It defines the maximum number of iterations performed by each evaluation of the golden section algorithm.

Sample Code

In this code, we projected a set of points selected in a cylindical surface over a spherical surface defined by a point cloud.
The sphere is inside the cylinder. The radius of the cylinder is 12 and the radius of the sphere is 10.

#include "mls_surface.h"
#define PI 3.1416

int main( int argc, char ** argv )
{
  double u, v, r = 10, R = 12;
  int npoints = 0;
  Vector3 p[1000];

  for( u = 0; u <= 2*PI; u+= PI/10 )
      for( v = -PI/2.; v <= PI/2.; v+= PI/10 )
          p[npoints++] = Vector3( r*cos(v)*cos(u), r*cos(v)*sin(u), r*sin(v) );

  MLSSurface m(npoints, p);
  m.h(1);
  m.optimization_radius(.5);
  m.convergency_tol(.01);
  m.max_niter(50);

  Vector3 prj, source;

  for( u = -10; u < 10; u+= 1 )
      for( v = 0; v < PI; v += .1 ){
          source = Vector3( R*cos(v), R*sin(v), u );
          std::cout << "Source: " << source << "\n";
          prj = m.proj( source );
          std::cout << "Projection: " << prj << " length: " << prj.length() << "\n";
      }
}


Output

The output of the previus example is something like this:

Source: 12 0 -10
Projection: 8.08925 -2.55489e-06 -5.87839 length: 9.99958
Source: 11.9401 1.198 -10
Projection: 8.0907 -0.000401822 -5.87955 length: 10.0014
...

As expected, the length value is about 10 for each projected point.

Download


     mlssurf.tar.gz ( 100 KB )

Examples

We present now some examples of surfaces formed by sampled points, wich were obtained using the software.
We have chosen different values for the parameter h. In the left we present the original point cloud. In the middle, we show the result assuming h = 2, and, in the right, we show the result assuming h = 3.



References

1) Nina Amenta and Yong Kil.Defining point-set surfaces, SIGGRAPH 2004.

2) A. Adamson and M. Alexa. Approximating and Intersecting Surfaces from Points. In Eurographics Symposiun on Geometry Processing 2003.

3) M. Alexa M. J. Behr J, D. Cohen-Or, S. Fleishman, D. Levin and C. T. Silva. Computing and rendering point set surfaces. In IEEE Transaction on Visualization and Computer Graphics Vol 9, 1, 2003.



Generated on Tue Feb 19 14:12:19 2008 by  doxygen 1.5.1