gcu::CrystalLine Class Reference

#include <gcu/crystalline.h>

List of all members.

Public Member Functions

 CrystalLine ()
virtual ~CrystalLine ()
 CrystalLine (CrystalLineType Type, double X1, double Y1, double Z1, double X2, double Y2, double Z2, double r, float red, float green, float blue, float alpha)
 CrystalLine (CrystalLine &clLine)
CrystalLineoperator= (CrystalLine &clLine)
double X1 (void)
double Y1 (void)
double Z1 (void)
double X2 (void)
double Y2 (void)
double Z2 (void)
double Xmax ()
double Ymax ()
double Zmax ()
double Xmin ()
double Ymin ()
double Zmin ()
double Long ()
CrystalLineType Type ()
void SetPosition (double x, double y, double z, double x1, double y1, double z1)
void SetColor (float red, float green, float blue, float alpha)
void GetColor (double *red, double *green, double *blue, double *alpha)
void SetRadius (double r)
double GetRadius ()
bool operator== (CrystalLine &clLine)
virtual void Move (double x, double y, double z)
double ScalProd (int h, int k, int l)
void Cleave ()
void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma)
double Distance (double x, double y, double z, bool bFixed)
bool IsCleaved ()
void GetRotation (double &x, double &y, double &z, double &th)
virtual xmlNodePtr Save (xmlDocPtr xml) const
virtual bool Load (xmlNodePtr node)

Protected Attributes

float m_fBlue
float m_fRed
float m_fGreen
float m_fAlpha
double m_dx
double m_dy
double m_dz
double m_dx2
double m_dy2
double m_dz2
double m_dr
int m_nCleave
CrystalLineType m_nType


Detailed Description

Describes lines represented as cylinders in the view. Thes cylinders are not capped.

Definition at line 54 of file crystalline.h.


Constructor & Destructor Documentation

gcu::CrystalLine::CrystalLine (  ) 

The default constructor of CrystalLine.

virtual gcu::CrystalLine::~CrystalLine (  )  [virtual]

The destructior of CrystaLine

gcu::CrystalLine::CrystalLine ( CrystalLineType  Type,
double  X1,
double  Y1,
double  Z1,
double  X2,
double  Y2,
double  Z2,
double  r,
float  red,
float  green,
float  blue,
float  alpha 
)

Parameters:
Type,: the type (CrystalLineType) of the new line.
X1,: the x coordinate of the first end of the new line.
Y1,: the y coordinate of the first end of the new line.
Z1,: the z coordinate of the first end of the new line.
X2,: the x coordinate of the second end of the new line.
Y2,: the y coordinate of the second end of the new line.
Z2,: the z coordinate of the second end of the new line.
r,: the radius of the cylinder which will represent the new line.
red,: the red component of the cylinder which will represent the new line.
green,: the green component of the cylinder which will represent the new line.
blue,: the blue component of the cylinder which will represent the new line.
alpha,: the alpha component of the cylinder which will represent the new line.
Constructs a new line from its characterisitics.

gcu::CrystalLine::CrystalLine ( CrystalLine clLine  ) 

Parameters:
clLine,: the line to duplicate.
Creates a new line with the same characteristics as clLine.


Member Function Documentation

CrystalLine& gcu::CrystalLine::operator= ( CrystalLine clLine  ) 

Parameters:
clLine,: the line to copy.
Copies a line.
Returns:
the copied line.

double gcu::CrystalLine::X1 ( void   )  [inline]

Returns:
the x coordinate of the first end of the line.

Definition at line 101 of file crystalline.h.

References m_dx.

double gcu::CrystalLine::Y1 ( void   )  [inline]

Returns:
the y coordinate of the first end of the line.

Definition at line 105 of file crystalline.h.

References m_dy.

double gcu::CrystalLine::Z1 ( void   )  [inline]

Returns:
the z coordinate of the first end of the line.

Definition at line 109 of file crystalline.h.

References m_dz.

double gcu::CrystalLine::X2 ( void   )  [inline]

Returns:
the x coordinate of the second end of the line.

Definition at line 113 of file crystalline.h.

References m_dx2.

double gcu::CrystalLine::Y2 ( void   )  [inline]

Returns:
the y coordinate of the second end of the line.

Definition at line 117 of file crystalline.h.

References m_dy2.

double gcu::CrystalLine::Z2 ( void   )  [inline]

