Version: 9.15.0
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 implementing mathematical model of 2D coordinate system.

Class GLViewer_CoordSystem Class implementing mathematical model of 2D coordinate system

Member Enumeration Documentation

◆ CSType

A type of coordinate system.

Enumerator
Cartesian 
Polar 

Constructor & Destructor Documentation

◆ GLViewer_CoordSystem()

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 
)

A constructor ( by default new system is identical to reference )

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

◆ fromReference()

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

A function transforms from coords in reference system to system coords.

Recalculate co-ordinates from reference co-ordinates

Parameters
x,y- co-ordinates

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

◆ getOrigin()

void GLViewer_CoordSystem::getOrigin ( double &  x,
double &  y 
) const

Returns the origin in reference system.

Returns
origin in reference CS

References myX0, and myY0.

◆ getRotation()

double GLViewer_CoordSystem::getRotation ( ) const

Returns rotation angle of axes in reference system.

Returns
rotation

References myRotation.

◆ getStretching()

void GLViewer_CoordSystem::getStretching ( GLViewer_CoordSystem aSystem,
double &  theX,
double &  theY 
)
virtual

Return how many times line width in aSystem system bigger than in current.

Returns
stretching of CS along X and Y axis

References myXUnit, and myYUnit.

◆ getType()

GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType ( ) const

Returns type of system.

Returns
type

References myType.

◆ getUnits()

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

Returns units along axes.

Returns
units

References myXUnit, and myYUnit.

◆ setOrigin()

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

A function installing the origin in reference system.

Sets origin in reference CS

References myX0, and myY0.

◆ setRotation()

void GLViewer_CoordSystem::setRotation ( double  rotation)

A function installing rotation angle of axes in reference system.

Sets rotation

References myRotation.

◆ setType()

void GLViewer_CoordSystem::setType ( CSType  type)

A function installing type of system.

Sets type

References myType.

◆ setUnits()

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

A function installing units along axes.

Sets units

References myXUnit, and myYUnit.

◆ toReference()

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

A function transforms system coords to coords in reference system.

Recalculate co-ordinates to reference co-ordinates

Parameters
x,y- co-ordinates

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

◆ transform()

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

Transform the coordinates x, y from current CS to aSystem.

Recalculate co-ordinates to co-ordinates of other CS

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

References fromReference(), and toReference().

Member Data Documentation

◆ myRotation

double GLViewer_CoordSystem::myRotation
private

The rotation in radians relative to reference CS.

◆ myType

CSType GLViewer_CoordSystem::myType
private

In the polar CS myYUnit is ignored, but myXUnit is the unit of polar radius

◆ myX0

double GLViewer_CoordSystem::myX0
private

The coordinates of origin in the reference CS.

◆ myXUnit

double GLViewer_CoordSystem::myXUnit
private

The lengths of axis units in the reference unit.

◆ myY0

double GLViewer_CoordSystem::myY0
private

◆ myYUnit

double GLViewer_CoordSystem::myYUnit
private

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