Artec 3D Scanning SDK  2.0
Base API

The Artec Base API includes basic type definitions that other parts of Artec 3D Scanning SDK employ: artec::sdk::base::IRef, artec::sdk::base::IImage and so on.

The base class for reference counting and memory management is artec::sdk::base::IRef. All SDK objects are inherited from this base interface. These objects should only be destroyed by calling the artec::sdk::base::IRef::release() method, not delete. The artec::sdk::base::IRef::release() method frees up memory only in the DLL where it was allocated.

The artec::sdk::base::IBlob interface (BlOb stands for "binary large object") is a container for storing large binary-data transfers. The custom-template class artec::sdk::base::TRef is a smart pointer that is destroyed automatically once it is no longer visible. We recommend using TRef when working with classes that have names starting with I (e.g., IScanner ):

using namespace artec::sdk::base;
ErrorCode ec = createBlob(&blob, size);

Error codes indicate call failure:

if( ErrorCode_OK != createImage(&image_, size.width, size.height, PixelFormat_Mono_FLOAT) )
throw std::exception("Image creation failure");

The example below illustrates how to use a custom class with reference counting and efficient memory management:

using namespace artec::sdk::base;
ErrorCode ec = createFrameMesh( &surface, points_count, triangles_count );
if( ErrorCode_OK != ec)
return ec;
TArrayPoint3F points = surface->getPoints();
TArrayIndexTriplet triangles = surface->getTriangles();
...
points[last_point].x = sett.minBound.x + j * step_.u;
points[last_point].y = sett.maxBound.y - i * step_.v;
points[last_point].z = img_data[pos];
...
triangles[last_tri].data[0] = pts_buffer[pos];
triangles[last_tri].data[1] = pts_buffer[pos+img_width];
triangles[last_tri].data[2] = pts_buffer[pos+1];