Returns:
the z coordinate of the second end of the line.

Definition at line 121 of file crystalline.h.

References m_dz2.

double gcu::CrystalLine::Xmax (  ) 

Returns:
the greatest x coordinate of the line.

double gcu::CrystalLine::Ymax (  ) 

Returns:
the greatest y coordinate of the line.

double gcu::CrystalLine::Zmax (  ) 

Returns:
the greatest z coordinate of the line.

double gcu::CrystalLine::Xmin (  ) 

Returns:
the lowest x coordinate of the line.

double gcu::CrystalLine::Ymin (  ) 

Returns:
the lowest y coordinate of the line.

double gcu::CrystalLine::Zmin (  ) 

Returns:
the lowest z coordinate of the line.

double gcu::CrystalLine::Long (  )  [inline]

Returns:
the length of the line.

Definition at line 149 of file crystalline.h.

CrystalLineType gcu::CrystalLine::Type (  )  [inline]

Returns:
the type of the line (see CrystalLineType).

Definition at line 153 of file crystalline.h.

References m_nType.

void gcu::CrystalLine::SetPosition ( double  x,
double  y,
double  z,
double  x1,
double  y1,
double  z1 
)

Parameters:
x,: the new x coordinate of the first end of the new line.
y,: the new y coordinate of the first end of the new line.
z,: the new z coordinate of the first end of the new line.
x1,: the new x coordinate of the second end of the new line.
y1,: the new y coordinate of the second end of the new line.
z1,: the new z coordinate of the second end of the new line.
Moves a line to a new position.

void gcu::CrystalLine::SetColor ( float  red,
float  green,
float  blue,
float  alpha 
)

Parameters:
red,: the red component of the new color of the line.
green,: the green component of the new color of the line.
blue,: the blue component of the new color of the line.
alpha,: the alpha component of the new color of the line.
Changes the color used to display the line.

void gcu::CrystalLine::GetColor ( double *  red,
double *  green,
double *  blue,
double *  alpha 
)

Parameters:
red,: a pointer to the location to which the red component of the color of the line will be copied.
green,: a pointer to the location to which the green component of the new color of the line will be copied.
blue,: a pointer to the location to which the blue component of the new color of the line will be copied.
alpha,: a pointer to the location to which the alpha component of the new color of the line will be copied.
Gets the components of the color used to display the line.

void gcu::CrystalLine::SetRadius ( double  r  ) 

Parameters:
r,: the new radius of the cylinder representing the line.
Changes the radius of the cylinder used to represent the line.

double gcu::CrystalLine::GetRadius (  )  [inline]

Returns:
the radius of the cylinder used to represent the line.

Definition at line 192 of file crystalline.h.

References m_dr.

bool gcu::CrystalLine::operator== ( CrystalLine clLine  ) 

Parameters:
clLine,: a CrystalLine instance.
Returns:
true if the two lines have the same type and the same position.

virtual void gcu::CrystalLine::Move ( double  x,
double  y,
double  z 
) [virtual]

Parameters:
x,: the x component of the transation vector.
y,: the y component of the transation vector.
z,: the z component of the transation vector.
Used to move a line.

double gcu::CrystalLine::ScalProd ( int  h,
int  k,
int  l 
)

Parameters:
h,: the h Miller index of a plane.
k,: the k Miller index of a plane.
l,: the l Miller index of a plane.
Returns:
the product hx+ky+lz where x, y and z are the coordinates of one of the ends the line. The end giving the largest value is retained for the calculus. This makes sense only if coordinates are related to the net and are not the cartesian coordinates. This method should not be called after NetToCartesian().

void gcu::CrystalLine::Cleave (  )  [inline]

Method used to cleave a line. The inverse operation does not exist since the whole crystal must be recalculated after a change in the definition.

Definition at line 221 of file crystalline.h.

References m_nCleave.

void gcu::CrystalLine::NetToCartesian ( double  a,
double  b,
double  c,
double  alpha,
double  beta,
double  gamma 
)

Parameters:
a,: the a parameter of the unit cell.
b,: the b parameter of the unit cell.
c,: the c parameter of the unit cell.
alpha,: the alpha angle of the unit cell.
beta,: the beta angle of the unit cell.
gamma,: the gamma angle of the unit cell.
Converts the coordinates of the line from net related ones to cartesian. Initially, lines are defined by their position relative to the unit cell and the coordinates must be transformed to the cartesian ones before displaying the line.

double gcu::CrystalLine::Distance ( double  x,
double  y,
double  z,
bool  bFixed 
)

Parameters:
x,: the x coordinate of the center.
y,: the y coordinate of the center.
z,: the z coordinate of the center.
bFixed,: tells if cleaved lines are taken into account.
This helper method is called when searching for the size of the crystal. When some cleavages are defined, the procedure cn take into account lines cleaved to get the same position in the view for the cleaved crystal than for the whole crystal. If bFixed is true, all lines are taken into account.

Returns:
the largest distance of the line to the center of the view or 0 if bFixed is false and the line cleaved.

bool gcu::CrystalLine::IsCleaved (  )  [inline]

Returns:
true if the line is cleaved by at least one cleavage or false if the line is not cleaved at all.

Definition at line 251 of file crystalline.h.

References m_nCleave.

void gcu::CrystalLine::GetRotation ( double &  x,
double &  y,
double &  z,
double &  th 
)

Parameters:
x,: the x component of the vector of the rotation axis.
y,: the y component of the vector of the rotation axis.
z,: the z component of the vector of the rotation axis.
th,: the angle of the rotation.
This helper method is used to get the orientation of the line relative to the z axis. It is used when exporting to the VRML format.

virtual xmlNodePtr gcu::CrystalLine::Save ( xmlDocPtr  xml  )  const [virtual]

Parameters:
xml,: the xmlDoc used to save the document.
Saves the line.
Returns:
the xmlnode containing the description of the line.

virtual bool gcu::CrystalLine::Load ( xmlNodePtr  node  )  [virtual]

Parameters:
node,: a pointer to the xmlNode containing the serialized line.
Loads a line from the XML document.


Member Data Documentation

float gcu::CrystalLine::m_fBlue [protected]

The blue component of the color of the cylinder representing the line.

Definition at line 280 of file crystalline.h.

float gcu::CrystalLine::m_fRed [protected]

The red component of the color of the cylinder representing the line.

Definition at line 284 of file crystalline.h.

float gcu::CrystalLine::m_fGreen [protected]

The green component of the color of the cylinder representing the line.

Definition at line 288 of file crystalline.h.

float gcu::CrystalLine::m_fAlpha [protected]

The alpha component of the color of the cylinder representing the line.

Definition at line 292 of file crystalline.h.

double gcu::CrystalLine::m_dx [protected]

The x coordinate of the first end of the line.

Definition at line 296 of file crystalline.h.

Referenced by X1().

double gcu::CrystalLine::m_dy [protected]

The y coordinate of the first end of the line.

Definition at line 300 of file crystalline.h.

Referenced by Y1().

double gcu::CrystalLine::m_dz [protected]

The z coordinate of the first end of the line.

Definition at line 304 of file crystalline.h.

Referenced by Z1().

double gcu::CrystalLine::m_dx2 [protected]

The x coordinate of the second end of the line.

Definition at line 308 of file crystalline.h.

Referenced by X2().

double gcu::CrystalLine::m_dy2 [protected]

The x coordinate of the second end of the line.

Definition at line 312 of file crystalline.h.

Referenced by Y2().

double gcu::CrystalLine::m_dz2 [protected]

The x coordinate of the second end of the line.

Definition at line 316 of file crystalline.h.

Referenced by Z2().

double gcu::CrystalLine::m_dr [protected]

The radius of the cylinder representing the line.

Definition at line 320 of file crystalline.h.

Referenced by GetRadius().

int gcu::CrystalLine::m_nCleave [protected]

When cleavages (see CrystalCleavage class documentation) are defined, the line might be cleaved. m_nCleave is the number of CrystalCleavage instances which remove the line. If this member is not 0, the line will not be displayed.

Definition at line 326 of file crystalline.h.

Referenced by Cleave(), and IsCleaved().

The type of the CrystalLine instance. Possible values are:

  • edges: all the cell edges.
  • diagonals: the lines joining opposite vertices of a cell.
  • medians: the lines joining the centers of opposite faces of a cell.
  • normal: a line with defined ends, repeated in each displayes cell.
  • unique: a line with defined ends, not repeated.

Definition at line 335 of file crystalline.h.

Referenced by Type().


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

Generated on Sun Jun 22 13:26:05 2008 for The Gnome Chemistry Utils by  doxygen 1.5.6