BioInt  1.02.00
BioInt: An integrative biological object-oriented application framework and interpreter
BioPoint.h
Go to the documentation of this file.
00001 /****************************************************************************
00002 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00003 The BioBhasha : The Biologist's Programming Language 
00004 Version 1.0 (19th December 2001)
00005 Prasad, B.V.L.S.
00006 Contact: burrashiva@yahoo.com
00007 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00008 *****************************************************************************/
00009 #ifndef BIOPOINT_H
00010 #define BIOPOINT_H
00011 
00012 #include <iostream>
00013 #include <vector>
00014 #include <fstream>
00015 #include <cmath>
00016 #include "BioUtilities.h"
00017 
00018 using namespace std;
00019 /****************************************************************************
00020  * 
00021  * COMMENTARY on Each Class/Concept/:  Hows and Whys : 
00022  *
00023  * BioPoint: 
00024  *              To describe a position of any matter in Space, 3 axes form a
00025  *              necessary condition. Hence to reach that Point/Matter from 
00026  *              an Origin of 3 axes named X,Y,Z, one should know the 
00027  *              contribution of each axis to reach that point. This 
00028  *              contribution is represented by each axis as x,y,z.
00029  *              In general a Cartsian System is followed i.e the 3 axes are 
00030  *              mutually perpendicular.
00031  *              In Crystallography, 3 axes are used to describe a unit cell
00032  *              which  is called fractional coordinate system, in  which the 
00033  *              axes may not be mutually perpendicular.
00034  *              
00035  *              A Point has a state to be maintained, which can be 
00036  *              altered, hence is Eligible to become an ADT.
00037  *              It can be said that: "A Point is the Fundamental Particle and 
00038  *              Foundation Stone of Structural BioInformatics."
00039  ***************************************************************************/
00040 
00041 class BioPoint
00042 {
00043 
00044 protected: 
00045 
00046         float x_, y_, z_;
00047 
00048 public:
00049 /* Constructors:
00050  *      2 Constructors are Provided here. A Point is characterized by 
00051  *      simply x,y,z coordinates only. Hence the 2nd constructor is 
00052  *      provided to initialise the Object with x,y,z.
00053  ***********************************************************************/
00054         BioPoint();
00055         BioPoint(const BioPoint& );
00056         BioPoint& operator=(const BioPoint&);
00057         BioPoint(const float x1,const float y1, const float z1);
00058 
00059 /* Accessing each Coordinate:*/
00060 
00061 
00062         float getX() const ;
00063         float getY() const ;
00064         float getZ() const ;
00065 
00066 /* Setting the x,y,z coordinates when a Object is constructed through its
00067  * default constructor. 
00068  * It can also be used to set "DESIRED" x,y,z coordinate values at any 
00069  * point of programming irrespective of the initial coordinate set.
00070  * *********************************************************************/
00071         void setXYZ(float, float , float );
00072         void setX(float);
00073         void setY(float);
00074         void setZ(float);
00075 
00076 /*Printing the x,y,z coordinates, ONTO THE CONSOLE by DEFAULT.
00077  * Provision is provided to write into a file, if the output stream is 
00078  * set to a file. Ex. ofstream output("xyz.coor"); showXYZ(output);
00079  * will put coordinates , x,y,z in file called xyz.coor.
00080  * *********************************************************************/
00081         void  showPoint(ostream& os = cout) const ;
00082         friend ostream& operator<<(ostream& os , const BioPoint& );
00083 
00084 /* Very Useful Methods of BioPoint Class:
00085  * These are expected to be most frequently used for manipulation.
00086  * The requirements of a user are generally:
00087  * a) To rotate a point or translate a point
00088  * b) to rotate and translate,
00089  * as is needed in understanding the equivalent points in Crystallographic
00090  * symmetry.
00091  * **********************************************************************/
00092 
00093 /* Expects a 3x3 Rotation Matrix as argument. 
00094  * This Rotation Matrix is used on the data and the Rotated Point is 
00095  * returned as Point. This returning as a Point has great importance from 
00096  * a programmer's point of view. 
00097  * a) It strictly abides to OOPs concept as it keeps the Data Safe.
00098  * ***********************************************************************/
00099         BioPoint getRotatedPoint(const float **a_ );
00100         BioPoint getRotatedPoint( const BioMatrix& a_);
00101 /* A Point can also be rotated about an Axis with a certain angle.
00102  * This facility is provided for the user by OverLoading the getRotatedPoint()
00103  * function.
00104  * ************************************************************************/
00105         BioPoint getRotatedPoint(const float th, const char axis);
00106 
00107 // Similar to Rotation Matrix , it expects a 3x1 Translation Matrix.
00108         BioPoint getTranslatedPoint(const float *a_);
00109 
00110 //Both Translation and Rotation Matrices are given and the result is returned.
00111         BioPoint getRotoTranslatedPoint(const float **a_,const float *b_ );
00112 
00113 // Rotation about an axis and a translation facility is given here. 
00114         BioPoint getRotoTranslatedPoint(const float th, const char ax,const float *b_ );
00115 
00116 // Distance between the (this) Point and Desired Point provided as argument is given.
00117         float getDistance(const BioPoint& );
00118 
00119 // Distance can also obtained between the (this)Point and an arbitrary x,y,z coordinates.
00120         float getDistance(const float, const float, const float );
00121 
00122 
00123 /*
00124  *      To Be Added:  return the rotation and translation matrices in the form of BioMatrix.
00125  *      
00126  *
00127  * ***********************************************************/
00128 };
00129 
00130 float BioDistance( const BioPoint& , const BioPoint& );
00131 float BioAngle( const BioPoint& , const BioPoint& , const BioPoint&);
00132 float BioTorsion( const BioPoint&, const BioPoint& , const BioPoint& ,
00133                         const BioPoint&);
00134 vector <float> BioDirectionCosines( const BioPoint& , const BioPoint&);
00135 vector <float> BioVectorCrossProduct( const BioPoint&, const BioPoint& , const BioPoint& );
00136 
00137 #endif
00138 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines