|
latest version v1.9 - last update 24 Nov 2005 |
|
#include <ltiDraw3D.h>
Inheritance diagram for lti::draw3D< T >:


Public Member Functions | |
| draw3D () | |
| ~draw3D () | |
| virtual const char * | getTypeName () const |
| void | use (matrix< T > &img) |
| bool | setParameters (const parameters &opt) |
| const parameters & | getParameters () const |
| parameters & | getParameters () |
| void | setCamera (const double &x1, const double &y1, const double &z1, const double &x2, const double &y2, const double &z2) |
| void | setCamera (const double &x1, const double &y1, const double &z1, const double &elevation, const double &azimuth) |
| void | setCamera (const dpoint3D &x1, const dpoint3D &x2) |
| void | setCamera (const dpoint3D &x1, const double &elevation, const double &azimuth) |
| void | setPerspective (const double &p) |
| void | setCenter (const double &x, const double &y) |
| void | setCenter (const dpoint &x) |
| void | setZoom (const double &z) |
| dpoint | getOriginPosition () const |
| const hmatrix & | getCameraMatrix () const |
| void | resetDeepCtrl (const bool deep=true) |
| void | p3Dto2D (const double &x, const double &y, const double &z, int &x2, int &y2, double &z2) const |
| void | p3Dto2D (const dpoint3D &p3, point &p2, double &z2) const |
| 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) |
| void | marker3D (const double &x, const double &y, const double &z, const char *style) |
| 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 | grid (const double size, const int nbSteps) |
| void | axis (const double size) |
| void | axis (const double size, const T &colorX, const T &colorY, const T &colorZ) |
Static Public Member Functions | |
| static T | getGray (const float &val) |
Protected Member Functions | |
| bool | correctLine (int &x, int &y, double &z, const int &x2, const int &y2, const double &z2) |
| T | shadingColor (const dpoint3D &nrm, const T &color) const |
| void | set3D (const triangle &t, const bool filled=true) |
| void | ioLine (const point &p1, const double &z1, const point &p2, const double &z2, ivector &in, ivector &out, dvector &zIn, dvector &zOut, const int firstY) const |
| double | copysign (const double &a, const double &b) |
| int | sign (const double &a) |
Protected Attributes | |
| parameters | param |
| bool | deepCtrl |
| matrix< float > | deepImg |
| dpoint3D | act |
| hmatrix | cam |
| dpoint3D | camTarget |
| dpoint | center |
| dpoint | precenter |
Classes | |
| class | hmatrix |
| homogene matrix More... | |
| class | parameters |
| parameters for draw3D. More... | |
| class | triangle |
| Triangle is the base for all other polygons. More... | |
The template type T specifies the type of elements of the matrix. To draw in a color image you will need for example a lti::draw3D<rgbPixel> object. Use the parameters to set the camera position and direction. You can activate/deactivate a z-Buffering using the method resetDeepCtrl(bool), where the boolean should be true if you want to activate the z-Buffering, or false otherwise. The default state for the z-Buffering is off.
Example:
double a; lti::image canvas; // the image to draw on lti::draw3D<lti::rgbPixel> drawer; // our draw object lti::viewer view; // a viewer to see what we do canvas.resize(256,256,lti::Black); // 256x256 are enough drawer.use(canvas); drawer.setZoom(50); // take pictures all around... (at 1/2 degree steps...) for (a=0;a<5*2.0*lti::Pi;a+=0.5*lti::Pi/180.0) { canvas.fill(lti::Black); drawer.resetDeepCtrl(true); // activate the z-Buffering drawer.setCamera(1.5*sin(a),1.5*cos(a),1,0,0,0); // draw a cube drawer.setColor(lti::White); // draw the lower plate drawer.set3D(1,1,-1); drawer.line3DTo(-1,1,-1); drawer.line3DTo(-1,-1,-1); drawer.line3DTo(1,-1,-1); drawer.line3DTo(1,1,-1); // draw the upper plate drawer.set3D(1,1,1); drawer.line3DTo(-1,1,1); drawer.line3DTo(-1,-1,1); drawer.line3DTo(1,-1,1); drawer.line3DTo(1,1,1); // and the edges drawer.setColor(lti::Red); drawer.line3D(-1, 1,1,-1, 1,-1); drawer.setColor(lti::Green); drawer.line3D(-1,-1,1,-1,-1,-1); drawer.setColor(lti::Blue); drawer.line3D( 1,-1,1, 1,-1,-1); drawer.setColor(lti::Yellow); drawer.line3D( 1, 1,1, 1, 1,-1); view.show(canvas); }
See also draw3D<T>::parameters for more information about the camera parameters.
|
|||||||||
|
default constructor
|
|
|||||||||
|
destructor
|
|
||||||||||||||||||||||||
|
draw axis with dimension "size" and using the given color for each axis
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||
|
draw axis with dimension "size"
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
draw a filled box of the actual color with the opposite corners a and b, and with the line color given
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
draw a box with the opposite corners a and b
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||
|
copysign return abs(a) with the sign of b
|
|
||||||||||||||||||||||||||||||||
|
checks and corrects 3D line to be within the image
|
|
||||||||||||||||||||
|
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".
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
|||||||||
|
get a read-only reference of the transformation matrix being used.
|
|
||||||||||
|
return a grey value for the proper type T, where the input is always between 0 (black) and 1 (white).
|
|
|||||||||
|
get a read-only reference to the coordinate point in the current image, where the origin of the world coordinates will be projected.
|
|
||||||||||
|
get parameters
|
|
||||||||||
|
get parameters
|
|
|||||||||
|
return the name of the this object
Reimplemented from lti::draw< T >. Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||
|
draw a grid with dimension "size" using the actual drawnig color. The grid lies in all three dimensions at size/2. Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||||||||||||||||||||||||||
|
help function for triangle. Draws a line as io codes in the given lists. This function expects p1.y <= p2.y |
|
||||||||||||||||||||||||||||||||
|
draw a line between (x,y,z) and (x2,y2,z2)
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||
|
draw a line between a and b
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||
|
draw a line between the last used point and (x,y,z)
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
draw a line between the last used point and (x,y,z)
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||||||
|
sets marker with given style
|
|
||||||||||||||||||||
|
sets marker with selected style
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
project 3D point into camera plane
|
|
||||||||||||||||||||||||||||||||
|
project 3D point into camera plane
|
|
||||||||||
|
reset z-Buffer.
With this method you can activate/deactivate the z-Buffering. This allows the correct display of your drawings. Note that if you resize the used image (see use()), this object will not be able to detect it automatically (this would take too much time!) and your program could crash! To avoid problems, call again one of
|
|
||||||||||||||||||||
|
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.
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||
|
sets a triangle
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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.
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||
|
sets point with selected color
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
sets point with selected color
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||
|
sets point with selected color
Reimplemented in lti::scene3D< T >, and lti::scene3D< rgbPixel >. |
|
||||||||||||||||||||
|
set position and direction of the camera
|
|
||||||||||||||||
|
set position and target position of the camera
|
|
||||||||||||||||||||||||||||
|
set position and direction of the camera
|
|
||||||||||||||||||||||||||||||||
|
set position and target position of the camera
|
|
||||||||||
|
set camera plane center
These are relative coordinates, i.e. if you want to map the target camera point |
|
||||||||||||||||
|
set camera plane center.
These are relative coordinates, i.e. if you want to map the target camera point |
|
||||||||||
|
set parameters
|
|
||||||||||
|
set perspective. Set to zero for an orthographic projection or greater zero for perspective effects. You can consider this value as -1/f with f the focal distance. So, to get good results try always positive values |
|
||||||||||
|
set zoom factor
|
|
||||||||||||||||
|
compute the shading color from "color", assuming that the light source is at z-axis in infinity, and the normal vector to the surface is given.
|
|
||||||||||
|
returns 1 if a >= 0.0; -1 otherwise
|
|
||||||||||
|
Indicates in which image will be drawn.
Reimplemented from lti::draw< T >. |
|
|||||
|
actual (last used) 3D point coordinates
|
|
|||||
|
camera homogene transformation matrix
|
|
|||||
|
camera target point
|
|
|||||
|
camera plane center
|
|
|||||
|
true: use a Z-Buffer
|
|
|||||
|
Z-Buffer.
|
|
|||||
|
parameters
|
|
|||||
|
camera plane center in normalized coordinates (0. .1) |