DAVID4 SDK  1.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
david::IShapeFusion Class Referenceabstract

Interface class for 'Shape Fusion'. More...

#include <IShapeFusion.h>

Inheritance diagram for david::IShapeFusion:
david::ShapeFusionD4Lib david::ShapeFusionJsonRpc

Public Member Functions

Construction, import, export, deconstruction
virtual ~IShapeFusion ()
 Destructor.
 
virtual void ExportMesh (int meshID, const std::string &filename)=0
 Exports the selected mesh. More...
 
virtual int ImportMesh (const std::string &filename)=0
 Imports a mesh into the mesh list from a file given by 'filename'. More...
 
virtual int NewMesh ()=0
 Create a new empty mesh. More...
 
virtual int DuplicateMesh (int sourceMeshID)=0
 Duplicate mesh with mesh ID 'sourceMeshID'. More...
 
virtual void DeleteAllMeshes ()=0
 Deletes all meshes in the mesh list.
 
virtual void DeleteMesh (int meshID)=0
 Deletes a specific mesh of the mesh list. More...
 
High level access to vertices and triangles
Note
These functions treat a mesh group with submeshes as single mesh to the user.
virtual void GetVertexPositions (std::vector< float > &positions, int meshID, enum CoordinateSystem coordinateSystem=WorldCoordinates)=0
 Gets the vertex positions of a specific mesh. More...
 
virtual void GetVertexQualities (std::vector< float > &qualities, int meshID)=0
 Gets the vertex qualities [0..1] of a specific mesh. More...
 
virtual void GetVertexNormals (std::vector< float > &normals, int meshID, enum CoordinateSystem coordinateSystem=WorldCoordinates)=0
 Gets the vertex normals of a specific mesh. More...
 
virtual void GetVertexTexCoords (std::vector< float > &texCoords, int meshID)=0
 Gets the vertex texture coordinates (u,v) of a specific mesh. More...
 
virtual void GetTriangles (std::vector< int > &triangles, int meshID)=0
 Gets the triangles of a specific mesh as an indexed face set. More...
 
Access to texture data
virtual void GetTextureImageData (void *data, size_t dataSizeInBytes, int meshID, int submeshIndex=0)=0
 Get the texture image of a mesh as binary data. More...
 
virtual bool GetTextureImageFormat (int &width, int &height, enum PixelFormat &pixelFormat, int meshID, int submeshIndex=0)=0
 Get the format of the texture image. More...
 
virtual void SetTexture (const void *data, size_t dataSizeInBytes, int width, int height, enum PixelFormat pixelFormat, int meshID, int submeshIndex=0)=0
 Set texture of a mesh. More...
 
Object pose and transformations
virtual void GetPose (double world_T_local[16], int meshID)=0
 Get the position and orientation of a mesh as a homogeneous transformation matrix. More...
 
virtual void SetPose (const double world_T_local[16], int meshID)=0
 Set the position and orientation of a mesh as a homogeneous transformation matrix. More...
 
virtual void Rotate (int meshID, enum TransformType transformType, double degrees)=0
 Rotate a mesh around specified axis by given degrees. More...
 
virtual void Translate (int meshID, enum TransformType transformType, double amount)=0
 Translate a mesh along specified axis by given amount. More...
 
Filters
virtual void ReduceMeshDensity (int meshID, float factor)=0
 Reduce the density of a mesh. More...
 
virtual void RemoveVerticesByVirtualCamMask (const std::vector< bool > &mask, int width, int height, double f, const double world_T_cam[16])=0
 Remove any vertex i that when projected into a virtual camera view has a mask value of 'mask[i]==true'. More...
 
virtual void RemoveSelectedVertices (const std::vector< SubmeshVertexIndex > &selectedVertices, int meshID)=0
 Remove selected vertices. More...
 
virtual void InvertTriangleOrientation (int meshID)=0
 Invert orientation of all triangles in given mesh. More...
 
Alignment
virtual double AlignPairCoarse (int meshID1, int meshID2, const CoarseAlignParams &params)=0
 Coarse alignment of mesh '1' to another mesh '2'. More...
 
