# opentl::core::cvdata::ShapeAppearance Class Reference

Class for storing the shape and appearance information of an object. More...

Inherits opentl::core::cvdata::CvData.

List of all members.

## Classes
struct | Edge
| Structure for an edge. More...
struct | EdgeReferredByFace
| Structure to hold geometric information about faces this edge is part of. More...
struct | Face
| Structure for a face. More...
struct | Material
struct | Point
struct | TexCoord
## Public Member Functions
void | deleteStoredData ()
| Delete stored shape appearance data in this class.
int | dimension ()
| Returns number of dimensions of object shape 2 = 2d, 3 = 3d.
void | getCircumCircleRadius (double &circumCircleObjectRadius, int partIdx=0)
| Calculate Radius of object mesh circumcircle.
opentl::core::cvdata::Image * | getMaterialByName (const std::string &materialName)
| Retrieve a given appearance image by name.
opentl::core::cvdata::Image * | getObjTexture () const
| Get texture of an object for a certain pose and sensor.
void | getShapeBoundingLimits (double &xsize, double &ysize, double &zsize, double &circumCircleObjectRadius, int partIdx=0)
| Calculate rectangular bounding limits of object's shape.
void | getShapeBoundingLimitsOfFace (unsigned int faceId, double &x, double &y, double &width, double &height)
opentl::core::cvdata::Skeleton * | getSkeleton () const
| Get skeleton data for articulated objects.
void | init2DContour (std::vector< math::Vector2 > &contourPoints, bool bIsClosed=true, int partIdx=-1)
| Create a 2d contour (open or closed).
void | initAppearance (std::vector< boost::shared_ptr< opentl::core::cvdata::Image > > &imageList, const std::vector< std::string > &materialNames)
| Internal function to instantiate appearance models (only reference images, no texture maps!).
void | initConnectedHalfEllipses (double rX1, double rY1, double rX2, double rY2, double height, int lineSegments=10, int partIdx=-1, math::Vector2 *offset=NULL)
| Create a object consisting of 2 2d half-ellipses and the connected by straigt lines.
void | initConnectedHalfEllipsoids (double rX1, double rY1, double rZ1, double rX2, double rY2, double rZ2, double height, int nDiv=10, int partIdx=-1, math::Vector3 *offset=NULL)
| Create a object consisting of 2 3d half-ellipsoid and the connection of the equators. The object's coordinate origin is in the center of the first ellipsoid, which forms the base.
void | initCube (float w, float h, float d, int partIdx=-1, math::Vector3 *offset=NULL)
| Create a 3d cube object. The object's coordinate origin is in the center of the cube.
void | initCylinder (double lengthDiaX, double lengthDiaY, double height, int lineSegments=64, int partIdx=-1, math::Vector3 *offset=NULL)
| Create a 3d cylinder. The object's coordinate origin is in the center of the cylinder.
void | initDeformable2DMesh (std::vector< math::Vector2 > &verticesList, std::vector< std::vector< std::size_t > > &trianglesList, bool markNonFeature=true)
| initialize 2d deformable, triangular mesh (each triangle = link)
void | initEllipse (double lengthDiagX, double lengthDiagY, int lineSegments=64, int partIdx=-1, math::Vector2 *offset=NULL)
| Create a 2d ellipse. The object's coordinate origin is in the center of the ellipse.
void | initEllipsoid (double rX, double rY, double rZ, int nDiv=10, int partIdx=-1)
| Create a 3d ellipsoid. The object's coordinate origin is in the center of the ellipsoid.
void | initMultiRect (std::vector< double > *w, std::vector< double > *h, std::vector< math::Vector2 * > *offsets=NULL, int partIdx=-1)
| Create multiple 2d rectangles (single-mesh).
void | initRectangle (float w, float h, math::Vector2 *offset=NULL, int partIdx=-1)
| Create simple 2d rectangle object. The object's coordinate origin is in the center of the rectangle.
void | initShape (std::vector< math::Vector4 * > *pointlist, std::vector< math::Vector4 * > *normlist, std::vector< std::vector< std::size_t > > *polyPointIdxList, int partIdx, bool clearData=true)
| Internal function to create the polygon tree for simple objectModels.
int | links () const
| Return number of links.
void | markNonFeatureParts (std::vector< math::Vector2 > &boundBox, int linkIdx=0)
| initialize 3d virtual world from gauss-kr��ger ploygon point vectors
virtual ShapeAppearance & | operator= (const opentl::core::cvdata::ShapeAppearance &shape)
| Assign operator.
void | setSkeleton (opentl::core::cvdata::Skeleton *skel)
| Set skeleon data for articulated objects.
| ShapeAppearance (const ShapeAppearance &value)
| Copy constructor.
| ShapeAppearance (opentl::core::cvdata::Skeleton *skel=NULL)
| Constructor.
virtual | ~ShapeAppearance ()
| Destructor.
## Public Attributes
std::vector< math::Matrix > | m_boundingLimits
| Matrix to store rectangular bounding limits of object's shape. 1. Index = partIdx 2. Index = x,y,z direction 3. Index = max or min value.
std::vector< double > | m_circumCircleObjectRadius
| Scalar radius of circumcircle 1. Index = partIdx.
std::vector< Face * > | m_faces
| Physical model structure.
std::map< std::string, Material * > | m_material
std::vector< Edge * > | m_uniqueEdges
| List of unique edges (for all articulated body parts!).
std::vector< std::vector < EdgeReferredByFace > > | m_uniqueEdgesReferredByFace
| Stores which unique edge (1. index, same es m_uniqueEdges index) is referenced by which face(s).
std::vector< Point * > | m_uniquePoints
| List of unique points.
std::size_t | mShapeId
| Unique ShapeAppearance id per instance.

## Detailed Description

Class for storing the shape and appearance information of an object.

## Constructor & Destructor Documentation

opentl::core::cvdata::ShapeAppearance::ShapeAppearance | ( | opentl::core::cvdata::Skeleton * | skel = `NULL` | ) |

Constructor.

opentl::core::cvdata::ShapeAppearance::ShapeAppearance | ( | const ShapeAppearance & | value | ) |

Copy constructor.

virtual opentl::core::cvdata::ShapeAppearance::~ShapeAppearance | ( |  | ) | `[virtual]`

Destructor.

## Member Function Documentation

void opentl::core::cvdata::ShapeAppearance::deleteStoredData | ( |  | ) |

Delete stored shape appearance data in this class.

int opentl::core::cvdata::ShapeAppearance::dimension | ( |  | ) |

Returns number of dimensions of object shape 2 = 2d, 3 = 3d.

void opentl::core::cvdata::ShapeAppearance::getCircumCircleRadius | ( | double & | circumCircleObjectRadius,
|  | int | partIdx = `0` |
| ) |  |  |

Calculate Radius of object mesh circumcircle.

Parameters:

  | circumCircleObjectRadius | Radius of object mesh circumcircle
  | partIdx | For multi-part objects: which part we are interested in

opentl::core::cvdata::Image* opentl::core::cvdata::ShapeAppearance::getMaterialByName | ( | const std::string & | materialName | ) |

Retrieve a given appearance image by name.

Parameters:

  | materialName | Name of the material

opentl::core::cvdata::Image* opentl::core::cvdata::ShapeAppearance::getObjTexture | ( |  | ) | const

Get texture of an object for a certain pose and sensor.

void opentl::core::cvdata::ShapeAppearance::getShapeBoundingLimits | ( | double & | xsize,
|  | double & | ysize,
|  | double & | zsize,
|  | double & | circumCircleObjectRadius,
|  | int | partIdx = `0` |
| ) |  |  |

Calculate rectangular bounding limits of object's shape.

Parameters:

  | x | Size in x-direction
  | y | Size in y-direction
  | z | Size in z-direction
  | circumCircleObjectRadius | Radius of object mesh circumcircle
  | partIdx | For multi-part objects: which part we are interested in

ATTENTION: This function is implemented inefficiently, it should't be used for an online update.

void opentl::core::cvdata::ShapeAppearance::getShapeBoundingLimitsOfFace | ( | unsigned int | faceId,
|  | double & | x,
|  | double & | y,
|  | double & | width,
|  | double & | height |
| ) |  |  |

opentl::core::cvdata::Skeleton* opentl::core::cvdata::ShapeAppearance::getSkeleton | ( |  | ) | const`[inline]`

Get skeleton data for articulated objects.

void opentl::core::cvdata::ShapeAppearance::init2DContour | ( | std::vector< math::Vector2 > & | contourPoints,
|  | bool | bIsClosed = `true`,
|  | int | partIdx = `-1` |
| ) |  |  |

Create a 2d contour (open or closed).

Parameters:

  | contourPoints | Vertices
  | bIsClosed | flag to specify whether the contour is closed or not
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initAppearance | ( | std::vector< boost::shared_ptr< opentl::core::cvdata::Image > > & | imageList,
|  | const std::vector< std::string > & | materialNames |
| ) |  |  |

Internal function to instantiate appearance models (only reference images, no texture maps!).

Parameters:

  | imagelist | List of images.
  | materialnames | List of corresponding names for the material.

void opentl::core::cvdata::ShapeAppearance::initConnectedHalfEllipses | ( | double | rX1,
|  | double | rY1,
|  | double | rX2,
|  | double | rY2,
|  | double | height,
|  | int | lineSegments = `10`,
|  | int | partIdx = `-1`,
|  | math::Vector2 * | offset = `NULL` |
| ) |  |  |

Create a object consisting of 2 2d half-ellipses and the connected by straigt lines.

Parameters:

  | rX1 | Half length of x-axis of first ellipse
  | rY1 | Half length of y-axis of first ellipse
  | rX2 | Half length of x-axis of second ellipse
  | rY2 | Half length of y-axis of second ellipse
  | height | Distance of the two ellipse centers
  | lineSegments | (default = 10)
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)
  | offset | offset of the origin of the shape

void opentl::core::cvdata::ShapeAppearance::initConnectedHalfEllipsoids | ( | double | rX1,
|  | double | rY1,
|  | double | rZ1,
|  | double | rX2,
|  | double | rY2,
|  | double | rZ2,
|  | double | height,
|  | int | nDiv = `10`,
|  | int | partIdx = `-1`,
|  | math::Vector3 * | offset = `NULL` |
| ) |  |  |

Create a object consisting of 2 3d half-ellipsoid and the connection of the equators. The object's coordinate origin is in the center of the first ellipsoid, which forms the base.

Parameters:

  | rX1 | Half length of x-axis of first ellipsoid
  | rY1 | Half length of y-axis of first ellipsoid
  | rZ1 | Half length of z-axis of first ellipsoid
  | rX2 | Half length of x-axis of second ellipsoid
  | rY2 | Half length of y-axis of second ellipsoid
  | rZ2 | Half length of z-axis of second ellipsoid
  | height | Distance of the two ellipsoid centers
  | nDiv | (default = 10)
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initCube | ( | float | w,
|  | float | h,
|  | float | d,
|  | int | partIdx = `-1`,
|  | math::Vector3 * | offset = `NULL` |
| ) |  |  |

Create a 3d cube object. The object's coordinate origin is in the center of the cube.

Parameters:

  | w | Width of cube
  | h | Height of cube
  | d | Depth of cube
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initCylinder | ( | double | lengthDiaX,
|  | double | lengthDiaY,
|  | double | height,
|  | int | lineSegments = `64`,
|  | int | partIdx = `-1`,
|  | math::Vector3 * | offset = `NULL` |
| ) |  |  |

Create a 3d cylinder. The object's coordinate origin is in the center of the cylinder.

Parameters:

  | lengthDiaX | Length of x-diameter
  | lengthDiaY | Length of y-diameter
  | height | Height of the cylidner
  | lineSegments | (default = 64)
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initDeformable2DMesh | ( | std::vector< math::Vector2 > & | verticesList,
|  | std::vector< std::vector< std::size_t > > & | trianglesList,
|  | bool | markNonFeature = `true` |
| ) |  |  |

initialize 2d deformable, triangular mesh (each triangle = link)

Parameters:

  | verticesList | List of triangle vertices
  | trianglesList | List of triangles (triplets of vertex indices)
  | markNonFeature | Whether to mark shared edges as "non-feature" (default = true)
  | appendMesh | Whether append the mesh to an existing one (default = false)

void opentl::core::cvdata::ShapeAppearance::initEllipse | ( | double | lengthDiagX,
|  | double | lengthDiagY,
|  | int | lineSegments = `64`,
|  | int | partIdx = `-1`,
|  | math::Vector2 * | offset = `NULL` |
| ) |  |  |

Create a 2d ellipse. The object's coordinate origin is in the center of the ellipse.

Parameters:

  | lengthDiagX | Length of x-axis diagonal
  | lengthDiagY | Length of y-axis diagonal
  | lineSegments | (default = 64)
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initEllipsoid | ( | double | rX,
|  | double | rY,
|  | double | rZ,
|  | int | nDiv = `10`,
|  | int | partIdx = `-1` |
| ) |  |  |

Create a 3d ellipsoid. The object's coordinate origin is in the center of the ellipsoid.

Parameters:

  | rX | Half length of x-axis
  | rY | Half length of y-axis
  | rZ | Half length of z-axis
  | nDiv | (default = 10)
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initMultiRect | ( | std::vector< double > * | w,
|  | std::vector< double > * | h,
|  | std::vector< math::Vector2 * > * | offsets = `NULL`,
|  | int | partIdx = `-1` |
| ) |  |  |

Create multiple 2d rectangles (single-mesh).

Parameters:

  | w | Width of rectangles
  | h | Height of rectangles
  | offsetX | offset x relative to the shape model origin
  | offsetY | offset y relative to the shape model origin
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initRectangle | ( | float | w,
|  | float | h,
|  | math::Vector2 * | offset = `NULL`,
|  | int | partIdx = `-1` |
| ) |  |  |

Create simple 2d rectangle object. The object's coordinate origin is in the center of the rectangle.

Parameters:

  | w | Width of rectangle
  | h | Height of rectangle
  | offsetX | offset x relative to the shape model origin
  | offsetY | offset y relative to the shape model origin
  | partIdx | For multi-part objects: which part number are we appending (-1 = create new shape)

void opentl::core::cvdata::ShapeAppearance::initShape | ( | std::vector< math::Vector4 * > * | pointlist,
|  | std::vector< math::Vector4 * > * | normlist,
|  | std::vector< std::vector< std::size_t > > * | polyPointIdxList,
|  | int | partIdx,
|  | bool | clearData = `true` |
| ) |  |  |

Internal function to create the polygon tree for simple objectModels.

Parameters:

  | pointlist | Vector of unique object points in homogeneous coordinates.
  | polyPointIdxList | List of point indices per polygon.

int opentl::core::cvdata::ShapeAppearance::links | ( |  | ) | const`[inline]`

Return number of links.

void opentl::core::cvdata::ShapeAppearance::markNonFeatureParts | ( | std::vector< math::Vector2 > & | boundBox,
|  | int | linkIdx = `0` |
| ) |  |  |

initialize 3d virtual world from gauss-kr��ger ploygon point vectors

Parameters:

  | a | vector of gauss-krueger-polygons

Returns:
  a vector of pairs (first is footprint index, second is number of edges for the footprint) Load ShapeAppearance from COLLADA file.

Parameters:

  | fileName | COLLADA file name
  | filePath | Path to COLLADA file (by default, the current directory is used)

Returns:
  1 = OK, -1 = ERROR Mark non-feature parts (polygons, edges, points), that can be used for rendering, but not for sampling features.

Parameters:

  | boundBox | Bounding volume in object space, where parts inside should be removed. NOTE: - Points are marked first If an edge has at least one non-feature point, it is marked as non-feature If a polygon has at least one non-feature edge, it is marked as non-feature

virtual ShapeAppearance& opentl::core::cvdata::ShapeAppearance::operator= | ( | const opentl::core::cvdata::ShapeAppearance & | shape | ) | `[virtual]`

Assign operator.

void opentl::core::cvdata::ShapeAppearance::setSkeleton | ( | opentl::core::cvdata::Skeleton * | skel | ) | `[inline]`

Set skeleon data for articulated objects.

## Member Data Documentation

std::vector<math::Matrix> opentl::core::cvdata::ShapeAppearance::m_boundingLimits

Matrix to store rectangular bounding limits of object's shape. 1. Index = partIdx 2. Index = x,y,z direction 3. Index = max or min value.

std::vector<double> opentl::core::cvdata::ShapeAppearance::m_circumCircleObjectRadius

Scalar radius of circumcircle 1. Index = partIdx.

std::vector<Face*> opentl::core::cvdata::ShapeAppearance::m_faces

Physical model structure.

std::map<std::string, Material*> opentl::core::cvdata::ShapeAppearance::m_material

hold map of material types

std::vector<Edge*> opentl::core::cvdata::ShapeAppearance::m_uniqueEdges

List of unique edges (for all articulated body parts!).

std::vector<std::vector<EdgeReferredByFace> > opentl::core::cvdata::ShapeAppearance::m_uniqueEdgesReferredByFace

Stores which unique edge (1. index, same es m_uniqueEdges index) is referenced by which face(s).

std::vector<Point*> opentl::core::cvdata::ShapeAppearance::m_uniquePoints

List of unique points.

std::size_t opentl::core::cvdata::ShapeAppearance::mShapeId

Unique ShapeAppearance id per instance.