#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/cpp/subwinDrawing/Camera.h>


Public Member Functions | |
| Camera (sciPointObj *pObj) | |
| virtual | ~Camera (void) |
| void | replaceCamera (void) |
| void | getPixelCoordinates (const double userCoord[3], int pixCoord[2]) |
| void | getPixelCoordinates (const double userCoords[3], double pixCoords[3]) |
| void | getPixelCoordinatesRaw (const double userCoords[3], double pixCoords[3]) |
| void | get2dViewPixelCoordinates (const double userCoord[3], int pixCoord[2]) |
| void | get2dViewPixelCoordinates (const double userCoord[3], double pixCoord[3]) |
| void | getSceneCoordinates (const double pixCoords[3], double userCoords[3]) |
| void | getSceneCoordinatesRaw (const double pixCoords[3], double userCoords[3]) |
| void | get2dViewCoordinates (const int pixCoords[2], double userCoord2D[2]) |
| void | get2dViewCoordinates (const double userCoords[3], double coord2D[2]) |
| virtual EDisplayStatus | draw (void) |
| virtual EDisplayStatus | show (void) |
| virtual EDisplayStatus | redraw (void) |
| bool | zoomRect (int posX, int posY, int width, int height) |
| void | getViewingArea (int *xPos, int *yPos, int *width, int *height) |
| void | getViewport (int viewport[4]) |
Protected Member Functions | |
| void | setViewingArea (double axesBounds[4], double margins[4]) |
| void | setRotationAngles (double alpha, double theta) |
| void | setAxesReverse (BOOL axesReverse[3]) |
| void | setSubwinBox (double bounds[6]) |
| void | setCameraParameters (void) |
| void | renderPosition (void) |
| bool | zoomRect (const double corners[4][2]) |
| CameraBridge * | getCameraImp (void) |
Private Member Functions | |
| void | computeZoomAreaLines (const double areaPixCorners[4][2], double areaLines[4][2][3]) |
| bool | getXaxisIntersections (const double areaLines[4][2][3], double planeXCoord, double intersections[4][3]) |
| bool | getYaxisIntersections (const double areaLines[4][2][3], double planeYCoord, double intersections[4][3]) |
| bool | getZaxisIntersections (const double areaLines[4][2][3], double planeZCoord, double intersections[4][3]) |
| void | getIntersection (const double p1[3], const double p2[3], double alpha, double intersection[3]) |
| void | updateXCoordinate (const double intersections[][3], int nbIntersections, double oldXmin, double oldXmax, double &newXmin, double &newXmax) |
| void | updateYCoordinate (const double intersections[][3], int nbIntersections, double oldYmin, double oldYmax, double &newYmin, double &newYmax) |
| void | updateZCoordinate (const double intersections[][3], int nbIntersections, double oldZmin, double oldZmax, double &newZmin, double &newZmax) |
| int | getProjectedXIntersections (const double intersections[4][3], double projectedIntersections[8][3], double planeXCoord, double yMin, double yMax, double zMin, double zMax) |
| int | getProjectedYIntersections (const double intersections[4][3], double projectedIntersections[8][3], double planeYCoord, double xMin, double xMax, double zMin, double zMax) |
| int | getProjectedZIntersections (const double intersections[4][3], double projectedIntersections[8][3], double planeZCoord, double xMin, double xMax, double yMin, double yMax) |
| void | projectOnXPlane (const double point[3], double proj[2]) |
| void | unProjectOnXPlane (const double proj[2], double point[3], double planeXCoord) |
| void | projectOnYPlane (const double point[3], double proj[2]) |
| void | unProjectOnYPlane (const double proj[2], double point[3], double planeYCoord) |
| void | projectOnZPlane (const double point[3], double proj[2]) |
| void | unProjectOnZPlane (const double proj[2], double point[3], double planeZCoord) |
| int | getProjectedIntersections2D (const double intersections[4][2], double projectedIntersections[8][2], double xMin, double xMax, double yMin, double yMax) |
| bool | computeLineFillRectangleIntersections (const double p1[2], const double p2[2], double xMin, double xMax, double yMin, double yMax, double intersections[2][2]) |
| bool | isInsideRectangle (const double p[2], double xMin, double xMax, double yMin, double yMax) |
| int | computeLineRectangleIntersections (const double p1[2], const double p2[2], double xMin, double xMax, double yMin, double yMax, double intersections[2][2]) |
| bool | checkXIntersection (const double p1[2], const double p2[2], double res[2], double rectXCoord, double yMin, double yMax) |
| bool | checkYIntersection (const double p1[2], const double p2[2], double res[2], double rectYCoord, double xMin, double xMax) |
| void | p1PlusAP1P2 (const double p1[2], const double p2[2], double a, double res[2]) |
| bool | isPointInQuadrangle (const double point[2], const double corners[4][2]) |
| void | visualizeZoomingArea (const double intersections[4][2][3]) |
| void | visualizeIntersection (const double intersections[4][3]) |
Definition at line 27 of file Camera.h.
| sciGraphics::Camera::Camera | ( | sciPointObj * | pObj | ) |
| sciGraphics::Camera::~Camera | ( | void | ) | [virtual] |
| void sciGraphics::Camera::replaceCamera | ( | void | ) |
Put back camera to default position.
Definition at line 130 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::replaceCamera().
Referenced by sciGraphics::DrawableSubwin::draw(), sciGraphics::DrawableSubwin::drawSingleObjs(), sciGraphics::DrawableSubwin::redraw(), sciGraphics::DrawableSubwin::show(), and sciGraphics::DrawableSubwin::showSingleObjs().
00131 { 00132 getCameraImp()->replaceCamera(); 00133 }


