OptoInspect3D Inline - alg3Dlib  3.4.0
Library for measured 3D data processing
Data Structures | Macros | Typedefs | Functions
Basic Library Interface

This module provides basic functions common to all modules. More...

Data Structures

struct  ALG3D_Point3d
 Data type for 3d points/vectors with a user-defined pointer. More...
 

Macros

#define ERR_NONE   1
 function returned normally More...
 
#define ERR_CONDITION   0
 function returned normally but some condition has not been met More...
 
#define ERR_UNKNOWN   -1
 undefined error occured More...
 
#define ERR_FCT_LOCKED   -2
 function is locked More...
 
#define ERR_NUM_POINTS   -3
 not enough points More...
 
#define ERR_FILE_IO   -4
 file i/o error occured More...
 
#define ERR_INVALID_ARG   -5
 invalid argument(s) passed to a function More...
 

Typedefs

typedef struct ALG3D_Point3d ALG3D_Point3d
 Data type for 3d points/vectors with a user-defined pointer. More...
 

Functions

double ALG3D_vectorLength (const ALG3D_Point3d *vector)
 Returns the length of a vector. More...
 
double ALG3D_vectorLengthSq (const ALG3D_Point3d *vector)
 Returns the squared length of a vector. More...
 
double ALG3D_dotProduct (const ALG3D_Point3d *vector1, const ALG3D_Point3d *vector2)
 Returns the scalar/dot product of two vectors. More...
 
ALG3D_Point3d ALG3D_crossProduct (const ALG3D_Point3d *vector1, const ALG3D_Point3d *vector2)
 Returns the cross product of two vectors. More...
 
int ALG3D_transformPoints (ALG3D_Point3d *pts, size_t numPts, const double R[9], const double T[3], const double S[1])
 Transforms points by the given tranformation. More...
 
void ALG3D_normalizeVector (ALG3D_Point3d *vector)
 Normalizes a vector so that its length is 1. If the vector equals the Null-Vector(0,0,0) it is not normalized. More...
 
double ALG3D_distancePoint2Point (const ALG3D_Point3d *pt1, const ALG3D_Point3d *pt2)
 Return the euclidean distance between two points. More...
 
double ALG3D_distancePoint2PointSq (const ALG3D_Point3d *pt1, const ALG3D_Point3d *pt2)
 Computes the squared euclidean distance between two points. More...
 
int ALG3D_checkResult (int code)
 Function that checks for error codes and prints out the result. To activate console print out use ALG3D_enableLogOutput(1). This function prints nothing if the code is ERR_NONE. More...
 
int ALG3D_getLibraryVersion (int *major, int *minor, int *revision)
 Function that returns the library's version info. More...
 
int ALG3D_getAlgorithmsVersion (int *major, int *minor, int *revision)
 Function that returns the algorithms version info. More...
 
void ALG3D_enableLogOutput (int enable)
 Enables print out of internal status information. More...
 
void ALG3D_showDongleInfo ()
 Function that prints some library information to console. More...
 
int ALG3D_freeMemory (void *data)
 Releases the memory of an array that was allocated internally. It is up to the application to assure that the pointer is valid. More...
 
int ALG3D_dongleConnected ()
 Returns if a dongle for this library is connected. More...
 
ALG3D_DLL int ALG3D_setMaxThreads (unsigned int number)
 Sets the maximum number of threads to use. More...
 
int ALG3D_readXYZ (const char *fname, ALG3D_Point3d **data, size_t *numPts)
 Reads XYZ-data from a file. More...
 
int ALG3D_writeXYZ (const char *fname, const ALG3D_Point3d *data, size_t numPts)
 Writes 3D point data to a XYZ-ASCII-file. More...
 
int ALG3D_readSTL (const char *fname, ALG3D_Point3d **data, size_t **indices, size_t *numTriangles)
 Reads STL data from file (ascii and binary). The STL file stores the points of the triangles individually. This leads to duplications. This function deletes the duplications and returns the content of the STL as an array of points and an array of indices into the point array. Three consecutive indices form a triangle. More...
 

Detailed Description