virtual void AlignPairFine (int meshID1, int meshID2, const FineAlignParams &params)=0
 Fine alignment of mesh '1' to another mesh '2'. More...
 
virtual void AlignGlobalFine (const GlobalFineAlignParams &params)=0
 Global fine alignment of all meshes. More...
 
Fusion
virtual int Fuse (int resolution, float holeSizeThresRel=1.f, int sharpness=1)=0
 Fuse all visible meshes of the mesh list. More...
 
virtual int GetFuseResolution (double metricResolution, int maxResolution)=0
 Converts a metric resolution value into a resolution value required by Fuse. More...
 
Combine and uncombine of meshes

Multiple meshes can be combined into one mesh group.

A mesh within a mesh group is called submesh. Normally, a mesh has one submesh.

virtual int CombineMeshes (const std::vector< int > &meshIDs)=0
 Combines several meshes into one group. More...
 
virtual std::vector< int > UncombineMeshes (int meshIDgroup)=0
 Uncombines a group of meshes into separate meshes. More...
 
virtual int GetSubmeshCount (int meshID)=0
 Get the number of submeshes (combined meshes) in 'mesh'. More...
 
virtual void SetSubmeshCount (int count, int meshID)=0
 Set the number of submeshes (combined meshes) in 'mesh'. More...
 
Direct access to submesh data
virtual void GetSubmeshBuffer (void *data, size_t size, enum SubmeshBufferType bufferType, int meshID, int submeshIndex)=0
 Copy requested buffer ('bufferType') content into 'data'. More...
 
virtual void SetSubmeshBuffer (const void *data, size_t size, enum SubmeshBufferType bufferType, int meshID, int submeshIndex)=0
 Copy 'data' into the desired buffer ('bufferType'). More...
 
virtual bool HasSubmeshBuffer (enum SubmeshBufferType bufferType, int meshID, int submeshIndex)=0
 Is the buffer 'bufferType' available? See SubmeshBufferType for information about which buffers are optional. More...
 
virtual size_t GetSubmeshBufferSize (enum SubmeshBufferType bufferType, int meshID, int submeshIndex)=0
 Get size of buffer 'bufferType' in bytes. More...
 
virtual int GetSubmeshVertexCount (int meshID, int submeshIndex)=0
 Get the number of vertices in submesh. More...
 
virtual void SetSubmeshVertexCount (int vertexCount, int meshID, int submeshIndex)=0
 Set the number of vertices in submesh. More...
 
virtual int GetSubmeshTriangleCount (int meshID, int submeshIndex)=0
 Get the number of triangles in submesh. More...
 
virtual void SetSubmeshTriangleCount (int triangleCount, int meshID, int submeshIndex)=0
 Set the number of triangles in submesh. More...
 

Detailed Description

Interface class for 'Shape Fusion'.

Example:

/// @example SimpleShapeFusion.cpp
///
/// Shows usage of david::ShapeFusion class.
#include "davidSDK/david.h"
namespace examples {
/// Shows usage of david::ShapeFusion class.
///
{
try
{
// INITIALIZE, CONNECT TO SERVER:
david.Connect();
// IMPORT SOME SCANS:
// File paths are relative to SERVER application folder:
int id1 = david.fusion().ImportMesh("Scan01.obj");
int id2 = david.fusion().ImportMesh("Scan02.obj");
int id3 = david.fusion().ImportMesh("Scan03.obj");
// Best to use absolute paths like "C:/Scans/Scan01.obj".
// ALIGN SCAN 2 to SCAN 1, then SCAN 3 to SCAN 2:
david.fusion().AlignPairCoarse(id2, id1, david::CoarseAlignParams(david::GetMotionInfo_Free())); // first, coarse alignment (free)
david.fusion().AlignPairFine(id2, id1, david::FineAlignParams()); // then fine alignment
david.fusion().AlignPairCoarse(id3, id2, david::CoarseAlignParams(david::GetMotionInfo_Free())); // first, coarse alignment (free)
david.fusion().AlignPairFine(id3, id2, david::FineAlignParams()); // then fine alignment
// FUSE ALL SCANS:
int fusionMeshID = david.fusion().Fuse(500);
// EXPORT FUSION RESULT:
david.fusion().ExportMesh(fusionMeshID, "FusionResult.obj");
}
catch (david::Exception& e)
{
e.PrintError();
}
}
} // namespace

Definition at line 229 of file IShapeFusion.h.

Member Function Documentation

virtual void david::IShapeFusion::AlignGlobalFine ( const GlobalFineAlignParams params)
pure virtual

Global fine alignment of all meshes.

Parameters
[in]paramsAlignment parameter set. See GlobalFineAlignParams.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual double david::IShapeFusion::AlignPairCoarse ( int  meshID1,
int  meshID2,
const CoarseAlignParams params 
)
pure virtual

Coarse alignment of mesh '1' to another mesh '2'.

Parameters
[in]meshID1ID of the mesh that is to be aligned.
[in]meshID2ID of the other mesh.
[in]paramsAlignment parameter set. See CoarseAlignParams.
Returns
Quality of Alignment result in range [0,1]=[bad,good].
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_AlignFailed(david::FunctionException) Alignment could not find a solution.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleMeshComparison.cpp, and SimpleShapeFusion.cpp.
virtual void david::IShapeFusion::AlignPairFine ( int  meshID1,
int  meshID2,
const FineAlignParams params 
)
pure virtual

Fine alignment of mesh '1' to another mesh '2'.

Parameters
[in]meshID1ID of the mesh that is to be aligned.
[in]meshID2ID of the other mesh.
[in]paramsAlignment parameter set. See FineAlignParams.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_AlignFailed(david::FunctionException) Alignment could not find a solution.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleMeshComparison.cpp, and SimpleShapeFusion.cpp.
virtual int david::IShapeFusion::CombineMeshes ( const std::vector< int > &  meshIDs)
pure virtual

Combines several meshes into one group.

Parameters
[in]meshIDsList of the IDs of the meshes to be combined.
Returns
Mesh ID of the combined mesh.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::DeleteMesh ( int  meshID)
pure virtual

Deletes a specific mesh of the mesh list.

Parameters
[in]meshIDID of the mesh to be deleted.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleMeshComparison.cpp.
virtual int david::IShapeFusion::DuplicateMesh ( int  sourceMeshID)
pure virtual

Duplicate mesh with mesh ID 'sourceMeshID'.

Parameters
[in]sourceMeshIDID of the mesh to be duplicated.
Returns
ID of newly created mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::ExportMesh ( int  meshID,
const std::string &  filename 
)
pure virtual

Exports the selected mesh.

See documentation of DAVID software for supported file formats.

Warning
File paths like "c:\\meshes\\myobject.obj" are interpreted as files located on the server. For files located on the client you have to use a shared network path like "\\\\mycomputer\\meshes\\myobject.obj".
Parameters
[in]meshIDID of the mesh.
[in]filenameFilename of the mesh to be exported.
Exceptions
david::Error_NoAccess(david::FunctionException) No access to path.
david::Error_InvalidPath(david::FunctionException) Specified path is invalid.
david::Error_MissingFilename(david::FunctionException) Specified path misses file name.
david::Error_DirectoryNotFound(david::FunctionException) Specified directory does not exist.
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleShapeFusion.cpp, and SimpleTurntable.cpp.
virtual int david::IShapeFusion::Fuse ( int  resolution,
float  holeSizeThresRel = 1.f,
int  sharpness = 1 
)
pure virtual

Fuse all visible meshes of the mesh list.

Parameters
[in]resolutionLimits the maximum resolution and thus the required memory usage.
holeSizeThresRelHoles, which have a smaller area than holeSizeThresRel * size of original data surface, will be closed. 0 = open all holes. 1 = close all holes.
[in]sharpnessFusion sharpness in [-3,+5]. Negative values for smoothing. Default is 1.
Returns
Mesh ID of the fusion result.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleShapeFusion.cpp, and SimpleTurntable.cpp.
virtual int david::IShapeFusion::GetFuseResolution ( double  metricResolution,
int  maxResolution 
)
pure virtual

Converts a metric resolution value into a resolution value required by Fuse.

It uses the maximum bounding box length of all meshes to be fused.

Parameters
[in]metricResolutionSmallest possible element size in units (e.g. 0.1 [mm]).
[in]maxResolutionReturned value is bounded by this value (e.g. 2000).
Returns
Resolution value that can be used in Fuse.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetPose ( double  world_T_local[16],
int  meshID 
)
pure virtual

Get the position and orientation of a mesh as a homogeneous transformation matrix.

Parameters
[out]world_T_localValid pointer to an array of 16 doubles representing a homogeneous transformation matrix that transforms local coordinates into world coordinates: p_world = world_T_local * p_local. Values will be stored in the following order: nx, ny, nz, 0, ox, oy, oz, 0, ax, ay, az, 0, px, py, pz, 1.
[in]meshIDID of the mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetSubmeshBuffer ( void *  data,
size_t  size,
enum SubmeshBufferType  bufferType,
int  meshID,
int  submeshIndex 
)
pure virtual

Copy requested buffer ('bufferType') content into 'data'.

You can use GetSubmeshVertexCount, GetSubmeshTriangleCount, and GetSubmeshBufferSize to compute the correct size of 'data'. Coordinates are given with respect to local coordinate system.

Parameters
[out]dataValid pointer to data buffer.
[in]sizeSize of 'data' buffer in bytes.
[in]bufferTypeDesired data buffer, see SubmeshBufferType.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual size_t david::IShapeFusion::GetSubmeshBufferSize ( enum SubmeshBufferType  bufferType,
int  meshID,
int  submeshIndex 
)
pure virtual

Get size of buffer 'bufferType' in bytes.

Parameters
[in]bufferTypeDesired data buffer, see SubmeshBufferType.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Returns
Size of the buffer in bytes. It will be set to zero if buffer is not available.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual int david::IShapeFusion::GetSubmeshCount ( int  meshID)
pure virtual

Get the number of submeshes (combined meshes) in 'mesh'.

A mesh has at least one submesh. This is also the standard case unless CombineMeshes was used.

Parameters
[in]meshIDValid mesh ID.
Returns
Number of submeshes (combined) meshes.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual int david::IShapeFusion::GetSubmeshTriangleCount ( int  meshID,
int  submeshIndex 
)
pure virtual

Get the number of triangles in submesh.

Parameters
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Returns
Number of triangles in submesh.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual int david::IShapeFusion::GetSubmeshVertexCount ( int  meshID,
int  submeshIndex 
)
pure virtual

Get the number of vertices in submesh.

Parameters
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Returns
Number of vertices in submesh.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetTextureImageData ( void *  data,
size_t  dataSizeInBytes,
int  meshID,
int  submeshIndex = 0 
)
pure virtual

Get the texture image of a mesh as binary data.

Each pixel is represented according to the pixel format in GetTextureImageFormat. The pixels are ordered row by row, from top to bottom, each row from left to right.

Usage example for pixelFormat == david::RGB24:

// Import a mesh:
int meshID = david.fusion().ImportMesh("C:\\Scans\\someScan.obj"); // Import mesh (should have a texture)
// Get texture format:
int width, height;
david::PixelFormat pixelFormat;
bool hasTexture = david.fusion().GetTextureImageFormat(width, height, pixelFormat, meshID);
if (!hasTexture || pixelFormat != david::RGB24) return;
// Get texture data:
std::vector<unsigned char> imgData(david::GetImageSize(width, height, pixelFormat));
david.fusion().GetTextureImageData(imgData.data(), imgData.size(), meshID); // Retrieve texture image
printf("Texture size is %i*%i\n", width, height);
// Print some example pixel colors in the middle:
int x=width/2, y=height/2;
unsigned char* myPixel = &imgData[(y*width+x)*3];
unsigned char blue = myPixel[0];
unsigned char green = myPixel[1];
unsigned char red = myPixel[2];
printf("Pixel XY(%i,%i) has color BGR(%u,%u,%u)\n", x,y, blue,green,red);
Parameters
[out]dataValid pointer to an array that will be filled with the pixel data.
[in]dataSizeInBytesSize of 'data' in bytes. Has to be in compliance with GetTextureImageFormat.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
[in]meshIDID of the mesh.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual bool david::IShapeFusion::GetTextureImageFormat ( int &  width,
int &  height,
enum PixelFormat pixelFormat,
int  meshID,
int  submeshIndex = 0 
)
pure virtual

Get the format of the texture image.

Parameters
[out]widthWidth of the image in [px]
[out]heightHeight of the image in [px]
[out]pixelFormatSee PixelFormat. Will be david::UnknownPixelFormat, if no texture is set.
[in]meshIDID of the mesh.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Returns
True, if texture is available. False, if no texture is available.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetTriangles ( std::vector< int > &  triangles,
int  meshID 
)
pure virtual

Gets the triangles of a specific mesh as an indexed face set.

Each triangle is defined by a triple of vertex indices (a,b,c).

Parameters
[out]trianglesFor each triangle int triples are written to this array. (a1,b1,c1,...,an,bn,cn).
[in]meshIDID of the mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InconsistentBuffer(david::FunctionException) Buffer size differs from expected buffer size.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetVertexNormals ( std::vector< float > &  normals,
int  meshID,
enum CoordinateSystem  coordinateSystem = WorldCoordinates 
)
pure virtual

Gets the vertex normals of a specific mesh.

Parameters
[out]normalsFor each vertex float triples are written to this array. (x1,y1,z1,...,xn,yn,zn).
[in]meshIDID of the mesh.
[in]coordinateSystem'normals' should be relative to which coordinate system? See CoordinateSystem.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InconsistentBuffer(david::FunctionException) Buffer size differs from expected buffer size.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetVertexPositions ( std::vector< float > &  positions,
int  meshID,
enum CoordinateSystem  coordinateSystem = WorldCoordinates 
)
pure virtual

Gets the vertex positions of a specific mesh.

Parameters
[out]positionsFor each vertex float triples are written to this array. (x1,y1,z1,...,xn,yn,zn).
[in]meshIDID of the mesh.
[in]coordinateSystem'positions' should be relative to which coordinate system? See CoordinateSystem.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InconsistentBuffer(david::FunctionException) Buffer size differs from expected buffer size.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetVertexQualities ( std::vector< float > &  qualities,
int  meshID 
)
pure virtual

Gets the vertex qualities [0..1] of a specific mesh.

Vertex qualities are not always available. At this time, only a Fusion result has vertex qualities.

Parameters
[out]qualitiesFor each vertex, a float value [0..1] is written to this array
[in]meshIDID of the mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_MissingObject(david::FunctionException) Mesh does not have vertex qualities.
david::Error_InconsistentBuffer(david::FunctionException) Buffer size differs from expected buffer size.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::GetVertexTexCoords ( std::vector< float > &  texCoords,
int  meshID 
)
pure virtual

Gets the vertex texture coordinates (u,v) of a specific mesh.

All texture coords are in [0,1].

Parameters
[out]texCoordsFor each vertex, a pair of floats is written to this array. (u1,v1, u2,v2, ..., un,vn).
[in]meshIDID of the mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InconsistentBuffer(david::FunctionException) Buffer size differs from expected buffer size.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual bool david::IShapeFusion::HasSubmeshBuffer ( enum SubmeshBufferType  bufferType,
int  meshID,
int  submeshIndex 
)
pure virtual

Is the buffer 'bufferType' available? See SubmeshBufferType for information about which buffers are optional.

Parameters
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Returns
True, if submesh has a buffer of type 'bufferType'. False otherwise.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual int david::IShapeFusion::ImportMesh ( const std::string &  filename)
pure virtual

Imports a mesh into the mesh list from a file given by 'filename'.

See documentation of DAVID software for supported file formats.

Warning
File paths like "c:\\meshes\\myobject.obj" are interpreted as files located on the server. For files located on the client you have to use a shared network path like "\\\\mycomputer\\meshes\\myobject.obj".
Parameters
[in]filenameFilename of the mesh to be imported.
Returns
ID of the imported mesh.
Exceptions
david::Error_NoAccess(david::FunctionException) No access to path.
david::Error_InvalidPath(david::FunctionException) Specified path is invalid.
david::Error_MissingFilename(david::FunctionException) Specified path misses file name.
david::Error_DirectoryNotFound(david::FunctionException) Specified directory does not exist.
david::Error_FileNotFound(david::FunctionException) Specified file does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleMeshComparison.cpp, and SimpleShapeFusion.cpp.
virtual void david::IShapeFusion::InvertTriangleOrientation ( int  meshID)
pure virtual

Invert orientation of all triangles in given mesh.

Parameters
[in]meshIDID of mesh to be transformed.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionJsonRpc, and david::ShapeFusionD4Lib.

virtual int david::IShapeFusion::NewMesh ( )
pure virtual

Create a new empty mesh.

Returns
ID of the created mesh.

Implemented in david::ShapeFusionJsonRpc, and david::ShapeFusionD4Lib.

virtual void david::IShapeFusion::ReduceMeshDensity ( int  meshID,
float  factor 
)
pure virtual

Reduce the density of a mesh.

Parameters
[in]meshIDID of mesh to be transformed.
[in]factorFactor of reduction, between 0 and 1.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InvalidArgument(david::FunctionException) Invalid factor value.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::RemoveSelectedVertices ( const std::vector< SubmeshVertexIndex > &  selectedVertices,
int  meshID 
)
pure virtual

Remove selected vertices.

Parameters
[in]selectedVerticesIndex array of selected vertices.
[in]meshIDID of mesh that 'selectedVertices' references.
Exceptions
david::Error_InvalidArgument(david::FunctionException) At least one of the arguments is invalid.

Implemented in david::ShapeFusionJsonRpc, and david::ShapeFusionD4Lib.

virtual void david::IShapeFusion::RemoveVerticesByVirtualCamMask ( const std::vector< bool > &  mask,
int  width,
int  height,
double  f,
const double  world_T_cam[16] 
)
pure virtual

Remove any vertex i that when projected into a virtual camera view has a mask value of 'mask[i]==true'.

Vertices outside view or with a mask value fo 'mask[i]==false' are not removed. If a vertex is removed, its referenced triangles are also removed. The virtual camera is described by a perspective camera model:

  • Central z axis goes through center of image –> Center is at (width/2, height/2).
  • Image plane has a size in x-direction of 'width and a size of 'height' in y-direction.
  • x-axis is from left to right and y-axis from top to down (with respect to image).
  • Camera looks along the positive z-axis.
  • Visible points are on positive side of z-axis.
  • Focal length is given by 'f'.
  • Pose of the camera with respect to world coordinates is given by 'world_T_cam'.
Parameters
[in]maskValid pointer to an boolean array of size 'width*height'. True: Vertex should be removed. False: Keep vertex.
[in]widthWidth of the mask image [pixel]. Has to be > 0.
[in]heightHeight of the mask image [pixel]. Has to be > 0.
[in]fFocal length (distance of image plane to origin camera coordinate system).
[in]world_T_camPosition and orientation (pose) of the camera with respect to world coordinates. The pose is represented as a homogenenous transformation matrix. See d4mesh_getPose for more information.
Exceptions
david::Error_InvalidArgument(david::FunctionException) At least one of the arguments is invalid.

Implemented in david::ShapeFusionJsonRpc, and david::ShapeFusionD4Lib.

virtual void david::IShapeFusion::Rotate ( int  meshID,
enum TransformType  transformType,
double  degrees 
)
pure virtual

Rotate a mesh around specified axis by given degrees.

