Skip to content

Module Parametrization

Georg Muntingh edited this page Aug 17, 2017 · 2 revisions

Purpose

The purpose of the GoTools Parametrization Library is to compute a reasonable parametrization for a discrete geometrical object. This geometrical object can be a planar graph embedded in ${\bf R}^2$ or ${\bf R}^3$ (triangulation, rectangular grid, etc.) or a point cloud without any explicit connectivity, but with an identified border.

There are many contexts for which such a parametrization is useful, for example when mapping textures onto polygonal meshes or when triangulating a surface from a set of scattered 3D points. The algorithms contained in this software are based on the work of Dr. Michael Floater.

How it can be used

This library has three degrees of freedom for specifying the parametrization:

  • choice of data structure
  • choice of boundary parametrization
  • choice of parametrization of the interior

Choice of data structure

As mentioned in the last section, the data to be parametrized can be of various kinds, from general polygonal meshes (3D points and connectivity) to point clouds (no connectivity information, but boundary nodes must be indentified and ordered). The various possible data types are given as subclasses of PrOrganizedPoints. You should choose the one that corresponds to the data that you want to parametrize. Many of these classes have read/write functionality for a generic format; you might want to reimplement these to correspond with the format of the data you are using. The list of currently available data structures are:

  • PrUnorganized_OP
  • PrUnorganized_OP
  • PrTriangulation_OP
  • PrRectangularGrid_OP
  • PrPlanarGraph_OP

You can of course write a totally _new specialization of the PrOrganizedPoints class, as long as you implement all the required member functions.

Choice of boundary parametrization

The boundary of the surface must be parametrized before the surface interior. This is done by the class PrParametrizeBdy. There are several ways of parametrizing the boundary. You can specify the method you want to use through the PrParametrizeBdy::setParamKind() member function. There are currently three options:

  • PrCHORDLENGTHBDY --- parametrize by chordlength (generally preferred)
  • PrCENTRIPETAL --- parametrize using square root of boundary point distances
  • PrUNIFBDY --- parametrize by imposing a fixed distance between each boundary point

Another thing that must be specified when determining the parametrization of the boundary is the shape of the parametrical domain. It can be a circle (default), or a rectangle (corners must be specified).

Choice of interior parametrization

The parametrization of the interior can also be done in several ways, which are each implemented as a subclass of PrParametrizeInt. Currently available methods are:

  • PrPrmMeanValue (generally preferred)
  • PrPrmEDDHLS
  • PrPrmLeastSquare
  • PrPrmShpPres
  • PrPrmUniform

Putting it all together

The general procedure for parametrizing a data set can be summarized as follows:

  • Prepare the data structure
    • establish an object of the appropriate data structure (subclass of PrOrganizedPoints). This object should be owned by a shared pointer (as found in the Boost library.
    • read your data into the structure, either by using one of the provided member functions like PrTriangulation_OP::scanRawData(), PrTriangulation_OP::scan(), or by adding your own I/O-routines.
  • Parametrize the boundary
    • Establish a PrParametrizeBdy object.
    • Associate it with your data by using the PrParametrizeBdy::attach() function.
    • Choose a parametrization type by calling the PrParametrizeBdy::setParamKind() function.
    • Execute the parametrization by calling PrParametrizeBdy(). When calling this function without arguments, the parametrical domain will be a circle. A rectangular parameter domain can also be used. This is specified by additional arguments to the function.
  • Parametrize the interior
    • When the boundary has been successfully parametrized, the interior can be treated. First, you need to instantiate an object of the desired subclass of PrParametrizeInt.
    • Associate your data to this object by using the PrParametrizeInt::attach() function.
    • Carry out the parametrization by calling the PrParametrizeInt::parametrize() function.
  • Accessing the result
    • The parametrization can be accessed in several ways, through the PrOrganizedPoints interface of your data structure:
      • Several print routines can be used to dump all nodes with/without coordinates and associated parameters (PrOrganizedPoints::printUVNodes, PrOrganizedPoints::printUVXYZNodes, etc.).
      • The parameters of an individual node can be accessed by the PrOrganizedPoints::getU() and PrOrganizedPoints::getV() functions.
    • Most of the subclasses of PrOrganizedPoints also have print() and scan() functions that can be used for reading and writing their data to a stream.
    • You can write your own customised data access and streaming functions.

Example program

The procedure mentioned above can be observed in a working program located in the examples folder. The source file name is demo.C. The program is run from the command line, where you can also specify the data. It can handle both point clouds and triangulations. A sample triangulation is provided in the data/ folder.

For instance, try

$ ./demo -i data/gjoevik_triang

(There are also more options you can specify; to see the list of options, run the program without any arguments).

If the input data is a triangulation (the case above), the resulting, parametrized triangulation will be saved in the file triangulation. In any case, the parametrization for each node/point will be dumped to the file uv_nodes.

Clone this wiki locally