This module provides basic functions common to all modules.


Data Structure Documentation

◆ ALG3D_Point3d

struct ALG3D_Point3d

Data type for 3d points/vectors with a user-defined pointer.

The user-defined pointer may be used to store references to any additional information belonging to this point.

Examples
testKdTree.c.
Data Fields
ALG3D_USER_TYPE data pointer to additional user-defined data
double vec[3] point data, e.g. 0=x,1=y,2=z

Macro Definition Documentation

◆ ERR_CONDITION

#define ERR_CONDITION   0

#include <interface.h>

function returned normally but some condition has not been met

◆ ERR_FCT_LOCKED

#define ERR_FCT_LOCKED   -2

#include <interface.h>

function is locked

◆ ERR_FILE_IO

#define ERR_FILE_IO   -4

#include <interface.h>

file i/o error occured

◆ ERR_INVALID_ARG

#define ERR_INVALID_ARG   -5

#include <interface.h>

invalid argument(s) passed to a function

◆ ERR_NONE

#define ERR_NONE   1

#include <interface.h>

function returned normally

◆ ERR_NUM_POINTS

#define ERR_NUM_POINTS   -3

#include <interface.h>

not enough points

◆ ERR_UNKNOWN

#define ERR_UNKNOWN   -1

#include <interface.h>

undefined error occured

Typedef Documentation

◆ ALG3D_Point3d

typedef struct ALG3D_Point3d ALG3D_Point3d

#include <interface.h>

Data type for 3d points/vectors with a user-defined pointer.

The user-defined pointer may be used to store references to any additional information belonging to this point.

Function Documentation

◆ ALG3D_checkResult()

int ALG3D_checkResult ( int  code)

#include <interface.cpp>

Function that checks for error codes and prints out the result. To activate console print out use ALG3D_enableLogOutput(1). This function prints nothing if the code is ERR_NONE.

Parameters
codeerror code
Returns
0 on success and 1 otherwise.

◆ ALG3D_crossProduct()

ALG3D_Point3d ALG3D_crossProduct ( const ALG3D_Point3d vector1,
const ALG3D_Point3d vector2 
)

#include <geometry.cpp>

Returns the cross product of two vectors.

Parameters
vector1,vector2vectors/points

◆ ALG3D_distancePoint2Point()

double ALG3D_distancePoint2Point ( const ALG3D_Point3d pt1,
const ALG3D_Point3d pt2 
)

#include <geometry.cpp>

Return the euclidean distance between two points.

Parameters
pt1,pt2two points
Returns
distance

◆ ALG3D_distancePoint2PointSq()

double ALG3D_distancePoint2PointSq ( const ALG3D_Point3d pt1,
const ALG3D_Point3d pt2 
)

#include <geometry.cpp>

Computes the squared euclidean distance between two points.

Parameters
pt1,pt2two points
Returns
squared distance

◆ ALG3D_dongleConnected()

int ALG3D_dongleConnected ( )

#include <interface.cpp>

Returns if a dongle for this library is connected.

Returns
1 if a dongle for this library is connected and 0 if not.

◆ ALG3D_dotProduct()

double ALG3D_dotProduct ( const ALG3D_Point3d vector1,
const ALG3D_Point3d vector2 
)

#include <geometry.cpp>

Returns the scalar/dot product of two vectors.

Parameters
vector1,vector2vectors/points

◆ ALG3D_enableLogOutput()

void ALG3D_enableLogOutput ( int  enable)

#include <interface.cpp>

Enables print out of internal status information.

Parameters
enableflag to enable (1) or disable (0) print outputs

◆ ALG3D_freeMemory()

int ALG3D_freeMemory ( void *  data)

#include <interface.cpp>

Releases the memory of an array that was allocated internally. It is up to the application to assure that the pointer is valid.

Parameters
datapointer to array data
Returns
always ERR_NONE.

◆ ALG3D_getAlgorithmsVersion()

int ALG3D_getAlgorithmsVersion ( int *  major,
int *  minor,
int *  revision 
)

#include <interface.cpp>

Function that returns the algorithms version info.

