Ponca  7d8ac87a7de01d881c9fde3c42e397b44bffb901
Point Cloud Analysis library
Loading...
Searching...
No Matches
Defining Points in Ponca
[Go back to user manual]

Points

Ponca is designed to be lightweight and easy to integrate in existing code bases. To achieve this goal:

  • Ponca does not include datastructures to represent and store point cloud data, and let clients defining how to store and access data,
  • Ponca cannot rely on C++ polymorphism to define its API: most computational objects used through the library involve very small computation. Combining these computation using polymorphism requires to use virtual functions, which introduce a very high overhead (considering the small computation of each class).
  • Instead, Ponca is based on 'Concepts' that need to be followed to use/extend the library.

Hence, we expect client code to define how point data can be accessed. The minimal API required to use Ponca:

  • an integer Dim defining the number of dimensions of the ambient space (3 for 3d point clouds)
  • types Scalar and VectorType that will be used by the library to represent scalars and vectors.
  • a default constructor
  • read and read/write access to an attribute describing the position of a point: pos()

A example respecting those minimal API is:

class PointConcept
{
public:
/* \brief Defines the ambient space dimension, 3 in this example */
enum
{
Dim = 3
};
// \brief Defines the type used ton encode scalar values
typedef float Scalar;
// \brief Defines type used ton encode vector values
//
// \note VectorType should have the same API than Eigen::Matrix API,
// and be implicitly convertible to Eigen::Matrix
typedef Eigen::Matrix<Scalar, Dim, 1> VectorType;
// \brief Default constructor
PONCA_MULTIARCH inline PointConcept(const VectorType& pos = VectorType::Zero());
// \brief Read access to the position property
// \note The return type should have the same API than VectorType (e.g. const Eigen::Map< const VectorType
// >&) and be implicitly convertible to Eigen::Matrix
PONCA_MULTIARCH inline const VectorType& pos() const;
// \brief Write access to the position property
// \note Same constraints on return type
PONCA_MULTIARCH inline VectorType& pos();
}; // class PointConcept
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
Definition basket.h:326
Note
The PONCA_MULTIARCH macro allows for custom datastructure to be used within GPU environment. See: Cuda for more information about GPU computation.

Depending on the use cases, other types (e.g. MatrixType) or accessors (normal()) might be required.

There is no notion of Pointsets in Ponca. Most methods can work by providing individual points. For convenience, some functions offer utilities when iterating over collections of points is necessary. In these cases, only iterators (or indices within a container) are required. While this design is compatible with any data structure, using a contiguous container is recommended for optimal performance.

See also
Spatial Partitioning module

Utility classes and functions

Ponca still provides some basic points structure that follow the minimal API described above relying on Eigen storage. Those structures can be found under the header &lt;Ponca/Common&gt;.

Class Capabilities Example Usage
PointPosition Provides position PointPosition<float, 3> pt({1, 2, 3});
PointPositionNormal Provides position and normal PointPositionNormal<float, 3> pt({1, 2, 3}, {1, 0, 0});
PointPositionNormalBinding Provides position and normal from a linear 1D Scalar array See Ponca data-structure binding
PointPositionNormalLazyBinding Similar to PointPositionNormalBinding, but only convert data to eigen when needed See Ponca data-structure binding

The library also provides a few utilities to generate (noisy) points on simple geometrical object. All function expect the Point structure to provide both poisitions and normals.

Function Documentation
getRandomPoint Generate a random noisy point on the unit sphere.
getPointOnSphere Generate points on a sphere.
getPointOnCircle Generate points on a circle. Only x/y coordinates are filled.
getPointOnPlane Generate points on a plane
getPointOnParaboloid Generate a point on a paraboloid. Only works for 3D points.
Warning
Those function add noise to both position and normal by default. Read documentation of methods to disable either one of those.