OptoInspect3D Inline - alg3Dlib
3.4.0
Library for measured 3D data processing
|
This module contains functions to smooth, homogenize point clouds, compute features and normal vectors. More...
Data Structures | |
struct | ALG3D_Intersection |
Intersection between a ray and a triangle mesh. More... | |
Enumerations | |
enum | SmoothingMethod { Gaussian, ShapePreserving, EdgePreserving } |
Enum to select a smoothing method. More... | |
enum | SurfaceFeatureType { IntrinsicCurvature, ExtrinsicCurvature, LocalEdges, LocalDensity } |
Enum to select a surface feature type. More... | |
Functions | |
int __cdecl | ALG3D_createMesh (const ALG3D_Point3d *data, size_t *indices, size_t numTriangles, ALG3D_MESH *mesh) |
Builds a mesh from given points and indices. Three consecutive entries in the indices array define the indices of the 3 points (in the data array) of a single triangle. More... | |
int __cdecl | ALG3D_getNumberOfTriangles (const ALG3D_MESH mesh, size_t *numTriangles) |
Retrieves the number of triangles in a mesh. This number does not need to be the same as the one used in ALG3D_createMesh, since the mesh structure is optimized during the creation (invalid triangles are removed). More... | |
int __cdecl | ALG3D_getTrianglePoints (const ALG3D_MESH mesh, size_t triangleIndex, ALG3D_Point3d *a, ALG3D_Point3d *b, ALG3D_Point3d *c) |
Retrieves the 3 vertices of a triangle in a mesh. Use this function to get the triangle (points), returned as an index by the ALG3D_raytracing_* functions. More... | |
int __cdecl | ALG3D_createMeshTree (const ALG3D_MESH mesh, ALG3D_MESHTREE *meshTree) |
Builds a kdTree from a mesh. More... | |
int __cdecl | ALG3D_freeMesh (ALG3D_MESH mesh) |
Releases memory of a given mesh object. It's up to the application to ensure that the pointer is valid. More... | |
int __cdecl | ALG3D_freeMeshTree (ALG3D_MESHTREE meshTree) |
Releases memory of a given kdTree (mesh) object. It's up to the application to ensure that the pointer is valid. More... | |
int __cdecl | ALG3D_findNearestPoint2Mesh (const ALG3D_MESHTREE meshTree, double radius, ALG3D_Point3d pt, ALG3D_Point3d *nn) |
Finds the nearest neighbour within a query radius to a given point. More... | |
int __cdecl | ALG3D_findNearestPointAndTriangle2Mesh (const ALG3D_MESHTREE meshTree, double radius, ALG3D_Point3d pt, ALG3D_Point3d *nn, size_t *triangleIndex) |
Finds the nearest neighbour and corresponding triangle index within a query radius to a given point. More... | |
int __cdecl | ALG3D_computeDistances2Mesh (const ALG3D_MESHTREE meshTree, const ALG3D_Point3d *pts, size_t numPts, double maxDistance, double *distances) |
Computes all signed distances of a point set to a mesh given as a kd-tree. More... | |
int __cdecl | ALG3D_sampleMesh (const ALG3D_MESH mesh, size_t numSamples, ALG3D_Point3d **points, size_t *numPts) |
Samples a mesh uniformly with a given number of points. More... | |
int __cdecl | ALG3D_sampleMeshNormals (const ALG3D_MESH mesh, size_t numSamples, ALG3D_Point3d **points, ALG3D_Point3d **normals, size_t *numPts) |
Samples a mesh uniformly with a given number of points and generates normal vectors at the samples. More... | |
int __cdecl | ALG3D_sampleMeshDensity (const ALG3D_MESH mesh, double density, ALG3D_Point3d **points, size_t *numPts) |
Samples a mesh uniformly with a given density of points. More... | |
int __cdecl | ALG3D_sampleMeshDensityNormals (const ALG3D_MESH mesh, double density, ALG3D_Point3d **points, ALG3D_Point3d **normals, size_t *numPts) |
Samples a mesh uniformly with a given density of points and generates normal vectors at the samples. More... | |
int __cdecl | ALG3D_raytracing_doesIntersect (const ALG3D_MESHTREE meshTree, ALG3D_Point3d rayOrigin, ALG3D_Point3d rayDirection, double maxHitDistance, int *doesIntersect) |
Checks if a ray intersects with a mesh. More... | |
int __cdecl | ALG3D_raytracing_firstIntersection (const ALG3D_MESHTREE meshTree, ALG3D_Point3d rayOrigin, ALG3D_Point3d rayDirection, double maxHitDistance, ALG3D_Intersection *intersection, int *doesIntersect) |
Computes the first intersection between a ray and a mesh. More... | |
int __cdecl | ALG3D_raytracing_allIntersections (const ALG3D_MESHTREE meshTree, ALG3D_Point3d rayOrigin, ALG3D_Point3d rayDirection, double maxHitDistance, ALG3D_Intersection **intersections, size_t *numIntersections) |
Computes all intersections between a ray and a mesh. More... | |
int __cdecl | ALG3D_subdivideLongEdges (const ALG3D_Point3d *points, size_t *indices, size_t numTriangles, ALG3D_Point3d **newPoints, size_t **newIndices, size_t *newNumTriangles, double maxEdgeLength) |
Subdivides all edges that are too long. More... | |
int | ALG3D_computeConnectedRegions (const ALG3D_Point3d *ptsIn, size_t numIn, double radius, size_t *regionIdx, size_t *numIdx) |
Computes spatially connected points and isolated regions. More... | |
int | ALG3D_computeConnectedRegionsTree (const ALG3D_KDTREE tree, double radius, size_t *regionIdx, size_t *numIdx) |
Computes spatially connected points and isolated regions using a precomputed KdTree. More... | |
int | ALG3D_computeThinningToNeighborhood (ALG3D_Point3d *pts, size_t *numPts, double radius) |
Computes a homogeneous thinning of 3d point set to a given radius (neighborhood). More... | |
int | ALG3D_computeThinningToPointNumber (ALG3D_Point3d *pts, size_t *numPts, size_t resultingNumPoints) |
Computes a homogeneous thinning of 3d point set to a given number of resulting points. More... | |
int | ALG3D_computeSmoothedThinning (ALG3D_Point3d *pts, size_t *numPts, double radius) |
Computes a combined homogeneous thinning and smoothing of a 3d point set. More... | |
int | ALG3D_computeSmoothing (const ALG3D_Point3d *pts, size_t numPts, ALG3D_Point3d *ptsOut, double radius, SmoothingMethod method) |
Computes an edge preserving smoothing of point cloud given by a KD-Tree. More... | |
int | ALG3D_computeNormalVectors (const ALG3D_Point3d *pts, size_t numPts, ALG3D_Point3d *normals, double radius) |
Computes surface normals for the given pointcloud within a neighborhood defined by a radius. More... | |
int | ALG3D_computeNormalVectorsTree (const ALG3D_KDTREE tree, ALG3D_Point3d *normals, double radius) |
Computes surface normals for the given pointcloud (represented by its KdTree) within a neighborhood defined by a radius. More... | |
int | ALG3D_computeNormalVectorsFast (const ALG3D_Point3d *pts, size_t numPts, ALG3D_Point3d *normals, double radius) |
Computes surface normals for the given pointcloud within a neighborhood defined by a radius. More... | |
int | ALG3D_computeNormalVectorsTreeFast (const ALG3D_KDTREE tree, ALG3D_Point3d *normals, double radius) |
Computes surface normals vector for the given pointcloud (represented by its KdTree) within a neighborhood defined by a radius. More... | |
int | ALG3D_computeNormalVectorsKNN (const ALG3D_Point3d *pts, size_t numPts, ALG3D_Point3d *normals, size_t maxPoints) |
Computes surface normals vector for the given pointcloud from K-Nearest-Neighbours. More... | |
int | ALG3D_computeNormalVectorsKNNFast (const ALG3D_Point3d *pts, size_t numPts, ALG3D_Point3d *normals, size_t maxPoints) |
Computes surface normals vector for the given pointcloud from K-Nearest-Neighbours. More... | |
int | ALG3D_computeNormalVectorsKNNTree (const ALG3D_KDTREE tree, ALG3D_Point3d *normals, size_t maxPoints) |
Computes surface normals vector for the given pointcloud (represented by its KdTree) from K-Nearest-Neighbours. More... | |
int | ALG3D_computeNormalVectorsKNNTreeFast (const ALG3D_KDTREE tree, ALG3D_Point3d *normals, size_t maxPoints) |
Computes surface normals vector for the given pointcloud (represented by its KdTree) from K-Nearest-Neighbours. More... | |
int | ALG3D_computeOutlierFactor (const ALG3D_Point3d *pts, size_t numPts, double *values, size_t maxPoints) |
Computes the local outlier factors of the points from a point cloud. More... | |
int | ALG3D_computeOutlierFactorTree (const ALG3D_KDTREE tree, double *values, size_t maxPoints) |
Computes the local outlier factor of the points from a point cloud (represented by its KdTree). More... | |
int | ALG3D_removeOutliers (ALG3D_Point3d *pts, size_t *numPts, size_t maxPoints, double thresh) |
Remove outliers from the point cloud. More... | |
int | ALG3D_removeOutliersTree (ALG3D_KDTREE tree, size_t maxPoints, double thresh) |
Remove outliers from the point cloud. More... | |
int | ALG3D_computeSurfaceFeatures (const ALG3D_Point3d *pts, size_t numPts, double *values, double radius, SurfaceFeatureType type) |
Computes surface features for each point of a given point set within a neighborhood defined by a radius. More... | |
int | ALG3D_computeSurfaceFeaturesFast (const ALG3D_Point3d *pts, size_t numPts, double *values, double radius, SurfaceFeatureType type) |
Computes surface features for each point of a given point set within a neighborhood defined by a radius. More... | |
int | ALG3D_computeSurfaceFeaturesTree (const ALG3D_KDTREE tree, double *values, double radius, SurfaceFeatureType type) |
Computes surface features for each point of a given point set (represented by its KdTree) within a neighborhood defined by a radius. More... | |
int | ALG3D_computeSurfaceFeaturesTreeFast (const ALG3D_KDTREE tree, double *values, double radius, SurfaceFeatureType type) |
Computes surface features for each point of a given point set (represented by its KdTree) within a neighborhood defined by a radius. More... | |
int | ALG3D_computeSurfaceFeaturesKNN (const ALG3D_Point3d *pts, size_t numPts, double *values, size_t maxPoints, SurfaceFeatureType type) |
Computes surface features for each point of a given point set from K-Nearest-Neighbours. More... | |
int | ALG3D_computeSurfaceFeaturesKNNFast (const ALG3D_Point3d *pts, size_t numPts, double *values, size_t maxPoints, SurfaceFeatureType type) |
Computes surface features for each point of a given point set from K-Nearest-Neighbours. More... | |
int | ALG3D_computeSurfaceFeaturesKNNTree (const ALG3D_KDTREE tree, double *values, size_t maxPoints, SurfaceFeatureType type) |
Computes surface features for each point of a given point set (represented by its KdTree) from K-Nearest-Neighbours. More... | |
int | ALG3D_computeSurfaceFeaturesKNNTreeFast (const ALG3D_KDTREE tree, double *values, size_t maxPoints, SurfaceFeatureType type) |
Computes surface features for each point of a given point set (represented by its KdTree) from K-Nearest-Neighbours. More... | |
int | ALG3D_createKdTree (const ALG3D_Point3d *data, size_t numPts, ALG3D_KDTREE *tree) |
Builds a kdTree from given 3D data. More... | |
int | ALG3D_freeKdTree (ALG3D_KDTREE tree) |
Releases memory of a given kdTree object. It's up to the application to ensure that the pointer is valid. More... | |
int | ALG3D_findNearestNeighbor (const ALG3D_KDTREE tree, ALG3D_Point3d pt, double radius, ALG3D_Point3d *nn) |
Finds the nearest neighbour within a query radius to a given point and uses a given KD-Tree. More... | |
int | ALG3D_findNearestNormalCompatibleNeighbor (const ALG3D_KDTREE tree, const ALG3D_Point3d *treeNormals, ALG3D_Point3d pt, ALG3D_Point3d ptNormal, double radius, double minimumDotProduct, ALG3D_Point3d *nn) |
Finds the nearest neighbour within a query radius to a given point with a compatible normal and uses a given KD-Tree. More... | |
int | ALG3D_findKNearestNeighbors (const ALG3D_KDTREE tree, ALG3D_Point3d pt, size_t maxPoints, ALG3D_Point3d **vNN, size_t *numNN) |
Finds the k-nearest neighboring points to a given point. More... | |
int | ALG3D_findKNearestNormalCompatibleNeighbors (const ALG3D_KDTREE tree, const ALG3D_Point3d *treeNormals, ALG3D_Point3d pt, ALG3D_Point3d ptNormal, size_t maxPoints, double minimumDotProduct, ALG3D_Point3d **vNN, size_t *numNN) |
Finds the k-nearest neighboring points with compatible normal vectors to a given point. More... | |
int | ALG3D_findNeighbors (const ALG3D_KDTREE tree, ALG3D_Point3d pt, double radius, ALG3D_Point3d **vNN, size_t *numNN) |
Finds all neighboring points within a query radius to a given point using a given KD-Tree. More... | |
int | ALG3D_findNormalCompatibleNeighbors (const ALG3D_KDTREE tree, const ALG3D_Point3d *treeNormals, ALG3D_Point3d pt, ALG3D_Point3d ptNormal, double radius, double minimumDotProduct, ALG3D_Point3d **vNN, size_t *numNN) |
Finds all neighboring points within a query radius with compatible normal vectors to a given point using a given KD-Tree. More... | |
int | ALG3D_findNeighborsBox (const ALG3D_KDTREE tree, ALG3D_Point3d pt, double vDist[3], ALG3D_Point3d **vNN, size_t *numNN) |
Finds all neighbouring points within a box around a given point and uses a given KD-Tree. More... | |
int | ALG3D_computeDistances2Pointcloud (const ALG3D_KDTREE tree, const ALG3D_Point3d *pts, size_t numPts, double maxDistance, double *distances) |
Computes all distance of a point set to another point set given as a kd-tree. More... | |
int | ALG3D_computeThinningTree (ALG3D_KDTREE tree, double radius) |
Computes the homogeneous thinning of a point cloud given by a KdTree. More... | |
int | ALG3D_computeCurvatureThinning (ALG3D_Point3d *pts, size_t *numPts, double maxRadius, double minRadius) |
Computes a curvature based thinning of a 3d point set. More... | |
int | ALG3D_computeCurvatureThinningFast (ALG3D_Point3d *pts, size_t *numPts, double maxRadius, double minRadius) |
Computes a curvature based thinning of a 3d point set. More... | |
int | ALG3D_computeSmoothingTree (const ALG3D_KDTREE tree, ALG3D_Point3d *ptsOut, double radius, SmoothingMethod method) |
Computes the smoothing of point cloud given by a KD-Tree. More... | |
This module contains functions to smooth, homogenize point clouds, compute features and normal vectors.
struct ALG3D_Intersection |
Intersection between a ray and a triangle mesh.
Data Fields | ||
---|---|---|
ALG3D_Point3d | intersection | Point of intersection of the ray with the mesh. |
double | t | Distance along the ray (t parameter from ray equation: o + t*d). |
size_t | triangleIndex | Index of the intersected triangle (use ALG3D_getTrianglePoints to retrieve the corresponding triangle points) |
enum SmoothingMethod |
enum SurfaceFeatureType |
#include <algorithm.h>
Enum to select a surface feature type.
int ALG3D_computeConnectedRegions | ( | const ALG3D_Point3d * | ptsIn, |
size_t | numIn, | ||
double | radius, | ||
size_t * | regionIdx, | ||
size_t * | numIdx | ||
) |
#include <algorithm.cpp>
Computes spatially connected points and isolated regions.
ptsIn | pointer to input points |
numIn | number of input points |
radius | radius/maximum allowed distance of a point to a region in order to belong to this region |
regionIdx | pointer to a vector of indices with a pre-allocated size of numIn. For each point in ptsIn it contains the index of the region he belongs. The index of the first region is 0. |
numIdx | number of regions found |
int ALG3D_computeConnectedRegionsTree | ( | const ALG3D_KDTREE | tree, |
double | radius, | ||
size_t * | regionIdx, | ||
size_t * | numIdx | ||
) |
#include <algorithm.cpp>
Computes spatially connected points and isolated regions using a precomputed KdTree.
tree | precomputed KdTree (see ALG3D_createKdTree) |
radius | radius/maximum allowed distance of a point to a region in order to belong to this region |
regionIdx | pointer to a pre-allocated vector of indices. The number of preallocated indices must be at least the number of points from which the tree was created. For each point of the tree it contains the index of the region he belongs. The index of the first region is 0. |
numIdx | number of regions found |
int ALG3D_computeCurvatureThinning | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
double | maxRadius, | ||
double | minRadius | ||
) |
#include <algorithm.cpp>
Computes a curvature based thinning of a 3d point set.
The method successively removes points from the local neighbourhood defined by the radius. The radius is adapted to the local curvature around a points. If a points is located in a highly curved region the thinning radius is reduced and fewer points are removed. The radius is interpolated between the two parameters maxRadius
and minRadius
. In regions with no curvature maxRadius
is used. In regions with a very high curvature minRadius
is used. You can specify a value greater than 0 for minRadius to ensure that no matter how strong the curvature is, the remaining points will have at least this distance to each other.
The memory provided as input is reused but its size will not be not changed. Instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points. The elements after the new end are still dereferencable but their value is unpecified. It is in the responsibility of the calling application to reduce the used memory to the new size.
[in,out] | pts | pointer to points |
[in,out] | numPts | number of points |
[in] | maxRadius | Maximum thinning radius |
[in] | minRadius | Minimum thinning radius (use 0 as a default) |
int ALG3D_computeCurvatureThinningFast | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
double | maxRadius, | ||
double | minRadius | ||
) |
#include <algorithm.cpp>
Computes a curvature based thinning of a 3d point set.
The method successively removes points from the local neighbourhood defined by the radius. The radius is adapted to the local curvature around a points. If a points is located in a highly curved region the thinning radius is reduced and fewer points are removed. The radius is interpolated between the two parameters maxRadius
and minRadius
. In regions with no curvature maxRadius
is used. In regions with a very high curvature minRadius
is used. You can specify a value greater than 0 for minRadius to ensure that no matter how strong the curvature is, the remaining points will have at least this distance to each other.
The memory provided as input is reused but its size will not be not changed. Instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points. The elements after the new end are still dereferencable but their value is unpecified. It is in the responsibility of the calling application to reduce the used memory to the new size.
[in,out] | pts | pointer to points |
[in,out] | numPts | number of points |
[in] | maxRadius | Maximum thinning radius |
[in] | minRadius | Minimum thinning radius (use 0 as a default) |
int __cdecl ALG3D_computeDistances2Mesh | ( | const ALG3D_MESHTREE | meshTree, |
const ALG3D_Point3d * | pts, | ||
size_t | numPts, | ||
double | maxDistance, | ||
double * | distances | ||
) |
#include <algorithm.h>
Computes all signed distances of a point set to a mesh given as a kd-tree.
A maximum search distance maybe defined to exclude points from the computation that are potentially to far away (maxDistance > 0). In this case the resulting distance value in distances remains untouched. If instead all distances should be computed than the maximum search distance must be defined as zero (maxDistance = 0) and the algorithms chooses the optimal internal search parameters.
The computed distance are signed. Points inside the mesh have negative distances. The inside/outside decision is based on the normal vector of the triangle that contains the nearest neighbor to the point.
meshTree | kdTree containing the mesh |
pts | pointer to points begin |
numPts | number of points in pts |
maxDistance | maximum search distance (0=auto) |
distances | pointer to pre-allocated memory (same size as numPts) for storing the resulting distance values |
int ALG3D_computeDistances2Pointcloud | ( | const ALG3D_KDTREE | tree, |
const ALG3D_Point3d * | pts, | ||
size_t | numPts, | ||
double | maxDistance, | ||
double * | distances | ||
) |
#include <algorithm.cpp>
Computes all distance of a point set to another point set given as a kd-tree.
A maximum search distance maybe defined to exclude points from the computation that are potentially to far away (maxDistance > 0). In this case the resulting distance value in distances remains untouched. The user may initialize the distance array for example with -1 to see for which points distances have been computed and for which not. If instead all distances should be computed than the maximum search distance must be defined as zero (maxDistance = 0) and the algorithms chooses the optimal internal search parameters.
tree | KD-Tree containing the reference points |
pts | pointer to points for eich distance are computed |
numPts | number of points in pts |
maxDistance | maximum search distance (0=auto) |
distances | pointer to pre-allocated memory (same size as numPts) for storing the resulting distance values |
int ALG3D_computeNormalVectors | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
ALG3D_Point3d * | normals, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes surface normals for the given pointcloud within a neighborhood defined by a radius.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a radius. The algorithm compute a best-fit plane for the neighborhood that represents the local surface.
The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
pts | pointer to points |
numPts | number of points |
normals | pointer to pre-allocated memory (same size as points) for storing the resulting normal vector |
radius | radius of the neighborhood around each point |
int ALG3D_computeNormalVectorsFast | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
ALG3D_Point3d * | normals, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes surface normals for the given pointcloud within a neighborhood defined by a radius.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a radius. The algorithm compute a best-fit plane for the neighborhood that represents the local surface.
The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
pts | pointer to points |
numPts | number of points |
normals | pointer to pre-allocated memory (same size as points) for storing the resulting normal vector |
radius | radius of the neighborhood around each point |
int ALG3D_computeNormalVectorsKNN | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
ALG3D_Point3d * | normals, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes surface normals vector for the given pointcloud from K-Nearest-Neighbours.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a (maximal) number points that should be used. The algorithm finds the maxPoints-nearest neighbours to compute a best-fit plane that represents the local surface.
The algorithm automatically takes care for uneven point distributions and degenerated cases (e.g. if maxPoints are all lying on the same scan line). The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
pts | pointer to points |
numPts | number of points |
normals | pointer to pre-allocated memory (same size as points) for storing the resulting normal vector |
maxPoints | number of K-neighbourhood points that should be used to compute the normal (>= 3) |
int ALG3D_computeNormalVectorsKNNFast | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
ALG3D_Point3d * | normals, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes surface normals vector for the given pointcloud from K-Nearest-Neighbours.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a (maximal) number points that should be used. The algorithm finds the maxPoints-nearest neighbours to compute a best-fit plane that represents the local surface.
The algorithm automatically takes care for uneven point distributions and degenerated cases (e.g. if maxPoints are all lying on the same scan line). The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
pts | pointer to points |
numPts | number of points |
normals | pointer to pre-allocated memory (same size as points) for storing the resulting normal vector |
maxPoints | number of K-neighbourhood points that should be used to compute the normal (>= 3) |
int ALG3D_computeNormalVectorsKNNTree | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d * | normals, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes surface normals vector for the given pointcloud (represented by its KdTree) from K-Nearest-Neighbours.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a (maximal) number points that should be used. The algorithm finds the maxPoints-nearest neighbours to compute a best-fit plane that represents the local surface.
The algorithm automatically takes care for uneven point distributions and degenerated cases (e.g. if maxPoints are all lying on the same scan line). The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
tree | precomputed KdTree (see ALG3D_createKdTree) |
normals | pointer to pre-allocated memory (same size as number of points of tree ) for storing the resulting normal vector |
maxPoints | number of K-neighbourhood points that should be used to compute the normal (>= 3) |
int ALG3D_computeNormalVectorsKNNTreeFast | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d * | normals, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes surface normals vector for the given pointcloud (represented by its KdTree) from K-Nearest-Neighbours.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a (maximal) number points that should be used. The algorithm finds the maxPoints-nearest neighbours to compute a best-fit plane that represents the local surface.
The algorithm automatically takes care for uneven point distributions and degenerated cases (e.g. if maxPoints are all lying on the same scan line). The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
tree | precomputed KdTree (see ALG3D_createKdTree) |
normals | pointer to pre-allocated memory (same size as number of points of tree ) for storing the resulting normal vector |
maxPoints | number of K-neighbourhood points that should be used to compute the normal (>= 3) |
int ALG3D_computeNormalVectorsTree | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d * | normals, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes surface normals for the given pointcloud (represented by its KdTree) within a neighborhood defined by a radius.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a radius. The algorithm compute a best-fit plane for the neighborhood that represents the local surface.
The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
tree | precomputed KdTree (see ALG3D_createKdTree) |
normals | pointer to pre-allocated memory (same size as number of points of tree ) for storing the resulting normal vector |
radius | radius of the neighborhood around each point |
int ALG3D_computeNormalVectorsTreeFast | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d * | normals, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes surface normals vector for the given pointcloud (represented by its KdTree) within a neighborhood defined by a radius.
This functions implements an algorithm to efficiently compute local surface normal vectors for each given point. The size of the local neighbourhood is defined by a radius. The algorithm compute a best-fit plane for the neighborhood that represents the local surface.
The normal vector of the approximated plane is assumed to be the normal vector of the surface at this position. The sign of the normal vector is not unique (pointing inside or outside) and may be flipped using a-priori knowledge from the scanning process (e.g. depending on scanner position relative to surface).
tree | precomputed KdTree (see ALG3D_createKdTree) |
normals | pointer to pre-allocated memory (same size as number of points of tree ) for storing the resulting normal vector |
radius | radius of the neighborhood around each point |
int ALG3D_computeOutlierFactor | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
double * | values, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes the local outlier factors of the points from a point cloud.
For a more detailed explanation of the local outlier factor see LOF.
pts | pointer to points |
numPts | number of points |
values | pointer to pre-allocated memory (same size as points) for storing the resulting outlier factor values |
maxPoints | number of K-neighbourhood points that should be used to compute the local outlier factor (20 is a reasonable value) |
int ALG3D_computeOutlierFactorTree | ( | const ALG3D_KDTREE | tree, |
double * | values, | ||
size_t | maxPoints | ||
) |
#include <algorithm.cpp>
Computes the local outlier factor of the points from a point cloud (represented by its KdTree).
For a more detailed explanation of the local outlier factor see LOF.
tree | KdTree of the point cloud |
values | pointer to pre-allocated memory (same size as points) for storing the resulting outlier factor values |
maxPoints | number of K-neighbourhood points that should be used to compute the local outlier factor (20 is a reasonable value) |
int ALG3D_computeSmoothedThinning | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes a combined homogeneous thinning and smoothing of a 3d point set.
This convenience function is typically used to preprocess a point cloud. It efficiently applies a combination of a smoothing and a thinning operation to a pointcloud.
The memory provided as input is reused but its size will not be not changed. But instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points.
pts | pointer to points (input and output) |
numPts | number of points (input and output) |
radius | thinning/smoothing radius |
int ALG3D_computeSmoothing | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
ALG3D_Point3d * | ptsOut, | ||
double | radius, | ||
SmoothingMethod | method | ||
) |
#include <algorithm.cpp>
Computes an edge preserving smoothing of point cloud given by a KD-Tree.
The direction and magnitude of the point movement is limited by the amount of the local curvature and the surface normal vector of the local neighborhood.
pts | pointer to points |
numPts | number of points |
ptsOut | pre-allocated memory (same size as points in kdTree) for storing the resulting smoothed points |
radius | smoothing radius |
method | smoothing method (see SmoothingMethod) |
int ALG3D_computeSmoothingTree | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d * | ptsOut, | ||
double | radius, | ||
SmoothingMethod | method | ||
) |
#include <algorithm.cpp>
Computes the smoothing of point cloud given by a KD-Tree.
tree | KdTree |
ptsOut | pre-allocated memory (same size as points in kdTree) for storing the resulting smoothed points |
radius | smoothing radius |
method | smoothing method (see SmoothingMethod) |
int ALG3D_computeSurfaceFeatures | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
double * | values, | ||
double | radius, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set within a neighborhood defined by a radius.
pts | pointer to points |
numPts | number of points |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
radius | radius of the local neighborhood around each point to be used for the curvature estimation |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesFast | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
double * | values, | ||
double | radius, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set within a neighborhood defined by a radius.
pts | pointer to points |
numPts | number of points |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
radius | radius of the local neighborhood around each point to be used for the curvature estimation |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesKNN | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
double * | values, | ||
size_t | maxPoints, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set from K-Nearest-Neighbours.
pts | pointer to points |
numPts | number of points |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
maxPoints | number of K-neighbourhood points that should be used to compute the feature (>= 4) |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesKNNFast | ( | const ALG3D_Point3d * | pts, |
size_t | numPts, | ||
double * | values, | ||
size_t | maxPoints, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set from K-Nearest-Neighbours.
pts | pointer to points |
numPts | number of points |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
maxPoints | number of K-neighbourhood points that should be used to compute the feature (>= 4) |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesKNNTree | ( | const ALG3D_KDTREE | tree, |
double * | values, | ||
size_t | maxPoints, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set (represented by its KdTree) from K-Nearest-Neighbours.
tree | precomputed KdTree (see ALG3D_createKdTree) |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
maxPoints | number of K-neighbourhood points that should be used to compute the feature (>= 4) |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesKNNTreeFast | ( | const ALG3D_KDTREE | tree, |
double * | values, | ||
size_t | maxPoints, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set (represented by its KdTree) from K-Nearest-Neighbours.
tree | precomputed KdTree (see ALG3D_createKdTree) |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
maxPoints | number of K-neighbourhood points that should be used to compute the feature (>= 4) |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesTree | ( | const ALG3D_KDTREE | tree, |
double * | values, | ||
double | radius, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set (represented by its KdTree) within a neighborhood defined by a radius.
tree | precomputed KdTree (see ALG3D_createKdTree) |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
radius | radius of the local neighborhood around each point to be used for the curvature estimation |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeSurfaceFeaturesTreeFast | ( | const ALG3D_KDTREE | tree, |
double * | values, | ||
double | radius, | ||
SurfaceFeatureType | type | ||
) |
#include <algorithm.cpp>
Computes surface features for each point of a given point set (represented by its KdTree) within a neighborhood defined by a radius.
tree | precomputed KdTree (see ALG3D_createKdTree) |
values | pointer to pre-allocated memory (same size as points) for storing the resulting curvature values |
radius | radius of the local neighborhood around each point to be used for the curvature estimation |
type | The surface feature type that is computed for each point (see SurfaceFeatureType) |
int ALG3D_computeThinningToNeighborhood | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
double | radius | ||
) |
#include <algorithm.cpp>
Computes a homogeneous thinning of 3d point set to a given radius (neighborhood).
The method successively removes points from the local neighbourhood defined by the radius. The memory provided as input is reused but its size will not be not changed. Instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points. The elements after the new end are still dereferencable but their value is unpecified. It is in the responsibility of the calling application to reduce the used memory to the new size.
[in,out] | pts | pointer to points |
[in,out] | numPts | number of points |
[in] | radius | thinning radius |
int ALG3D_computeThinningToPointNumber | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
size_t | resultingNumPoints | ||
) |
#include <algorithm.cpp>
Computes a homogeneous thinning of 3d point set to a given number of resulting points.
The method removes points from the input until resultingNumPoints are left. It uses an algorithm which tries to preserve the spatial distribution (instead of removing every n-th point). The memory provided as input is reused but its size will not be not changed. Instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points. The elements after the new end are still dereferencable but their value is unpecified. It is in the responsibility of the calling application to reduce the used memory to the new size.
[in,out] | pts | pointer to points |
[in,out] | numPts | number of points |
[in] | resultingNumPoints | desired number of resulting points |
int ALG3D_computeThinningTree | ( | ALG3D_KDTREE | tree, |
double | radius | ||
) |
#include <algorithm.cpp>
Computes the homogeneous thinning of a point cloud given by a KdTree.
The algorithm discards all additional points within the query/thinning radius. Note: The points discarded are not deleted but marked by setting their coordinates [0..2] to 0. This behaviour will be changed in future versions.
tree | KdTree |
radius | thinning radius |
int ALG3D_createKdTree | ( | const ALG3D_Point3d * | data, |
size_t | numPts, | ||
ALG3D_KDTREE * | tree | ||
) |
#include <algorithm.cpp>
Builds a kdTree from given 3D data.
data | pointer to data begin |
numPts | number of points |
tree | address of a kdTree object |
int __cdecl ALG3D_createMesh | ( | const ALG3D_Point3d * | data, |
size_t * | indices, | ||
size_t | numTriangles, | ||
ALG3D_MESH * | mesh | ||
) |
#include <algorithm.h>
Builds a mesh from given points and indices. Three consecutive entries in the indices array define the indices of the 3 points (in the data array) of a single triangle.
data | pointer to points begin |
indices | pointer to indices begin |
numTriangles | number of triangles (the size of indices is 3 * numTriangles) |
mesh | address of a mesh object |
int __cdecl ALG3D_createMeshTree | ( | const ALG3D_MESH | mesh, |
ALG3D_MESHTREE * | meshTree | ||
) |
#include <algorithm.h>
Builds a kdTree from a mesh.
mesh | the mesh object |
meshTree | address of a kdTree object |
int ALG3D_findKNearestNeighbors | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d | pt, | ||
size_t | maxPoints, | ||
ALG3D_Point3d ** | vNN, | ||
size_t * | numNN | ||
) |
#include <algorithm.cpp>
Finds the k-nearest neighboring points to a given point.
Given an initial start radius as a hint, this function efficiently computes the exact k-nearest neighbors. But finding the k-nearest neighbors for each point of a point set can be expensive. But the speed can be significantly increased if the startRadius is iteratively adapted to the point set density. Note, that the first neighbor in the resulting array is the point which is farthest away from the query point. This distance should be used as startRadius for the next query (take care that this is not close to 0 which is the case if all k-nearest neighbors are nearly on the same point).
tree | KD-Tree |
pt | query point |
maxPoints | number of points to be returned (exactly the maxPoints nearest points are found, if there at least maxPoints inside the KD-tree) |
vNN | pointer which finally points to an array of all neighbouring points (allocated by this function). The first point in this array is the neighbor which is farthest away from pt. |
numNN | number of resulting neighbouring points (is equal to maxPoints, if there at least maxPoints inside the KD-tree) |
int ALG3D_findKNearestNormalCompatibleNeighbors | ( | const ALG3D_KDTREE | tree, |
const ALG3D_Point3d * | treeNormals, | ||
ALG3D_Point3d | pt, | ||
ALG3D_Point3d | ptNormal, | ||
size_t | maxPoints, | ||
double | minimumDotProduct, | ||
ALG3D_Point3d ** | vNN, | ||
size_t * | numNN | ||
) |
#include <algorithm.cpp>
Finds the k-nearest neighboring points with compatible normal vectors to a given point.
tree | KD-Tree |
treeNormals | Correctly aligned normals of the points of the KD-Tree |
pt | query point |
ptNormal | Correclty aligned normal of query point |
maxPoints | Number of points to be returned (exactly the maxPoints nearest points with compatible normals are found, if there at least maxPoints with compatible normals inside the KD-tree) |
minimumDotProduct | Minimum dot product between two normal vectors to consider them compatible (e.g 0.85) |
vNN | Pointer which finally points to an array of all neighbouring points (allocated by this function). The first point in this array is the neighbor which is farthest away from pt. |
numNN | Number of resulting neighbouring points (is equal to maxPoints, if there at least maxPoints with compatible normals inside the KD-tree) |
int ALG3D_findNearestNeighbor | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d | pt, | ||
double | radius, | ||
ALG3D_Point3d * | nn | ||
) |
#include <algorithm.cpp>
Finds the nearest neighbour within a query radius to a given point and uses a given KD-Tree.
tree | KD-Tree |
radius | search radius (0=auto) |
pt | query point |
nn | nearest neighbour. If there is no neighbouring point within the given radius ERR_CONDITION is returned. |
int ALG3D_findNearestNormalCompatibleNeighbor | ( | const ALG3D_KDTREE | tree, |
const ALG3D_Point3d * | treeNormals, | ||
ALG3D_Point3d | pt, | ||
ALG3D_Point3d | ptNormal, | ||
double | radius, | ||
double | minimumDotProduct, | ||
ALG3D_Point3d * | nn | ||
) |
#include <algorithm.cpp>
Finds the nearest neighbour within a query radius to a given point with a compatible normal and uses a given KD-Tree.
tree | KD-Tree |
treeNormals | Correctly aligned normals of the points of the KD-Tree |
pt | query point |
ptNormal | Correclty aligned normal of query point |
radius | search radius (0=auto) |
minimumDotProduct | Minimum dot product between two normal vectors to consider them compatible (e.g 0.85) |
nn | nearest neighbour. If there is no neighbouring point within the given radius ERR_CONDITION is returned. |
int __cdecl ALG3D_findNearestPoint2Mesh | ( | const ALG3D_MESHTREE | meshTree, |
double | radius, | ||
ALG3D_Point3d | pt, | ||
ALG3D_Point3d * | nn | ||
) |
#include <algorithm.h>
Finds the nearest neighbour within a query radius to a given point.
meshTree | kdTree of a mesh |
radius | search radius (0=auto) |
pt | query point |
nn | nearest neighbour. If there is no neighbouring point within the given radius ERR_CONDITION is returned. |
int __cdecl ALG3D_findNearestPointAndTriangle2Mesh | ( | const ALG3D_MESHTREE | meshTree, |
double | radius, | ||
ALG3D_Point3d | pt, | ||
ALG3D_Point3d * | nn, | ||
size_t * | triangleIndex | ||
) |
#include <algorithm.h>
Finds the nearest neighbour and corresponding triangle index within a query radius to a given point.
meshTree | kdTree of a mesh |
radius | search radius (0=auto) |
pt | query point |
nn | nearest neighbour. |
triangleIndex | triangle index of nearest neighbour. |
int ALG3D_findNeighbors | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d | pt, | ||
double | radius, | ||
ALG3D_Point3d ** | vNN, | ||
size_t * | numNN | ||
) |
#include <algorithm.cpp>
Finds all neighboring points within a query radius to a given point using a given KD-Tree.
tree | KD-Tree |
radius | search radius |
pt | query point |
vNN | pointer which finally points to an array of all neighbouring points (allocated by this function) |
numNN | number of resulting neighbouring points |
int ALG3D_findNeighborsBox | ( | const ALG3D_KDTREE | tree, |
ALG3D_Point3d | pt, | ||
double | vDist[3], | ||
ALG3D_Point3d ** | vNN, | ||
size_t * | numNN | ||
) |
#include <algorithm.cpp>
Finds all neighbouring points within a box around a given point and uses a given KD-Tree.
The box is defined by a canter point pt and 3 (semi)-axis lengths starting from pt. Example: for a given point pt(0,0,0) and the axial lengths vDist{2,4,8} this functions returns all points with coordinates in the range {[-2,2], [-4,4], [-8,8]).
tree | KD-Tree |
pt | query point |
vDist | 3 half-lengths of the box axis with the query point in its center |
vNN | pointer which finally points to an array of all neighbouring points (allocated by this function) |
numNN | resulting number of resulting neighbouring points |
int ALG3D_findNormalCompatibleNeighbors | ( | const ALG3D_KDTREE | tree, |
const ALG3D_Point3d * | treeNormals, | ||
ALG3D_Point3d | pt, | ||
ALG3D_Point3d | ptNormal, | ||
double | radius, | ||
double | minimumDotProduct, | ||
ALG3D_Point3d ** | vNN, | ||
size_t * | numNN | ||
) |
#include <algorithm.cpp>
Finds all neighboring points within a query radius with compatible normal vectors to a given point using a given KD-Tree.
tree | KD-Tree |
treeNormals | Correctly aligned normals of the points of the KD-Tree |
pt | Query point |
ptNormal | Correclty aligned normal of query point |
radius | Search radius |
minimumDotProduct | Minimum dot product between two normal vectors to consider them compatible (e.g 0.85) |
vNN | pointer which finally points to an array of all neighbouring points (allocated by this function) |
numNN | number of resulting neighbouring points |
int ALG3D_freeKdTree | ( | ALG3D_KDTREE | tree | ) |
#include <algorithm.cpp>
Releases memory of a given kdTree object. It's up to the application to ensure that the pointer is valid.
tree | existing KdTree object |
int __cdecl ALG3D_freeMesh | ( | ALG3D_MESH | mesh | ) |
#include <algorithm.h>
Releases memory of a given mesh object. It's up to the application to ensure that the pointer is valid.
mesh | existing mesh object |
int __cdecl ALG3D_freeMeshTree | ( | ALG3D_MESHTREE | meshTree | ) |
#include <algorithm.h>
Releases memory of a given kdTree (mesh) object. It's up to the application to ensure that the pointer is valid.
meshTree | existing kdTree (mesh) object |
int __cdecl ALG3D_getNumberOfTriangles | ( | const ALG3D_MESH | mesh, |
size_t * | numTriangles | ||
) |
#include <algorithm.h>
Retrieves the number of triangles in a mesh. This number does not need to be the same as the one used in ALG3D_createMesh, since the mesh structure is optimized during the creation (invalid triangles are removed).
mesh | address of a mesh object |
numTriangles | number of trianlges in mesh |
int __cdecl ALG3D_getTrianglePoints | ( | const ALG3D_MESH | mesh, |
size_t | triangleIndex, | ||
ALG3D_Point3d * | a, | ||
ALG3D_Point3d * | b, | ||
ALG3D_Point3d * | c | ||
) |
#include <algorithm.h>
Retrieves the 3 vertices of a triangle in a mesh. Use this function to get the triangle (points), returned as an index by the ALG3D_raytracing_* functions.
mesh | address of a mesh object |
triangleIndex | Index of the triangle |
a,b,c | Vertices of the triangle |
int __cdecl ALG3D_raytracing_allIntersections | ( | const ALG3D_MESHTREE | meshTree, |
ALG3D_Point3d | rayOrigin, | ||
ALG3D_Point3d | rayDirection, | ||
double | maxHitDistance, | ||
ALG3D_Intersection ** | intersections, | ||
size_t * | numIntersections | ||
) |
#include <algorithm.h>
Computes all intersections between a ray and a mesh.
The intersections are only detected of they are in the direction of the ray (Ray = rayOrigin + t*rayDirection, t is > 0).
[in] | meshTree | kdTree object containing the mesh |
[in] | rayOrigin | origin of the ray |
[in] | rayDirection | direction of the ray (does not have to be normalized) |
[in] | maxHitDistance | Maximum allowed distance between the ray origin and a possible intersection point (0 = no maximum). |
[out] | intersections | pointer to an array that is filled with the intersection information |
[out] | numIntersections | the number of detected intersections. |
int __cdecl ALG3D_raytracing_doesIntersect | ( | const ALG3D_MESHTREE | meshTree, |
ALG3D_Point3d | rayOrigin, | ||
ALG3D_Point3d | rayDirection, | ||
double | maxHitDistance, | ||
int * | doesIntersect | ||
) |
#include <algorithm.h>
Checks if a ray intersects with a mesh.
A possible intersection is only detected in the direction of the ray (Ray = rayOrigin + t*rayDirection, t is > 0).
[in] | meshTree | kdTree object containing the mesh |
[in] | rayOrigin | origin of the ray |
[in] | rayDirection | direction of the ray (does not have to be normalized) |
[in] | maxHitDistance | Maximum allowed distance between the ray origin and a possible intersection point (0 = no maximum). |
[out] | doesIntersect | 1 if there is an intersection, 0 otherwise |
int __cdecl ALG3D_raytracing_firstIntersection | ( | const ALG3D_MESHTREE | meshTree, |
ALG3D_Point3d | rayOrigin, | ||
ALG3D_Point3d | rayDirection, | ||
double | maxHitDistance, | ||
ALG3D_Intersection * | intersection, | ||
int * | doesIntersect | ||
) |
#include <algorithm.h>
Computes the first intersection between a ray and a mesh.
A possible intersection is only detected in the direction of the ray (Ray = rayOrigin + t*rayDirection, t is > 0).
[in] | meshTree | kdTree object containing the mesh |
[in] | rayOrigin | origin of the ray |
[in] | rayDirection | direction of the ray (does not have to be normalized) |
[in] | maxHitDistance | Maximum allowed distance between the ray origin and a possible intersection point (0 = no maximum). |
[out] | intersection | information about the intersection if there is one |
[out] | doesIntersect | 1 if there is an intersection, 0 otherwise |
int ALG3D_removeOutliers | ( | ALG3D_Point3d * | pts, |
size_t * | numPts, | ||
size_t | maxPoints, | ||
double | thresh | ||
) |
#include <algorithm.cpp>
Remove outliers from the point cloud.
This function uses the "local outlier factor" (LOF) to identify the points that should be removed from the point cloud. You have to provide a threshold to determine which points will be removed.
The memory provided as input is reused and its size will not be changed. Instead the parameter numPts returns the new number of points which is equal or smaller than the number of input points. The elements after the new end are still dereferencable but their values are unpecified. It is in the responsibility of the calling application to reduce the used memory to the new size.
pts | pointer to points |
numPts | pointer to number of points (contains the remaining number of points after the call to this function) |
maxPoints | number of K-neighbourhood points that should be used to compute the local outlier factor (20 is a reasonable value) |
thresh | threshold, points with a local outlier factor higher than this value will be removed (1.15 is a reasonable default value) |
int ALG3D_removeOutliersTree | ( | ALG3D_KDTREE | tree, |
size_t | maxPoints, | ||
double | thresh | ||
) |
#include <algorithm.cpp>
Remove outliers from the point cloud.
This function uses the "local outlier factor" (LOF) to identify the points that should be removed from the point cloud. You have to provide a threshold to determine which points will be removed.
Note: The points discarded are not deleted but marked by setting their coordinates [0..2] to 0.
tree | KdTree of the point cloud |
maxPoints | number of K-neighbourhood points that should be used to compute the local outlier factor (20 is a reasonable value) |
thresh | threshold, points with a local outlier factor higher than this value will be removed (1.15 is a reasonable default value) |
int __cdecl ALG3D_sampleMesh | ( | const ALG3D_MESH | mesh, |
size_t | numSamples, | ||
ALG3D_Point3d ** | points, | ||
size_t * | numPts | ||
) |
#include <algorithm.h>
Samples a mesh uniformly with a given number of points.
The algorithm uses a random number generator to sample the points. Therefore the number of generated points can deviate slightly from the number of requested points (e.g. 50'000 requested -> 49'981 generated). The actual number of generated points is returned through the last parameter.
[in] | mesh | mesh |
[in] | numSamples | the number of requested samples |
[out] | points | pointer which finally points to an array of the generated points |
[out] | numPts | number of generated points |
int __cdecl ALG3D_sampleMeshDensity | ( | const ALG3D_MESH | mesh, |
double | density, | ||
ALG3D_Point3d ** | points, | ||
size_t * | numPts | ||
) |
#include <algorithm.h>
Samples a mesh uniformly with a given density of points.
[in] | mesh | mesh |
[in] | density | the density (points/unit triangle area) |
[out] | points | pointer which finally points to an array of the generated points |
[out] | numPts | number of generated points |
int __cdecl ALG3D_sampleMeshDensityNormals | ( | const ALG3D_MESH | mesh, |
double | density, | ||
ALG3D_Point3d ** | points, | ||
ALG3D_Point3d ** | normals, | ||
size_t * | numPts | ||
) |
#include <algorithm.h>
Samples a mesh uniformly with a given density of points and generates normal vectors at the samples.
[in] | mesh | mesh |
[in] | density | the density (points/unit triangle area) |
[out] | points | pointer which finally points to an array of the generated points |
[out] | normals | pointer which finally points to an array of the generated normals |
[out] | numPts | number of generated points/normals |
int __cdecl ALG3D_sampleMeshNormals | ( | const ALG3D_MESH | mesh, |
size_t | numSamples, | ||
ALG3D_Point3d ** | points, | ||
ALG3D_Point3d ** | normals, | ||
size_t * | numPts | ||
) |
#include <algorithm.h>
Samples a mesh uniformly with a given number of points and generates normal vectors at the samples.
The algorithm uses a random number generator to sample the points. Therefore the number of generated points can deviate slightly from the number of requested points (e.g. 50'000 requested -> 49'981 generated). The actual number of generated points is returned through the last parameter.
[in] | mesh | mesh |
[in] | numSamples | the number of requested samples |
[out] | points | pointer which finally points to an array of the generated points |
[out] | normals | pointer which finally points to an array of the generated normals |
[out] | numPts | number of generated points/normals |
int __cdecl ALG3D_subdivideLongEdges | ( | const ALG3D_Point3d * | points, |
size_t * | indices, | ||
size_t | numTriangles, | ||
ALG3D_Point3d ** | newPoints, | ||
size_t ** | newIndices, | ||
size_t * | newNumTriangles, | ||
double | maxEdgeLength | ||
) |
#include <algorithm.h>
Subdivides all edges that are too long.
[in] | points | Pointer to the array of indexed points. |
[in] | indices | Pointer to the array of triangle indices (3 consecutive define a triangle). |
[in] | numTriangles | Number of triangles in the mesh (indices has size: 3 * numTriangles). |
[out] | newPoints | Pointer to an array of the resulting points (allocated by this function). |
[out] | newIndices | Pointer to an array of the resulting indices (3 consecutive define a triangle, allocated by this function). |
[out] | newNumTriangles | Resulting number of triangles (newIndices has size: 3 * newNumTriangles). |
[in] | maxEdgeLength | The maximum edge length. All longer edges are subdivided until they are small enough. |