sciGraphics::AxisPositioner Class Reference

#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/cpp/subwinDrawing/AxisPositioner.hxx>

Inheritance diagram for sciGraphics::AxisPositioner:

Inheritance graph
[legend]

Public Member Functions

 AxisPositioner (void)
virtual ~AxisPositioner (void)
virtual void getAxisBounds (double startBound[3], double endBound[3])=0
virtual void getGridEdges (double startBound1[3], double startBound2[3], double middleBound1[3], double middleBound2[3], double endBound1[3], double endBound2[3])
virtual void getTicksDirection (double ticksDir[3])=0
virtual int getRelativeTicksPosition (double ticksPos[], int nbTicks)=0

Protected Member Functions

virtual void setTicksDirectionLength (double ticksDir[3], sciPointObj *pSubwin)

Detailed Description

Interface for determining on which edge of axes box an axe will be

Definition at line 28 of file AxisPositioner.hxx.


Constructor & Destructor Documentation

sciGraphics::AxisPositioner::AxisPositioner ( void   )  [inline]

Definition at line 32 of file AxisPositioner.hxx.

00032 {}

virtual sciGraphics::AxisPositioner::~AxisPositioner ( void   )  [inline, virtual]

Definition at line 34 of file AxisPositioner.hxx.

00034 {}


Member Function Documentation

virtual void sciGraphics::AxisPositioner::getAxisBounds ( double  startBound[3],
double  endBound[3] 
) [pure virtual]

virtual void sciGraphics::AxisPositioner::getGridEdges ( double  startBound1[3],
double  startBound2[3],
double  middleBound1[3],
double  middleBound2[3],
double  endBound1[3],
double  endBound2[3] 
) [inline, virtual]

Find the edges on which the grid will be displayed from the axes. Box. Grid is drawn on 2 facets, then 3 edges are necessary. This function is not useful for all axes drawer and drawer which need it must redefine it.

Reimplemented in sciGraphics::XAxisPositioner, sciGraphics::YAxisPositioner, and sciGraphics::ZAxisPositioner.

Definition at line 47 of file AxisPositioner.hxx.

Referenced by sciGraphics::TicksDrawer::drawTicks().

00049                                                                       {}

Here is the caller graph for this function:

virtual void sciGraphics::AxisPositioner::getTicksDirection ( double  ticksDir[3]  )  [pure virtual]

Compute the direction and length of ticks

Implemented in sciGraphics::AxesPositioner, and sciGraphics::SubwinAxisPositioner.

Referenced by sciGraphics::TicksDrawer::drawTicks(), and sciGraphics::TicksDrawer::getAxisPosition().

Here is the caller graph for this function:

virtual int sciGraphics::AxisPositioner::getRelativeTicksPosition ( double  ticksPos[],
int  nbTicks 
) [pure virtual]

Convert ticks abscissas, into relative coordinates between the two axis bounds

Parameters:
ticksPos abscissas of ticks along their axis as input in output, get the relative coordinates between the axes bounds. 0 stands fot the start bound, 1 for the last one.
nbTicks number of ticks abascissas as input
Returns:
number of ticks as output

Implemented in sciGraphics::AxesPositioner, sciGraphics::XAxisPositioner, sciGraphics::YAxisPositioner, and sciGraphics::ZAxisPositioner.

Referenced by sciGraphics::TicksDrawer::drawTicks().

Here is the caller graph for this function:

void sciGraphics::AxisPositioner::setTicksDirectionLength ( double  ticksDir[3],
sciPointObj pSubwin 
) [protected, virtual]

Modify the length of ticks dir depending on the size of the parent subwin.

Definition at line 29 of file AxisPositioner.cpp.

References Abs, fact(), sciGraphics::DrawableSubwin::getCamera(), sciGraphics::Camera::getPixelCoordinatesRaw(), sciGraphics::Camera::getSceneCoordinatesRaw(), sciGraphics::getSubwinDrawer(), sciGraphics::Camera::getViewingArea(), M_PI, Max, normalize3D(), scalarMult3D(), TICKS_PIXEL_LENGTH, vectSubstract3D(), and width.

Referenced by sciGraphics::SubwinAxisPositioner::getTicksDirection(), and sciGraphics::AxesPositioner::getTicksDirection().

00030 {
00031   Camera * camera = getSubwinDrawer(pSubwin)->getCamera();
00032   double origin[3] = {0.0, 0.0, 0.0};
00033   camera->getPixelCoordinatesRaw(origin, origin);
00034 
00035   double pixDir[3];
00036   camera->getPixelCoordinatesRaw(ticksDir, pixDir);
00037   // get length in pixels
00038   vectSubstract3D(pixDir, origin, pixDir);
00039   normalize3D(pixDir);
00040 
00041   // get the viewport associated with the subwindow
00042   int xPos;
00043   int yPos;
00044   int width;
00045   int height;
00046   camera->getViewingArea(&xPos, &yPos, &width, &height);
00047                 
00048   // compute sizes wich would apply if axes where along X or Y axis
00049   // and use at least 2 pixels
00050   double xSize = Max(width * TICKS_PIXEL_LENGTH, 2);
00051   double ySize = Max(height * TICKS_PIXEL_LENGTH, 2);
00052                 
00053   // compute angle between ticks direction and x axis in pixel coordinates, pixDir[0]
00054   double angle = acos(Abs(pixDir[0]));
00055                 
00056   // push it between 0 and 1.
00057   double fact = angle * 2.0 / M_PI;
00058                 
00059   // apply number of pixels 
00060   scalarMult3D(pixDir, ((1.0 - fact) * xSize + fact * ySize), pixDir);
00061 
00062   // convert pix direction in 3D
00063   origin[0] = 0.0;
00064   origin[1] = 0.0;
00065   origin[2] = 0.0;
00066   camera->getSceneCoordinatesRaw(origin, origin);
00067   camera->getSceneCoordinatesRaw(pixDir, ticksDir);
00068   vectSubstract3D(ticksDir, origin, ticksDir);
00069 }

Here is the call graph for this function:

Here is the caller graph for this function:


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

Generated on Tue Sep 9 18:35:14 2008 for Scilab [trunk] by  doxygen 1.5.5