Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GLViewer_CoordSystem Class Reference

Class implementing mathematical model of 2D coordinate system. More...

#include <GLViewer_CoordSystem.h>

Public Types

enum  CSType { Cartesian, Polar }
 A type of coordinate system. More...
 

Public Member Functions

 GLViewer_CoordSystem (CSType aType, double X0=0.0, double Y0=0.0, double XUnit=1.0, double YUnit=1.0, double Rotation=0.0)
 A constructor ( by default new system is identical to reference ) More...
 
void getOrigin (double &x, double &y) const
 Returns the origin in reference system. More...
 
void setOrigin (double x, double y)
 A function installing the origin in reference system. More...
 
void getUnits (double &x, double &y) const
 Returns units along axes. More...
 
void setUnits (double x, double y)
 A function installing units along axes. More...
 
double getRotation () const
 Returns rotation angle of axes in reference system. More...
 
void setRotation (double rotation)
 A function installing rotation angle of axes in reference system. More...
 
CSType getType () const
 Returns type of system. More...
 
void setType (CSType type)
 A function installing type of system. More...
 
void transform (GLViewer_CoordSystem &aSystem, double &x, double &y)
 Transform the coordinates x, y from current CS to aSystem. More...
 
virtual void getStretching (GLViewer_CoordSystem &aSystem, double &theX, double &theY)
 Return how many times line width in aSystem system bigger than in current. More...
 

Protected Member Functions

virtual void toReference (double &x, double &y)
 A function transforms system coords to coords in reference system. More...
 
virtual void fromReference (double &x, double &y)
 A function transforms from coords in reference system to system coords. More...
 

Private Attributes

double myX0
 The coordinates of origin in the reference CS. More...
 
double myY0
 
double myXUnit
 The lengths of axis units in the reference unit. More...
 
double myYUnit
 
double myRotation
 The rotation in radians relative to reference CS. More...
 
CSType myType
 In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius. More...
 

Detailed Description

Class GLViewer_CoordSystem Class implementing mathematical model of 2D coordinate system

Member Enumeration Documentation

Enumerator
Cartesian 
Polar 

Constructor & Destructor Documentation

GLViewer_CoordSystem::GLViewer_CoordSystem ( CSType  aType,
double  X0 = 0.0,
double  Y0 = 0.0,
double  XUnit = 1.0,
double  YUnit = 1.0,
double  Rotation = 0.0 
)

Constructor

Parameters
aType- type of CS
X0- X of origin in reference CS
Y0- Y of origin in reference CS
XUnit- X unit in reference CS
YUnit- Y unit in reference CS
Rotation- rotation relative reference CS

References setOrigin(), setRotation(), setType(), and setUnits().

Member Function Documentation

void GLViewer_CoordSystem::fromReference ( double &  x,
double &  y 
)
protectedvirtual

Recalculate co-ordinates from reference co-ordinates

Parameters
x,y- co-ordinates

References Cartesian, myRotation, myType, myX0, myXUnit, myY0, myYUnit, and Polar.

void GLViewer_CoordSystem::getOrigin ( double &  x,
double &  y 
) const
Returns
origin in reference CS

References myX0, and myY0.

double GLViewer_CoordSystem::getRotation ( ) const
Returns
rotation

References myRotation.

void GLViewer_CoordSystem::getStretching ( GLViewer_CoordSystem aSystem,
double &  theX,
double &  theY 
)
virtual
Returns
stretching of CS along X and Y axis

References myXUnit, and myYUnit.

GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType ( ) const
Returns
type

References myType.

void GLViewer_CoordSystem::getUnits ( double &  x,
double &  y 
) const
Returns
units

References myXUnit, and myYUnit.

void GLViewer_CoordSystem::setOrigin ( double  x,
double  y 
)

Sets origin in reference CS

References myX0, and myY0.

void GLViewer_CoordSystem::setRotation ( double  rotation)

Sets rotation

References myRotation.

void GLViewer_CoordSystem::setType ( CSType  type)

Sets type

References myType.

void GLViewer_CoordSystem::setUnits ( double  x,
double  y 
)

Sets units

References myXUnit, and myYUnit.

void GLViewer_CoordSystem::toReference ( double &  x,
double &  y 
)
protectedvirtual

Recalculate co-ordinates to reference co-ordinates

Parameters
x,y- co-ordinates

References Cartesian, myRotation, myType, myX0, myXUnit, myY0, myYUnit, and Polar.

void GLViewer_CoordSystem::transform ( GLViewer_CoordSystem aSystem,
double &  x,
double &  y 
)

Recalculate co-ordinates to co-ordinates of other CS

Parameters
aSystem- other CS
x,y- co-ordinates

References fromReference(), and toReference().

Member Data Documentation

double GLViewer_CoordSystem::myRotation
private
CSType GLViewer_CoordSystem::myType
private
double GLViewer_CoordSystem::myX0
private
double GLViewer_CoordSystem::myXUnit
private
double GLViewer_CoordSystem::myY0
private
double GLViewer_CoordSystem::myYUnit
private

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