| void sciGraphics::Camera::getPixelCoordinates | ( | const double | userCoord[3], | |
| int | pixCoord[2] | |||
| ) |
Convert user coordinates to pixel coordinates.
Definition at line 135 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getPixelCoordinates().
Referenced by get2dViewCoordinates(), sciGraphics::ConcreteDrawableSubwin::getEyeDistance(), and sciGetJavaPixelCoordinates().
00136 { 00137 getCameraImp()->getPixelCoordinates(userCoord, pixCoord); 00138 }


| void sciGraphics::Camera::getPixelCoordinates | ( | const double | userCoords[3], | |
| double | pixCoords[3] | |||
| ) |
Convert user coordinates to pixel coordinates including depth value
Definition at line 140 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getPixelCoordinates().
00141 { 00142 getCameraImp()->getPixelCoordinates(userCoords, pixCoords); 00143 }

| void sciGraphics::Camera::getPixelCoordinatesRaw | ( | const double | userCoords[3], | |
| double | pixCoords[3] | |||
| ) |
Convert user coordinates to pixel coordinates including depth value. Does not take logarithmic scale into account.
Definition at line 145 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getPixelCoordinatesRaw().
Referenced by sciGraphics::SubwinAxisPositioner::checkTicksDirection(), sciGraphics::ConcreteDrawableSubwin::computeConcealedCornerIndex(), sciGraphics::SubwinAxisPositioner::findFrontXCoordinate(), sciGraphics::SubwinAxisPositioner::findFrontYCoordinate(), sciGraphics::ZAxisPositioner::findLeftMostXCoordinate(), sciGraphics::ZAxisPositioner::findLeftMostYCoordinate(), sciGraphics::SubwinAxisPositioner::findLowerZCoordinate(), sciGraphics::LabelPositioner::getLabelDisplacement(), sciGraphics::TextContentDrawerJoGL::getPixelBoundingBox(), and sciGraphics::AxisPositioner::setTicksDirectionLength().
00146 { 00147 getCameraImp()->getPixelCoordinatesRaw(userCoords, pixCoords); 00148 }


| void sciGraphics::Camera::get2dViewPixelCoordinates | ( | const double | userCoord[3], | |
| int | pixCoord[2] | |||
| ) |
Convert user coordinates to pixel coordinated using the 2d view.
Definition at line 150 of file Camera.cpp.
References sciGraphics::CameraBridge::get2dViewPixelCoordinates(), and getCameraImp().
Referenced by sciGraphics::TextContentDrawerJoGL::getPixelLength(), and sciGetJava2dViewPixelCoordinates().
00151 { 00152 getCameraImp()->get2dViewPixelCoordinates(userCoord, pixCoord); 00153 }


| void sciGraphics::Camera::get2dViewPixelCoordinates | ( | const double | userCoord[3], | |
| double | pixCoord[3] | |||
| ) |
Convert user coordinates to pixel coordinated using the 2d view.
Definition at line 155 of file Camera.cpp.
References sciGraphics::CameraBridge::get2dViewPixelCoordinates(), and getCameraImp().
00156 { 00157 getCameraImp()->get2dViewPixelCoordinates(userCoord, pixCoord); 00158 }

| void sciGraphics::Camera::getSceneCoordinates | ( | const double | pixCoords[3], | |
| double | userCoords[3] | |||
| ) |
Unproject a 3 position in pixels into the standard scene coordinates
Definition at line 160 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getSceneCoordinates().
Referenced by computeZoomAreaLines(), sciGraphics::TitlePositioner::getAutoPosition(), and sciGraphics::TextContentDrawerJoGL::getBoundingRectangle().
00161 { 00162 getCameraImp()->getSceneCoordinates(pixCoords, userCoords); 00163 }


| void sciGraphics::Camera::getSceneCoordinatesRaw | ( | const double | pixCoords[3], | |
| double | userCoords[3] | |||
| ) |
Unproject a 3 position in pixels into the standard scene coordinates. Does not take logarithmic coordinates into account
Definition at line 165 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getSceneCoordinatesRaw().
Referenced by sciGraphics::AxisPositioner::setTicksDirectionLength().
00166 { 00167 getCameraImp()->getSceneCoordinatesRaw(pixCoords, userCoords); 00168 }


| void sciGraphics::Camera::get2dViewCoordinates | ( | const int | pixCoords[2], | |
| double | userCoord2D[2] | |||
| ) |
Find coordinates in 2D view from pixel ones
Definition at line 170 of file Camera.cpp.
References sciGraphics::CameraBridge::get2dViewCoordinates(), and getCameraImp().
Referenced by get2dViewCoordinates(), sciGetJava2dViewCoordFromPixel(), and sciGetJava2dViewCoordinates().
00171 { 00172 getCameraImp()->get2dViewCoordinates(pixCoords, userCoord2D); 00173 }


| void sciGraphics::Camera::get2dViewCoordinates | ( | const double | userCoords[3], | |
| double | coord2D[2] | |||
| ) |
Find the projection of user coords on the 2D frame.
Definition at line 175 of file Camera.cpp.
References get2dViewCoordinates(), and getPixelCoordinates().
00176 { 00177 int pixCoords[2]; 00178 // convert usetr coords to pixel ones 00179 getPixelCoordinates(userCoords, pixCoords); 00180 00181 // convert pixel ones to 2d frame ones 00182 get2dViewCoordinates(pixCoords, coord2D); 00183 }

| DrawableObject::EDisplayStatus sciGraphics::Camera::draw | ( | void | ) | [virtual] |
Draw the graphic handle and store it representation in memory for later faster drawing.
Implements sciGraphics::DrawableObject.
Definition at line 185 of file Camera.cpp.
References sciGraphics::DrawableObject::endDrawing(), getCameraImp(), sciGraphics::DrawableObject::initializeDrawing(), sciGraphics::CameraBridge::renderPosition(), setCameraParameters(), and sciGraphics::DrawableObject::SUCCESS.
Referenced by sciGraphics::DrawableSubwin::placeCamera().
00186 { 00187 initializeDrawing(); 00188 setCameraParameters(); 00189 getCameraImp()->renderPosition(); 00190 endDrawing(); 00191 return SUCCESS; 00192 }


| DrawableObject::EDisplayStatus sciGraphics::Camera::show | ( | void | ) | [virtual] |
Fast draw of the graphic handle on the screen using the data created by draw. Warning, be sure that draw is called before show each time the handle is modified.
Implements sciGraphics::DrawableObject.
Definition at line 194 of file Camera.cpp.
References getCameraImp(), sciGraphics::DrawableObjectBridge::show(), and sciGraphics::DrawableObject::SUCCESS.
Referenced by sciGraphics::DrawableSubwin::show(), and sciGraphics::DrawableSubwin::showSingleObjs().
00195 { 00196 getCameraImp()->show(); 00197 return SUCCESS; 00198 }


| DrawableObject::EDisplayStatus sciGraphics::Camera::redraw | ( | void | ) | [virtual] |
Display the camera using precomputed data
Reimplemented from sciGraphics::DrawableObject.
Definition at line 200 of file Camera.cpp.
References sciGraphics::DrawableObject::endDrawing(), getCameraImp(), sciGraphics::DrawableObject::initializeDrawing(), sciGraphics::CameraBridge::redraw(), and sciGraphics::DrawableObject::SUCCESS.
00201 { 00202 initializeDrawing(); 00203 getCameraImp()->redraw(); 00204 endDrawing(); 00205 return SUCCESS; 00206 }

| bool sciGraphics::Camera::zoomRect | ( | int | posX, | |
| int | posY, | |||
| int | width, | |||
| int | height | |||
| ) |
Apply a zoom square on the axes box
| posX | X coordinate of the lower left point of the zoom box in pixels. | |
| posY | Y coordinate of the lower left point of the zoom box in pixels. | |
| width | width of the zooming rectangle. | |
| height | height of the zooming rectangle. |
Definition at line 208 of file Camera.cpp.
00209 { 00210 double rectCorners[4][2] = {{posX , posY + height}, 00211 {posX , posY }, 00212 {posX + width, posY }, 00213 {posX + width, posY + height}}; 00214 00215 return zoomRect(rectCorners); 00216 00217 }
| void sciGraphics::Camera::getViewingArea | ( | int * | xPos, | |
| int * | yPos, | |||
| int * | width, | |||
| int * | height | |||
| ) |
Get the position and size of the rectangle in which the axes box must fit
Definition at line 406 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getViewingArea().
Referenced by sciGraphics::TitlePositioner::getAutoPosition(), sciGetJavaViewingArea(), and sciGraphics::AxisPositioner::setTicksDirectionLength().
00407 { 00408 getCameraImp()->getViewingArea(xPos, yPos, width, height); 00409 }


| void sciGraphics::Camera::getViewport | ( | int | viewport[4] | ) |
Get viewport of the canvas
Definition at line 411 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::getViewport().
Referenced by sciGraphics::TextContentDrawerJoGL::getPixelBoundingBox().
00412 { 00413 getCameraImp()->getViewport(viewport); 00414 }


| void sciGraphics::Camera::setViewingArea | ( | double | axesBounds[4], | |
| double | margins[4] | |||
| ) | [protected] |
Set the viewing zone for a subwin.
| axesBounds | axesBounds (WRECT) of the subwin. This a a vector [x_left,y_up,w,h]. | |
| margins | inside the axes bounds, set a surface to use. This is a vector [margin_left, margin_right, margin_top, margin_bottom]. |
Definition at line 40 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::setViewingArea().
Referenced by setCameraParameters().
00041 { 00042 double translation[2] ; 00043 // T = Taxes + SizeAxes * [marginLeft, marginTop]. 00044 translation[0] = axesBounds[0] + axesBounds[2] * margins[0] ; 00045 translation[1] = 1.0 - axesBounds[1] - axesBounds[3] * (1.0 - margins[3]) ; 00046 00047 // S = Saxes - margin.Saxes 00048 // where Saxes = [w,h] and margin = [margin_left+margin_right, margin_top+margin_bottom]. 00049 double scale[2] ; 00050 scale[0] = (1.0 - margins[0] - margins[1]) * axesBounds[2] ; 00051 scale[1] = (1.0 - margins[2] - margins[3]) * axesBounds[3] ; 00052 getCameraImp()->setViewingArea(translation, scale); 00053 }


| void sciGraphics::Camera::setRotationAngles | ( | double | alpha, | |
| double | theta | |||
| ) | [protected] |
Set the rotation angles of the camera.
Definition at line 55 of file Camera.cpp.
References getCameraImp(), and sciGraphics::CameraBridge::setAxesRotation().
Referenced by setCameraParameters().
00056 { 00057 getCameraImp()->setAxesRotation(alpha, theta); 00058 }


| void sciGraphics::Camera::setAxesReverse | ( | BOOL | axesReverse[3] | ) | [protected] |
Specify which axes must be reversed.
Definition at line 60 of file Camera.cpp.
References getCameraImp(), sciGraphics::CameraBridge::setAxesReverse(), and TRUE.
Referenced by setCameraParameters().
00061 { 00062 getCameraImp()->setAxesReverse(axesReverse[0] == TRUE, 00063 axesReverse[1] == TRUE, 00064 axesReverse[2] == TRUE); 00065 }


| void sciGraphics::Camera::setSubwinBox | ( | double | bounds[6] | ) | [protected] |
Specify the axes box to render.
| bounds | [Xmin,Xmax,Ymin,Ymax,Zmin,Zmax] vector. |
Definition at line 67 of file Camera.cpp.
References getCameraImp(), sciGraphics::DrawableObject::m_pDrawed, Min, sciGetIsCubeScaled(), sciGraphics::CameraBridge::setAxesCenter(), sciGraphics::CameraBridge::setAxesFittingScale(), sciGraphics::CameraBridge::setAxesNormalizationScale(), and sciGraphics::CameraBridge::setAxesTranslation().
Referenced by setCameraParameters().
00068 { 00069 00070 double boxCenter[3]; 00071 boxCenter[0] = (bounds[0] + bounds[1]) / 2.0 ; 00072 boxCenter[1] = (bounds[2] + bounds[3]) / 2.0 ; 00073 boxCenter[2] = (bounds[4] + bounds[5]) / 2.0 ; 00074 getCameraImp()->setAxesCenter(boxCenter) ; 00075 00076 double scale[3] ; 00077 // 1.0 / ( Xmax - Xmin ) 00078 scale[0] = 1.0 / (bounds[1] - bounds[0]) ; 00079 scale[1] = 1.0 / (bounds[3] - bounds[2]) ; 00080 scale[2] = 1.0 / (bounds[5] - bounds[4]) ; 00081 00082 getCameraImp()->setAxesNormalizationScale(scale) ; 00083 00084 if (sciGetIsCubeScaled(m_pDrawed)) 00085 { 00086 getCameraImp()->setAxesFittingScale(scale); 00087 } 00088 else 00089 { 00090 // preserve isometry by applying same scale 00091 double minScale = Min(scale[0], Min(scale[1], scale[2])); 00092 double fittingScale[3] = {minScale, minScale, minScale}; 00093 getCameraImp()->setAxesFittingScale(fittingScale); 00094 } 00095 00096 00097 double trans[3]; 00098 // put the min bounds to our origin 00099 trans[0] = -bounds[0] ; 00100 trans[1] = -bounds[2] ; 00101 trans[2] = bounds[4] ; 00102 getCameraImp()->setAxesTranslation(trans) ; 00103 00104 }

