latest version v1.9 - last update 10 Apr 2010 |
Tool for creating three dimensional scenes. More...
#include <ltiScene3D.h>
Public Member Functions | |
scene3D () | |
scene3D (const scene3D &other) | |
virtual | ~scene3D () |
virtual const char * | getTypeName () const |
scene3D & | copy (const scene3D &other) |
scene3D & | operator= (const scene3D &other) |
void | setColor (const T &px) |
void | setStyle (const char *style) |
void | set3D (const dpoint3D &p) |
void | set2D (const int &x, const int &y, const double &z) |
void | marker3D (const double &x, const double &y, const double &z, char *marker) |
void | marker3D (const double &x, const double &y, const double &z) |
void | set3D (const double &x, const double &y, const double &z) |
template<class U > | |
void | set3D (const hPoint3D< U > &p) |
void | line3DTo (const double &x, const double &y, const double &z) |
void | line3DTo (const dpoint3D &p) |
void | line3D (const dpoint3D &a, const dpoint3D &b) |
void | line3D (const double &x, const double &y, const double &z, const double &x2, const double &y2, const double &z2) |
void | box (const dpoint3D &a, const dpoint3D &b, const bool filled=true) |
void | box (const dpoint3D &a, const dpoint3D &b, const T lineColor) |
void | ellipsoid (const vector< double > &mean, const matrix< double > &sigma, const double &cst) |
void | set3D (const channel &chnl, const float &height, const point &gridSize=point(5, 5), const point &sampleRate=point(1, 1), const bool onlyPoints=false, const bool useBoxes=false, const bool heightColor=false, const bool drawLines=false, const T &lineColor=T(), const bool drawContour=false, const T &contourColor=T()) |
void | axis (const double size) |
void | axis (const double size, const T &colorX, const T &colorY, const T &colorZ) |
void | grid (const double size, const int nbSteps) |
bool | flush (matrix< T > &image) |
bool | flush (const typename draw3D< T >::parameters &camera) |
bool | flush (const typename draw3D< T >::parameters &camera, matrix< T > &image) |
bool | flush () |
void | reset () |
void | setRange (const dmatrix &ranges) |
dmatrix | getRange () const |
Protected Types | |
enum | Instructions |
Protected Attributes | |
std::list< Instructions > | instructionList |
std::list< double > | doubles |
std::list< int > | ints |
std::list< T > | colors |
std::list< bool > | bools |
std::list< dvector > | dvectors |
std::list< dmatrix > | dmatrices |
std::list< channel > | channels |
std::list< std::string > | styles |
Tool for creating three dimensional scenes.
A scene can be created in the same way as a scene in drawn with draw3D. To view a scene, you have first to set up the camera parameters with the setCamera and setZoom methods. Then the scene can be drawn into an image with the flush() methods.
enum lti::scene3D::Instructions [protected] |
these are the code that are used for the instructions that are saved, to generate an image of the scene.
The letters after the function name symbolize the argument type: i=int, d=double, dp=dpoint3D, T=T, dv=dvector, dm=dmatrix, ch=channel This is necessary, because some functions exist more than once with different arguments but the names in the enumeration had to be unique.
lti::scene3D< T >::scene3D | ( | ) |
default constructor
lti::scene3D< T >::scene3D | ( | const scene3D< T > & | other | ) |
copy constructor
other | the object to be copied |
virtual lti::scene3D< T >::~scene3D | ( | ) | [virtual] |
destructor
void lti::scene3D< T >::axis | ( | const double | size, | |
const T & | colorX, | |||
const T & | colorY, | |||
const T & | colorZ | |||
) |
draw axis with dimension "size" and using the given color for each axis
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::axis | ( | const double | size | ) |
draw axis with dimension "size"
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::box | ( | const dpoint3D & | a, | |
const dpoint3D & | b, | |||
const T | lineColor | |||
) |
draw a filled box of the actual color with the opposite corners a and b, and with the line color given
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::box | ( | const dpoint3D & | a, | |
const dpoint3D & | b, | |||
const bool | filled = true | |||
) |
draw a box with the opposite corners a and b
Reimplemented from lti::draw3D< T >.
scene3D& lti::scene3D< T >::copy | ( | const scene3D< T > & | other | ) |
copy data of "other" functor.
other | the functor to be copied |
Reimplemented from lti::drawBase< T >.
void lti::scene3D< T >::ellipsoid | ( | const vector< double > & | mean, | |
const matrix< double > & | sigma, | |||
const double & | cst | |||
) |
Draw an ellipsoid surface defined through a constant mahalanobis distance between the mean vector and the points of the surface, i.e.
the surface contains all points that satisfy the equation (x-mean)^T sigma^(-1) (x-mean) = cst
The color of the ellipsoid is given with the setColor() method, and the lighting conditions with the parameter "lighting".
mean | point at the center of the ellipsoid. | |
sigma | covariance matrix | |
cst | mahalanobis distace from the points at the surface and the mean value |
Reimplemented from lti::draw3D< T >.
bool lti::scene3D< T >::flush | ( | ) |
bool lti::scene3D< T >::flush | ( | const typename draw3D< T >::parameters & | camera, | |
matrix< T > & | image | |||
) |
bool lti::scene3D< T >::flush | ( | const typename draw3D< T >::parameters & | camera | ) |
bool lti::scene3D< T >::flush | ( | matrix< T > & | image | ) |
dmatrix lti::scene3D< T >::getRange | ( | ) | const |
Returns the ranges of the axes shown in the configuration dialog.
virtual const char* lti::scene3D< T >::getTypeName | ( | ) | const [virtual] |
returns the name of this type ("scene3D")
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::grid | ( | const double | size, | |
const int | nbSteps | |||
) |
draw a grid in all three dimensions from -size/2 to size/2, with nbSteps lines between
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::line3D | ( | const double & | x, | |
const double & | y, | |||
const double & | z, | |||
const double & | x2, | |||
const double & | y2, | |||
const double & | z2 | |||
) |
draw a line between (x,y,z) and (x2,y2,z2)
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::line3D | ( | const dpoint3D & | a, | |
const dpoint3D & | b | |||
) |
draw a line between a and b
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::line3DTo | ( | const dpoint3D & | p | ) |
draw a line between the last used point and (x,y,z)
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::line3DTo | ( | const double & | x, | |
const double & | y, | |||
const double & | z | |||
) |
draw a line between the last used point and (x,y,z)
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::marker3D | ( | const double & | x, | |
const double & | y, | |||
const double & | z | |||
) |
sets point with selected color and marker type
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::marker3D | ( | const double & | x, | |
const double & | y, | |||
const double & | z, | |||
char * | marker | |||
) |
sets marker with selected color and the given marker type
scene3D& lti::scene3D< T >::operator= | ( | const scene3D< T > & | other | ) |
void lti::scene3D< T >::reset | ( | ) |
Clears the scene.
void lti::scene3D< T >::set2D | ( | const int & | x, | |
const int & | y, | |||
const double & | z | |||
) |
sets 2D point with the selected color if it is in front of all other points with the same projection coordinates, considering the z-buffering (if enabled) and the given z coordinate.
If the z-buffering is disabled, the pixel at (x,y) will be set.
x | position x | |
y | position y | |
z | deep information |
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::set3D | ( | const channel & | chnl, | |
const float & | height, | |||
const point & | gridSize = point(5, 5) , |
|||
const point & | sampleRate = point(1, 1) , |
|||
const bool | onlyPoints = false , |
|||
const bool | useBoxes = false , |
|||
const bool | heightColor = false , |
|||
const bool | drawLines = false , |
|||
const T & | lineColor = T() , |
|||
const bool | drawContour = false , |
|||
const T & | contourColor = T() | |||
) |
Draw the given channel as a 3D structure, where the height of the pixel is given by its intensity.
The actual color will be shaded to produce the 3D effect. The y-axis will be inverted, to convert the image left coordinate system to the 3D right system.
chnl | the channel with the 3D information | |
height | the height of the value 1.0 in the channel | |
gridSize | the number of pixels used for a "cell" in the grid. Use for example point(5,5) | |
sampleRate | determines which pixels in the image are going to be used in the grid points. point(1,1) uses all pixels, point(2,2) each second point and so on. | |
onlyPoints | if true, only the points will be drawn, if false, boxes or grids will be drawn. | |
useBoxes | if true, boxes will be used to display each pixel, otherwise a triangular mesh will be used. | |
heightColor | if true, the channel intensity will define the grey tone for the pixel, otherwise the actual color will be used. | |
drawLines | if true, the vertical lines at each grid point will be drawn. | |
lineColor | color for the vertical lines | |
drawContour | if true, the contour of each triangle in the mesh will be redrawn using the countour color given. | |
contourColor | color used to draw the contour of the triangles. Only used if drawContour is true |
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::set3D | ( | const hPoint3D< U > & | p | ) | [inline] |
sets point with selected color
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::set3D | ( | const double & | x, | |
const double & | y, | |||
const double & | z | |||
) |
sets point with selected color
Reimplemented from lti::draw3D< T >.
void lti::scene3D< T >::set3D | ( | const dpoint3D & | p | ) |
sets point with selected color
Reimplemented from lti::draw3D< T >.
Referenced by lti::scene3D< rgbPixel >::set3D().
void lti::scene3D< T >::setColor | ( | const T & | px | ) | [virtual] |
Specifies color to be used.
If the template type is rgbPixel this means an actual color. For other template types, this sets a grey-level.
Reimplemented from lti::draw< T >.
void lti::scene3D< T >::setRange | ( | const dmatrix & | ranges | ) |
sets the ranges of the axes shown in the configuration dialog
void lti::scene3D< T >::setStyle | ( | const char * | style | ) | [virtual] |
Specifies color to be used.
If the template type is rgbPixel this means an actual color. For other template types, this sets a grey-level.
Reimplemented from lti::drawBase< T >.
std::list<bool> lti::scene3D< T >::bools [protected] |
parameters for the Instructions
std::list<channel> lti::scene3D< T >::channels [protected] |
parameters for the Instructions
std::list<T> lti::scene3D< T >::colors [protected] |
parameters for the Instructions
std::list<dmatrix> lti::scene3D< T >::dmatrices [protected] |
parameters for the Instructions
std::list<double> lti::scene3D< T >::doubles [protected] |
parameters for the Instructions
std::list<dvector> lti::scene3D< T >::dvectors [protected] |
parameters for the Instructions
std::list<Instructions> lti::scene3D< T >::instructionList [protected] |
List with the codes of the saved instructions.
All instructions are coded with an integer value and there parameters are stored in the lists. When a picture is drawn the instructions are extracted from the list in the same order as they were saved. So the parameters can also be extracted from the lists in the same order.
std::list<int> lti::scene3D< T >::ints [protected] |
parameters for the Instructions
std::list<std::string> lti::scene3D< T >::styles [protected] |
parameters for the Instructions