Parameters
major,minor,revisionVersion

◆ ALG3D_getLibraryVersion()

int ALG3D_getLibraryVersion ( int *  major,
int *  minor,
int *  revision 
)

#include <interface.cpp>

Function that returns the library's version info.

Parameters
major,minor,revisionVersion

◆ ALG3D_normalizeVector()

void ALG3D_normalizeVector ( ALG3D_Point3d vector)

#include <geometry.cpp>

Normalizes a vector so that its length is 1. If the vector equals the Null-Vector(0,0,0) it is not normalized.

Parameters
vectorvector/point

◆ ALG3D_readSTL()

int ALG3D_readSTL ( const char *  fname,
ALG3D_Point3d **  data,
size_t **  indices,
size_t *  numTriangles 
)

#include <io.cpp>

Reads STL data from file (ascii and binary). The STL file stores the points of the triangles individually. This leads to duplications. This function deletes the duplications and returns the content of the STL as an array of points and an array of indices into the point array. Three consecutive indices form a triangle.

Parameters
fnamefile name
datapointer to an array for the points (will be allocated in this function)
indicespointer to an array for the indices (will be allocated in this function)
numTrianglesthe number of triangles that have been read (the size of indices is 3 * numTriangles)
Returns
ERR_NONE on success. ERR_FILE_IO if file could not be read.
Note
function allocates memory that should be released by calling ALG3D_freeMemory() (for both data and indices).

◆ ALG3D_readXYZ()

int ALG3D_readXYZ ( const char *  fname,
ALG3D_Point3d **  data,
size_t *  numPts 
)

#include <io.cpp>

Reads XYZ-data from a file.

Parameters
fnamefile name
datapointer to an array for the points (will be allocated in this function)
numPtsthe number of XYZ-data points that have been read
Returns
ERR_NONE on success. ERR_FILE_IO if the file containes errors. If possible the erroneous points are skipped and the valid points are read.
Note
function allocates memory that should be released by calling ALG3D_freeMemory().

◆ ALG3D_setMaxThreads()

ALG3D_DLL int ALG3D_setMaxThreads ( unsigned int  number)

#include <interface.cpp>

Sets the maximum number of threads to use.

In order to control the overall usage of threads by an application the number of parallel threads used by the algorithms of this library can be limited to a certain amount. Note, that is advisable to only use as many threads as you have CPU cores.

Parameters
numbermaximum number of threads to use. If number is < 1 the maximum number of threads to use is set to 1. The maximum number is limited by the maximum number of available hardware threads on your system.
Returns
always returns ERR_NONE.

◆ ALG3D_showDongleInfo()

void ALG3D_showDongleInfo ( )

#include <interface.cpp>

Function that prints some library information to console.

◆ ALG3D_transformPoints()

int ALG3D_transformPoints ( ALG3D_Point3d pts,
size_t  numPts,
const double  R[9],
const double  T[3],
const double  S[1] 
)

#include <geometry.cpp>

Transforms points by the given tranformation.

Applies the transformation to the given points: pt = S*R*p+T.

Parameters
[in,out]ptspointer to points
[in]numPtsnumber of points
[in]R,T,SRotation matrix R, Translation vector T and uniform scalinf factor S
Returns
ERR_NONE, no validity checks for the parameters are performed

◆ ALG3D_vectorLength()

double ALG3D_vectorLength ( const ALG3D_Point3d vector)

#include <geometry.cpp>

Returns the length of a vector.

Parameters
vectorvector/point
Returns
length

◆ ALG3D_vectorLengthSq()

double ALG3D_vectorLengthSq ( const ALG3D_Point3d vector)

#include <geometry.cpp>

Returns the squared length of a vector.

Parameters
vectorvector/point
Returns
squared vector length

◆ ALG3D_writeXYZ()

int ALG3D_writeXYZ ( const char *  fname,
const ALG3D_Point3d data,
size_t  numPts 
)

#include <io.cpp>

Writes 3D point data to a XYZ-ASCII-file.

Parameters
fnamefile name
datapointer to data begin
numPtsnumber of points to write
Returns
ERR_NONE on success