Parameters
[in]meshIDID of mesh to be transformed.
[in]transformTypeType of transform. See david::TransformType.
[in]degreesAmount of rotation in degrees.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InvalidArgument(david::FunctionException) Invalid transform type.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

Examples:
SimpleTurntable.cpp.
virtual void david::IShapeFusion::SetPose ( const double  world_T_local[16],
int  meshID 
)
pure virtual

Set the position and orientation of a mesh as a homogeneous transformation matrix.

Parameters
[out]world_T_localValid pointer to an array of 16 doubles representing a homogeneous transformation matrix that transforms local coordinates into world coordinates: p_world = world_T_local * p_local. Values will be stored in the following order: nx, ny, nz, 0, ox, oy, oz, 0, ax, ay, az, 0, px, py, pz, 1.
[in]meshIDID of the mesh.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::SetSubmeshBuffer ( const void *  data,
size_t  size,
enum SubmeshBufferType  bufferType,
int  meshID,
int  submeshIndex 
)
pure virtual

Copy 'data' into the desired buffer ('bufferType').

You can use GetSubmeshVertexCount, GetSubmeshTriangleCount, and GetSubmeshBufferSize to compute the correct size of 'data'. Coordinates have to be given with respect to local coordinate system.

Parameters
[in]dataValid pointer to data buffer.
[in]sizeSize of 'data' buffer in bytes.
[in]bufferTypeDesired data buffer, see d4mesh_BufferType.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::SetSubmeshCount ( int  count,
int  meshID 
)
pure virtual

Set the number of submeshes (combined meshes) in 'mesh'.

A mesh has at least one submesh. This is also the standard case unless CombineMeshes was used.

Parameters
[in]countNew number of submeshes (>0).
[in]meshIDValid mesh ID.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::SetSubmeshTriangleCount ( int  triangleCount,
int  meshID,
int  submeshIndex 
)
pure virtual

Set the number of triangles in submesh.

Parameters
[in]triangleCountNew number of triangles in submesh.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.
Exceptions
david::Error_InvalidArgument(david::FunctionException)

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::SetSubmeshVertexCount ( int  vertexCount,
int  meshID,
int  submeshIndex 
)
pure virtual

Set the number of vertices in submesh.

Parameters
[in]vertexCountNew number of vertices in submesh. Old data remains in buffers, if 'vertexCount' increases.
[in]meshIDValid mesh ID.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::SetTexture ( const void *  data,
size_t  dataSizeInBytes,
int  width,
int  height,
enum PixelFormat  pixelFormat,
int  meshID,
int  submeshIndex = 0 
)
pure virtual

Set texture of a mesh.

Parameters
[in]dataValid pointer to an array of pixel data.
[in]dataSizeInBytesSize of 'data' in bytes. Has to be in compliance with given texture format.
[in]widthWidth of the image in [px]
[in]heightHeight of the image in [px]
[in]pixelFormatSee PixelFormat. Will be david::UnknownPixelFormat, if no texture is set.
[in]meshIDID of the mesh.
[in]submeshIndexZero based index to a submesh of 'mesh'. Also see GetSubmeshCount.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual void david::IShapeFusion::Translate ( int  meshID,
enum TransformType  transformType,
double  amount 
)
pure virtual

Translate a mesh along specified axis by given amount.

Parameters
[in]meshIDID of mesh to be transformed.
[in]transformTypeType of transform. See david::TransformType.
[in]amountAmount of translation. Typically in mm.
Exceptions
david::Error_InvalidMeshId(david::FunctionException) Specified meshID does not exist.
david::Error_InvalidArgument(david::FunctionException) Invalid transform type.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.

virtual std::vector<int> david::IShapeFusion::UncombineMeshes ( int  meshIDgroup)
pure virtual

Uncombines a group of meshes into separate meshes.

Parameters
[in]meshIDgroupMesh ID of the mesh group to be separated.
Returns
List of the IDs of the separated meshes.

Implemented in david::ShapeFusionD4Lib, and david::ShapeFusionJsonRpc.


The documentation for this class was generated from the following file: