Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SketchSpace Class Reference

Holds a collection of sketches of various types. More...

#include <SketchSpace.h>


Detailed Description

Holds a collection of sketches of various types.

All the sketches in a SketchSpace have the same dimensions (width and height). They are organized into pools, managed by SketchPool<T> instances. Each SketchSpace has a dual, called a ShapeSpace. Several standard SketchSpace/ShapeSpace pairs are built in to VisualRoutinesBehavior. The most basic is camSkS, the camera sketch space.

Definition at line 27 of file SketchSpace.h.

List of all members.

Public Member Functions

 SketchSpace (std::string const _name, ReferenceFrameType_t _refFrameType, int const init_id, size_t const _width, size_t const _height)
 ~SketchSpace ()
ShapeSpacegetDualSpace () const
void dumpSpace () const
 dumps contents of sketch space
void clear (bool clearRetained=true)
 Clears out viewable Sketches, and also retained sketches if argument is true.
unsigned int getWidth () const
 returns the width of contained images, in pixels
unsigned int getHeight () const
 returns the height of contained images, in pixels
unsigned int getNumPixels () const
 returns the number of pixels of images in this space
int getRefreshCounter () const
void bumpRefreshCounter ()
void requireIdx ()
 creates idx if needed
void requireIdx4way ()
 creates idxN, idxS, idxE, and idxW if needed
void requireIdx8way ()
 creates idxNE, idxNW, idxSE, and idxSW, plus NSEW cases via requireIdx4way(), if needed
void freeIndexes ()
 frees the idx members
void resize (const size_t new_width, const size_t new_height)
 change the size of sketches in this sketch space (discards all existing sketches)
fmat::TransformgetTmat ()
 return the ShapeSpace-to-SketchSpace coordinate transformation matrix
fmat::TransformgetTmatinv ()
 return the SketchSpace-to-ShapeSpace coordinate transformation matrix
void setTmat (const fmat::Transform &mat)
 set the ShapeSpace-to-SketchSpace coordinate transformation matrix
void setTmat (float scale=1, float tx=0, float ty=0)
 Scale and then translate shape space to sketch space coordinates.
void setTmat (const BoundingBox2D &b)
void applyTmat (fmat::Column< 3 > &vec)
 apply the ShapeSpace-to-SketchSpace coordinate transformation to a vector
void applyTmatinv (fmat::Column< 3 > &vec)
 apply the SketchSpace-to-ShapeSpace coordinate transformation to a vector

SketchPool< bool > & get_pool (const Sketch< bool > &)
 Returns the SketchPool of appropriate type for the calling Sketch.
SketchPool< uchar > & get_pool (const Sketch< uchar > &)
 Returns the SketchPool of appropriate type for the calling Sketch.
SketchPool< usint > & get_pool (const Sketch< usint > &)
 Returns the SketchPool of appropriate type for the calling Sketch.
SketchPool< uint > & get_pool (const Sketch< uint > &)
 Returns the SketchPool of appropriate type for the calling Sketch.
SketchPool< float > & get_pool (const Sketch< float > &)
 Returns the SketchPool of appropriate type for the calling Sketch.
SketchPool< yuv > & get_pool (const Sketch< yuv > &)
 Returns the SketchPool of appropriate type for the calling Sketch.

Public Attributes

std::string name
 name of this SketchSpace
int dummy
 The value assigned to out-of-bounds indices: numPixels, i.e., one beyond the last image pixel.
Pre-generated indices for different directions

Sketch< skindex > * idx
Sketch< skindex > * idxN
Sketch< skindex > * idxS
Sketch< skindex > * idxE
Sketch< skindex > * idxW
Sketch< skindex > * idxNE
Sketch< skindex > * idxNW
Sketch< skindex > * idxSE
Sketch< skindex > * idxSW

Protected Member Functions

void setIdx (Sketch< skindex > &indices, int const x, int const y, int const indexval)
 helper function to ensure indices of idx Sketches are proper
 SketchSpace (const SketchSpace &)
 never call this
SketchSpaceoperator= (const SketchSpace &)
 never call this

Private Attributes

unsigned int width
 pixels along x axis
unsigned int height
 pixels along y axis
unsigned int numPixels
 total pixels = width * height
fmat::Transform Tmat
 transformation matrix for rendering shapes
fmat::Transform Tmatinv
 inverse transformation matrix for extracting shapes
int idCounter
 Incremented with each new Sketch, to guarantee a unique ID.
int refreshCounter
 Incremented each time SketchGUI refreshes the sketch/shape list.
ShapeSpacedualSpace
 Pointer to the ShapeSpace associated with this SketchSpace.

SketchPool< boolboolPool
 Pool for one of the SketchData<T> classes.
SketchPool< ucharucharPool
 Pool for one of the SketchData<T> classes.
SketchPool< usintusintPool
 Pool for one of the SketchData<T> classes.
SketchPool< uintuintPool
 Pool for one of the SketchData<T> classes.
SketchPool< floatfloatPool
 Pool for one of the SketchData<T> classes.
SketchPool< yuvyuvPool
 Pool for one of the SketchData<T> classes.

SketchGUI interface



ViewerConnectionviewer
 Socket and port info for communication with a sketch viewer GUI.
std::string getTmatForGUI ()
 Returns a string describing the shape-to-sketch transformation matrix.
std::string getSketchListForGUI ()
 Returns a string containing a list of all the sketches and their attributes.
SketchDataRootretrieveSketch (int const id)
 Returns a pointer to the sketch with specified ID number; null if not found.

Constructor & Destructor Documentation

SketchSpace ( std::string const   _name,
ReferenceFrameType_t  _refFrameType,
int const   init_id,
size_t const   _width,
size_t const   _height 
)

Definition at line 16 of file SketchSpace.cc.

~SketchSpace (  ) 

Definition at line 106 of file SketchSpace.cc.

SketchSpace ( const SketchSpace  )  [protected]

never call this


Member Function Documentation

void applyTmat ( fmat::Column< 3 > &  vec  ) 

apply the ShapeSpace-to-SketchSpace coordinate transformation to a vector

Definition at line 152 of file SketchSpace.cc.

Referenced by PointData::extractPoints(), PointData::render(), NaughtData::render(), LocalizationParticleData::render(), EllipseData::render(), LineData::setDrawCoords(), and LineData::splitLine().

void applyTmatinv ( fmat::Column< 3 > &  vec  ) 

apply the SketchSpace-to-ShapeSpace coordinate transformation to a vector

Definition at line 156 of file SketchSpace.cc.

Referenced by LineData::houghExtractLines().

void bumpRefreshCounter (  ) 

Definition at line 91 of file SketchSpace.h.

Referenced by SketchSpace::getSketchListForGUI(), and VRmixin::~VRmixin().

void clear ( bool  clearRetained = true  ) 

Clears out viewable Sketches, and also retained sketches if argument is true.

Definition at line 123 of file SketchSpace.cc.

Referenced by VRmixin::~VRmixin().

void dumpSpace (  )  const

dumps contents of sketch space

Definition at line 114 of file SketchSpace.cc.

void freeIndexes (  ) 

frees the idx members

Definition at line 80 of file SketchSpace.cc.

Referenced by SketchSpace::resize(), SketchSpace::~SketchSpace(), and VRmixin::~VRmixin().

SketchPool<yuv>& get_pool ( const Sketch< yuv > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 135 of file SketchSpace.h.

SketchPool<float>& get_pool ( const Sketch< float > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 134 of file SketchSpace.h.

SketchPool<uint>& get_pool ( const Sketch< uint > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 133 of file SketchSpace.h.

SketchPool<usint>& get_pool ( const Sketch< usint > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 132 of file SketchSpace.h.

SketchPool<uchar>& get_pool ( const Sketch< uchar > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 131 of file SketchSpace.h.

SketchPool<bool>& get_pool ( const Sketch< bool > &   ) 

Returns the SketchPool of appropriate type for the calling Sketch.

Definition at line 130 of file SketchSpace.h.

Referenced by Sketch< T >::Sketch().

ShapeSpace& getDualSpace ( void   )  const
unsigned int getNumPixels (  )  const

returns the number of pixels of images in this space

Definition at line 88 of file SketchSpace.h.

Referenced by SketchIndices::trimBounds().

int getRefreshCounter (  )  const

Definition at line 90 of file SketchSpace.h.

Referenced by SketchPoolRoot::getRefreshCounter().

std::string getSketchListForGUI (  ) 

Returns a string containing a list of all the sketches and their attributes.

Definition at line 178 of file SketchSpace.cc.

Referenced by VRmixin::processSketchRequest().

fmat::Transform& getTmat (  ) 

return the ShapeSpace-to-SketchSpace coordinate transformation matrix

Definition at line 109 of file SketchSpace.h.

Referenced by EllipseData::render().

std::string getTmatForGUI (  ) 

Returns a string describing the shape-to-sketch transformation matrix.

Definition at line 168 of file SketchSpace.cc.

Referenced by VRmixin::processSketchRequest().

fmat::Transform& getTmatinv (  ) 

return the SketchSpace-to-ShapeSpace coordinate transformation matrix

Definition at line 112 of file SketchSpace.h.

Referenced by SketchDataRoot::indexPoint().

SketchSpace& operator= ( const SketchSpace  )  [protected]

never call this

void requireIdx (  ) 

creates idx if needed

Definition at line 31 of file SketchSpace.cc.

Referenced by VRmixin::VRmixin().

void requireIdx4way (  ) 

creates idxN, idxS, idxE, and idxW if needed

Definition at line 41 of file SketchSpace.cc.

Referenced by visops::bdist(), and SketchSpace::requireIdx8way().

void requireIdx8way (  ) 

creates idxNE, idxNW, idxSE, and idxSW, plus NSEW cases via requireIdx4way(), if needed

Definition at line 60 of file SketchSpace.cc.

void resize ( const size_t  new_width,
const size_t  new_height 
)

change the size of sketches in this sketch space (discards all existing sketches)

Definition at line 90 of file SketchSpace.cc.

SketchDataRoot * retrieveSketch ( int const   id  ) 

Returns a pointer to the sketch with specified ID number; null if not found.

Definition at line 190 of file SketchSpace.cc.

Referenced by VRmixin::processSketchRequest().

void setIdx ( Sketch< skindex > &  indices,
int const   x,
int const   y,
int const   indexval 
) [protected]

helper function to ensure indices of idx Sketches are proper

Definition at line 160 of file SketchSpace.cc.

Referenced by SketchSpace::requireIdx(), SketchSpace::requireIdx4way(), and SketchSpace::requireIdx8way().

void setTmat ( const BoundingBox2D b  ) 

Definition at line 147 of file SketchSpace.cc.

void setTmat ( float  scale = 1,
float  tx = 0,
float  ty = 0 
)

Scale and then translate shape space to sketch space coordinates.

Definition at line 142 of file SketchSpace.cc.

void setTmat ( const fmat::Transform mat  ) 

set the ShapeSpace-to-SketchSpace coordinate transformation matrix

Definition at line 132 of file SketchSpace.cc.

Referenced by SketchSpace::setTmat().


Member Data Documentation

ShapeSpace* dualSpace [private]

Pointer to the ShapeSpace associated with this SketchSpace.

Definition at line 41 of file SketchSpace.h.

Referenced by SketchSpace::getDualSpace(), SketchSpace::setTmat(), and SketchSpace::~SketchSpace().

int dummy

The value assigned to out-of-bounds indices: numPixels, i.e., one beyond the last image pixel.

Definition at line 55 of file SketchSpace.h.

Referenced by SketchSpace::resize(), SketchSpace::setIdx(), and Sketch< T >::Sketch().

int idCounter [private]

Incremented with each new Sketch, to guarantee a unique ID.

Definition at line 38 of file SketchSpace.h.

Definition at line 59 of file SketchSpace.h.

Referenced by SketchSpace::freeIndexes(), and SketchSpace::requireIdx().

std::string name

name of this SketchSpace

Definition at line 29 of file SketchSpace.h.

Referenced by SketchPoolRoot::getSpaceName().

unsigned int numPixels [private]

total pixels = width * height

Definition at line 34 of file SketchSpace.h.

Referenced by SketchSpace::getNumPixels(), and SketchSpace::resize().

int refreshCounter [private]

Incremented each time SketchGUI refreshes the sketch/shape list.

Definition at line 39 of file SketchSpace.h.

Referenced by SketchSpace::bumpRefreshCounter(), and SketchSpace::getRefreshCounter().

fmat::Transform Tmat [private]

transformation matrix for rendering shapes

Definition at line 35 of file SketchSpace.h.

Referenced by SketchSpace::applyTmat(), SketchSpace::getTmat(), SketchSpace::getTmatForGUI(), and SketchSpace::setTmat().

inverse transformation matrix for extracting shapes

Definition at line 36 of file SketchSpace.h.

Referenced by SketchSpace::applyTmatinv(), SketchSpace::getTmatinv(), and SketchSpace::setTmat().

Socket and port info for communication with a sketch viewer GUI.

Definition at line 143 of file SketchSpace.h.

Referenced by VRmixin::encodeSketch(), VRmixin::processSketchRequest(), VRmixin::VRmixin(), and SketchSpace::~SketchSpace().


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

DualCoding 5.1CVS
Generated Mon May 9 04:56:31 2016 by Doxygen 1.6.3