# include <GL/xmesa.h>
#endif
+#include STL_FSTREAM
#include STL_STRING
#include <stdlib.h>
# include <windows.h>
#endif
+#include <simgear/compiler.h>
+
#include <GL/glut.h>
#include <simgear/xgl/xgl.h>
#include <stdio.h>
#include <stdlib.h>
+#include STL_FSTREAM
+
#include <plib/pu.h> // plib include
#include <simgear/constants.h>
hud_and_panel->disable( GL_CULL_FACE );
hud_and_panel->disable( GL_TEXTURE_2D );
hud_and_panel->disable( GL_LIGHTING );
+ hud_and_panel->enable( GL_BLEND );
menus = new ssgSimpleState;
menus->disable( GL_CULL_FACE );
lowleveltime.cxx lowleveltime.h \
timezone.cxx timezone.h \
moonpos.cxx moonpos.hxx \
- mymath.cxx mymath.h \
sunpos.cxx sunpos.hxx \
timestamp.hxx
*
************************************************************************/
#include "geocoord.h"
+#include <plib/sg.h>
GeoCoord::GeoCoord(const GeoCoord& other)
{
lon = other.lon;
}
-double GeoCoord::getAngle(const GeoCoord& other) const
-{
- Vector first( getX(), getY(), getZ());
- Vector secnd(other.getX(), other.getY(), other.getZ());
- double
- dot = VecDot(first, secnd),
- len1 = first.VecLen(),
- len2 = secnd.VecLen(),
- len = len1 * len2,
- angle = 0;
- //printf ("Dot: %f, len1: %f len2: %f\n", dot, len1, len2);
- /*Vector pPos = prevPos - Reference->prevPos;
- Vector pVel = prevVel - Reference->prevVel;*/
+// double GeoCoord::getAngle(const GeoCoord& other) const
+// {
+// Vector first( getX(), getY(), getZ());
+// Vector secnd(other.getX(), other.getY(), other.getZ());
+// double
+// dot = VecDot(first, secnd),
+// len1 = first.VecLen(),
+// len2 = secnd.VecLen(),
+// len = len1 * len2,
+// angle = 0;
+// //printf ("Dot: %f, len1: %f len2: %f\n", dot, len1, len2);
+// /*Vector pPos = prevPos - Reference->prevPos;
+// Vector pVel = prevVel - Reference->prevVel;*/
- if ( ( (dot / len) < 1) && (dot / len > -1) && len )
- angle = acos(dot / len);
- return angle;
-}
+// if ( ( (dot / len) < 1) && (dot / len > -1) && len )
+// angle = acos(dot / len);
+// return angle;
+// }
+
+// GeoCoord* GeoCoordContainer::getNearest(const GeoCoord& ref) const
+// {
+// float angle, maxAngle = 180;
+
+// GeoCoordVectorConstIterator i, nearest;
+// for (i = data.begin(); i != data.end(); i++)
+// {
+// angle = RAD_TO_DEG * (*i)->getAngle(ref);
+// if (angle < maxAngle)
+// {
+// maxAngle = angle;
+// nearest = i;
+// }
+// }
+// return *nearest;
+// }
+
GeoCoord* GeoCoordContainer::getNearest(const GeoCoord& ref) const
{
- float angle, maxAngle = 180;
-
+ sgVec3 first, secnd;
+ float dist, maxDist=SG_MAX;
+ sgSetVec3( first, ref.getX(), ref.getY(), ref.getZ());
GeoCoordVectorConstIterator i, nearest;
for (i = data.begin(); i != data.end(); i++)
{
- angle = RAD_TO_DEG * (*i)->getAngle(ref);
- if (angle < maxAngle)
+ sgSetVec3(secnd, (*i)->getX(), (*i)->getY(), (*i)->getZ());
+ dist = sgDistanceSquaredVec3(first, secnd);
+ if (dist < maxDist)
{
- maxAngle = angle;
+ maxDist = dist;
nearest = i;
}
}
FG_USING_NAMESPACE(std);
-#include "mymath.h"
+#include <simgear/constants.h>
class GeoCoord
{
float getZ() const { return sin(DEG_TO_RAD*lat); };
- double getAngle(const GeoCoord& other) const;
+ //double getAngle(const GeoCoord& other) const;
virtual void print() {} ;
virtual char *getDescription() {return 0;};
};
+++ /dev/null
-/* -*- Mode: C++ -*- *****************************************************
- * mymath.cc
- * Written by Durk Talsma, around 1995/1996.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- **************************************************************************/
-
-/********************************************************************
- * This file defines a simple Vector and Matrix library. These were
- * originally written for my (yet) unpublished planetarium / solar
- * system simulator program. The are included here, because I have
- * experience the code to calculate angles between vectors. I'm sure
- * similar functions exist already somewhere else so I don't mind
- * whether this gets eventually replaced by something more suitable
- * The functions are based on a description in Tyler. A. (1994). C++
- * Real-time 3D graphics. Sigma press, Wilmslow, England.
- *
- * The original versions were written under windows, hence the occasional
- *::MessageBox() statements between conditional compile statements
- *
- ********************************************************************/
-
-
-
-#include "mymath.h"
-
-const double PiOver180 = 1.74532925199433E-002;
-const double Pix4dif3 = 4.1887902;
-
-Vector::Vector(int size)
-{
- build(size);
- for (int i = 0; i < nrData; i++)
- data[i] = 0.00;
-}
-
-double Vector::VecLen()
-{
-
- double length = 0;
- for (int i= 0; i < nrData; i++)
- length += pow(data[i],2);
- return sqrt(length);
-}
-
-
-double VecDot(Vector first, Vector second)
-{
- /*double
- result = ((first.xVal*second.xVal) +
- (first.yVal*second.yVal) +
- (first.zVal*second.zVal));
- return result; */
-
- double result = 0;
- for (int i = 0; i < first.nrData; i++)
- result += first.data[i] * second.data[i];
-
- return result;
-}
-
-Vector VecCross(Vector first, Vector second)
-{
-
- /*return Vec3 ( (first.yVal*second.zVal - first.zVal*second.yVal),
- (first.zVal*second.xVal - first.zVal*second.xVal),
- (first.xVal*second.yVal - first.yVal*second.xVal) );
- */
- #ifdef DEBUG
- if ( (first.nrData != 4) || (first.nrData != second.nrData) )
- {
- ::MessageBox(0, "Attempting to calculate Cross product with 2\n"
- "unequally sized vectors in\n"
- "Vector VecCross(Vector, Vector", "Error",
- MB_OK);
- exit(1);
- }
- #endif
-
- double x = first.data[1] * second.data[2] - first.data[2]*second.data[1];
- double y = first.data[2] * second.data[0] - first.data[0]*second.data[2];
- double z = first.data[0] * second.data[1] - first.data[1]*second.data[0];
- Vector result(x,y,z);
- return result;
-}
-
-
-
-
-Vector operator- (Vector first, Vector second)
-{
- /*return Vec3( first.xVal - second.xVal,
- first.yVal - second.yVal,
- first.zVal - second.zVal );
- */
- #ifdef DEBUG
- if ( first.nrData != second.nrData )
- {
- ::MessageBox(0, "Attempting to subtract 2 \n"
- "unequally sized vectors in\n"
- "Vector operator-(Vector, Vector", "Error",
- MB_OK);
- //exit(1);
- return Vector(0);
- }
- #endif
- double *temp = new double[first.nrData];
- for (int i = 0; i < first.nrData; i++)
- temp[i] = first.data[i] - second.data[i];
- Vector result(first.nrData, temp);
- delete [] temp;
- return result;
-}
-
-
-Vector operator+ (Vector first, Vector second)
-{
- /*return Vec3( first.xVal + second.xVal,
- first.yVal + second.yVal,
- first.zVal + second.zVal );
- */
- #ifdef DEBUG
- if ( first.nrData != second.nrData )
- {
- ::MessageBox(0, "Attempting to add 2\n"
- "unequally sized vectors in\n"
- "Vector operator+(Vector, Vector", "Error",
- MB_OK);
- exit(1);
- }
- #endif
- double *temp = new double[first.nrData];
- for (int i = 0; i < first.nrData; i++)
- temp[i] = first.data[i] + second.data[i];
- Vector result(first.nrData, temp);
- delete [] temp;
- return result;
-}
-
-Vector Vector::operator +=(Vector other)
-{
- #ifdef DEBUG
- if ( first.nrData != second.nrData )
- {
- ::MessageBox(0, "Attempting to add 2\n"
- "unequally sized vectors in\n"
- "Vector operator+(Vector, Vector", "Error",
- MB_OK);
- exit(1);
- }
- #endif
- for (int i = 0; i < nrData; i++)
- data[i] += other.data[i];
- return *this;
-}
-
-Vector Vector::operator -=(Vector other)
-{
- #ifdef DEBUG
- if ( first.nrData != second.nrData )
- {
- ::MessageBox(0, "Attempting to add 2\n"
- "unequally sized vectors in\n"
- "Vector operator+(Vector, Vector", "Error",
- MB_OK);
- exit(1);
- }
- #endif
- for (int i = 0; i < nrData; i++)
- data[i] -= other.data[i];
- return *this;
-}
-
-
-
-
-
-Vector operator* (Matrix mx, Vector vc)
-{
- int sizes[3];
- sizes[0] = vc.nrData;
- sizes[1] = mx.rows;
- sizes[2] = mx.columns;
-
- #ifdef DEBUG
- if ( (sizes[0] != sizes[1]) || (sizes[0] != sizes[2]) )
- {
- char buffer[50];
- sprintf(buffer, "Sizes don't match in function\n"
- "Vector operator*(Matrix, Vector)\n"
- "sizes are: %d, %d, %d", sizes[0], sizes[1],sizes[2]);
- MessageBox(0, buffer, "Error", MB_OK | MB_ICONEXCLAMATION);
- exit(1);
- }
- #endif
- double* result = new double[sizes[0]];
- int col, row;
-
- for (col = 0; col < sizes[0]; col++)
- {
- result[col] = 0;
- for (row = 0; row < sizes[0]; row++)
- result[col] += vc[row] * mx[row][col];
- }
- Vector res(4, result);
-
- /*
- #ifdef DEBUG
- char buffer[200];
- sprintf(buffer, "return value of vector * matrix multiplication is\n"
- "(%f, %f, %f, %f) ", result[0], result[1], result[2], result[3]);
- ::MessageBox(0, buffer, "Information", MB_OK);
- #endif
- */
- delete [] result;
- return res;
-}
-
-Vector operator*(Vector v1, Vector v2)
-{
- int size1 = v1.nrData;
-
- #ifdef DEBUG
-
- int size2 = v2.nrData;
- if(size1 != size2)
- {
- ::MessageBox(0, "Vector sizes don't match in Vector operator*(Vector, Vector)",
- "Error", MB_OK);
- exit(1);
- }
- #endif
- double *tempRes = new double[size1];
- for (int i= 0; i < size1; i++)
- tempRes[i] = v1[i] * v2[i];
- Vector result(size1, tempRes);
- delete tempRes;
- return result;
-}
-
-
-Vector operator*(Vector vec, double d)
-{
- double* tempRes = new double[vec.nrData];
- for (int i = 0; i < vec.nrData; i++)
- tempRes[i] = vec[i] * d;
- Vector result(vec.nrData, tempRes);
- delete tempRes;
- return result;
-}
-
-Vector operator/(Vector vec, double d)
-{
- double* tempRes = new double[vec.nrData];
- for (int i = 0; i < vec.nrData; i++)
- tempRes[i] = vec[i] / d;
- Vector result(vec.nrData, tempRes);
- delete tempRes;
- return result;
-}
-
-ostream& operator << (ostream& os, Vector& vec)
-{
- os << /*setw(4) << */vec.nrData << '\t';
- for (int i = 0; i < vec.nrData; i++)
- os /*<< setw(25) */<< vec[i] << '\t';
- return os;
-}
-
-istream& operator >> (istream& is, Vector& vec)
-{
- is >> vec.nrData;
- if (vec.data)
- delete [] vec.data;
- vec.data = new double[vec.nrData];
- for (int i = 0; i < vec.nrData; i++)
- is >> vec.data[i];
- return is;
-}
-
-ostream& Vector::binSave(ostream& os)
-{
- os.write((char*) &nrData, sizeof(int));
- os.write((char*) data, nrData* sizeof(double));
- return os;
-}
-
-
-
-
-
-
-/******************************************************************************
- Matrix manipulation routines
-******************************************************************************/
-
-Matrix::Matrix(int r, int c, double*dta)
-{
- build(r,c);
- for (int i = 0; i < rows; i++)
- for (int j = 0; j < columns; j++)
- data[i][j] = (*dta++);
-}
-
-Matrix::Matrix(int r, int c, double** dta)
-{
- build(r,c);
- for (int i = 0; i < rows; i++)
- for (int j = 0; j < columns; j++)
- data[i][j] = dta[i][j];
-}
-
-Matrix::Matrix(int r, int c, Vector* dta)
-{
- build(r,c);
- for (int i = 0; i < rows; i++)
- data[i] = dta[i];
-}
-
-Matrix::Matrix(Matrix& other)
-{
- build (other.rows, other.columns);
- for (int i = 0; i< rows; i++)
- (*this)[i] = other[i];
-}
-
-void Matrix::build(int row, int col)
-{
- rows = row;
- columns = col;
-
- data = new Vector [rows];
- for (int i = 0; i < rows; i++)
- data[i].build(col);
-}
-
-Matrix& Matrix::operator =(Matrix& other)
-{
- rows = other.rows;
- columns = other.columns;
- for (int i = 0; i < rows; i++)
- (*this)[i] = other[i];
- return *this;
-}
-
-
-Vector Matrix::operator ()(int col)
-{
- Vector Col(rows);
- for (int i = 0; i < rows; i++)
- Col[i] = data[i][col];
- return Col;
-}
-
-void Matrix::norm(int scale)
-{
- for (int i = 0; i < rows; i++)
- for (int j = 0; j < columns; j++)
- data[i][j] /= scale;
-}
+++ /dev/null
-/* -*- Mode: C++ -*- *****************************************************
- * mymath.h
- * Written by Durk Talsma, around 1995/1996.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- **************************************************************************/
-
-/********************************************************************
- * This file defines a simple Vector and Matrix library. These were
- * originally written for my (yet) unpublished planetarium / solar
- * system simulator program. The are included here, because I have
- * experience the code to calculate angles between vectors. I'm sure
- * similar functions exist already somewhere else so I don't mind
- * whether this gets eventually replaced by something more suitable
- * The functions are based on a description in Tyler. A. (1994). C++
- * Real-time 3D graphics. Sigma press, Wilmslow, England.
- *
- * The original versions were written under windows, hence the occasional
- *::MessageBox() statements between conditional compile statements
- *
- ********************************************************************/
-
-
-#ifndef _MY_MATH_H_
-#define _MY_MATH_H__
-
-#include <simgear/compiler.h>
-
-#include <math.h>
-#include STL_FSTREAM
-#include STL_IOMANIP
-
-FG_USING_NAMESPACE(std);
-
-#include <simgear/constants.h>
-
-extern const double PiOver180;
-extern const double Pix4dif3;
-
-
-
-class Matrix;
-
-class Vector
-{
- private:
- int nrData;
- double* data;
-
- public:
- Vector();
- Vector(int size);
- Vector(int size, double* dta);
- Vector(double x, double y, double z);
- Vector(Vector& other);
- Vector(istream& is);
- ~Vector();
-
- void SetVal(double x, double y, double z);
-
- void build(int);
- Vector* GetVector();
- double GetX();
- double GetY();
- double GetZ();
- void AddX(double x);
- void AddY(double y);
- void AddZ(double z);
- void SubtractX(double x);
- void SubtractY(double y);
- void SubtractZ(double z);
- double VecLen();
- Vector& operator = (Vector&);
- double& operator[] (int);
- int getDim();
-
- ostream& binSave(ostream& os);
-
- Vector operator +=(Vector other);
- Vector operator -=(Vector other);
-
- friend double VecDot(Vector first, Vector second);
- friend Vector VecCross(Vector first, Vector second);
- friend Vector operator-(Vector first, Vector second);
- friend Vector operator+(Vector first, Vector second);
- friend Vector operator*(Matrix mx, Vector vc);
- friend Vector operator*(Vector v1, Vector v2);
- friend Vector operator*(Vector vec, double d);
- friend Vector operator/(Vector vec, double d);
-
- friend ostream& operator << (ostream& os, Vector& vec);
- friend istream& operator >> (istream& is, Vector& vec);
-};
-
-/*-----------------------------------------------------------------------------
- nonmember friend functions
-------------------------------------------------------------------------------*/
-
-double VecDot(Vector first, Vector second);
-Vector VecCross(Vector first, Vector second);
-Vector operator-(Vector first, Vector second);
-Vector operator+(Vector first, Vector second);
-Vector operator*(Matrix mx, Vector vc);
-Vector operator*(Vector v1, Vector v2);
-Vector operator*(Vector vec, double d);
-Vector operator/(Vector vec, double d);
-
-ostream& operator << (ostream& os, Vector& vec);
-istream& operator >> (istream& is, Vector& vec);
-
-
-/*------------------------------------------------------------------------------
- inline member functions
-------------------------------------------------------------------------------*/
-
-inline Vector::Vector()
-{
- nrData = 0;
- data = 0;
-}
-
-inline void Vector::build(int size)
-{
- nrData = size;
- data = new double[nrData];
- #ifdef DEBUG
- if (!data)
- {
- ::MessageBox(0, "Error Allocating Memory for a new Vector", "Error",
- MB_OK);
- exit(1);
- }
- #endif
- //for (int i = 0; i < nrData; i++)
- // data[i] = 0.00;
-}
-
-
-inline Vector::Vector(int size, double* dta)
-{
- build(size);
- memcpy(data, dta, nrData*sizeof(double));
-}
-
-
-inline Vector::Vector(Vector& other)
-{
- build(other.nrData);
- memcpy(data,other.data,nrData*sizeof(double));
-}
-
-inline Vector::Vector(double x, double y, double z)
-{
- build(4); // one extra for matrix multiplication...
- data[0] = x;
- data[1] = y;
- data[2] = z;
- data[3] = 0.00;
-
-}
-
-inline Vector::Vector(istream& is)
-{
- is.read((char*) &nrData, sizeof(int));
- data = new double[nrData];
- is.read((char*) data, nrData * sizeof(double));
-}
-
-inline Vector::~Vector()
-{
- delete [] data;
-}
-
-
-inline void Vector::SetVal(double x, double y, double z)
-{
- #ifdef DEBUG
- if (nrData != 4)
- {
- ::MessageBox(0, "Attempt to assign data to a vector\n"
- "With size unequal to 4 in function\n"
- " Vector::Setval(double, double, double", "Error" , MB_OK);
- exit(1);
- }
- #endif
- data[0] = x,
- data[1] = y;
- data[2] = z;
- data[3] = 0.00;
-}
-
-inline Vector* Vector::GetVector()
-{
- return this;
-}
-
-inline double Vector::GetX()
-{
- #ifdef DEBUG
- if (nrData < 1)
- {
- ::MessageBox(0, "Attempt to retrieve x-value of a vector\n"
- "With size smaller than 1 in function\n"
- " Vector::GetX();", "Error", MB_OK);
- exit(1);
- }
- #endif
- return data[0];
-}
-
-inline double Vector::GetY()
-{
- #ifdef DEBUG
- if (nrData < 2)
- {
- ::MessageBox(0, "Attempt to retrieve the y value of a vector\n"
- "With size smaller than 2 in function\n"
- " Vector::GetY();", "Error", MB_OK);
- exit(1);
- }
- #endif
- return data[1];
-}
-
-inline double Vector::GetZ()
-{
- #ifdef DEBUG
- if (nrData < 3)
- {
- ::MessageBox(0, "Attempt to retrieve the z value of a vector\n"
- "With size smaller than 2 in function\n"
- " Vector::GetZ();", "Error", MB_OK);
- exit(1);
- }
- #endif
- return data[2];
-}
-
-inline void Vector::AddX(double x)
-{
- #ifdef DEBUG
- if (nrData < 1)
- {
- ::MessageBox(0, "Attempt to chance x-value to a vector\n"
- "With size smaller than 1 in function\n"
- " Vector::AddX(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[0] += x;
-}
-
-inline void Vector::AddY(double y)
-{
- #ifdef DEBUG
- if (nrData < 2)
- {
- ::MessageBox(0, "Attempt to chance y-value to a vector\n"
- "With size smaller than 2 in function\n"
- " Vector::AddY(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[1] += y;
-}
-
-inline void Vector::AddZ(double z)
-{
- #ifdef DEBUG
- if (nrData < 3)
- {
- ::MessageBox(0, "Attempt to chance z-value to a vector\n"
- "With size smaller than 3 in function\n"
- " Vector::AddZ(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[2] += z;
-}
-
-inline void Vector::SubtractX(double x)
-{
- #ifdef DEBUG
- if (nrData < 1)
- {
- ::MessageBox(0, "Attempt to chance x-value to a vector\n"
- "With size smaller than 1 in function\n"
- " Vector::SubtractX(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[0] -= x;
-}
-
-inline void Vector::SubtractY(double y)
-{
- #ifdef DEBUG
- if (nrData < 2)
- {
- ::MessageBox(0, "Attempt to chance y-value to a vector\n"
- "With size smaller than 2 in function\n"
- " Vector::SubractY(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[1] -= y;
-}
-
-inline void Vector::SubtractZ(double z)
-{
- #ifdef DEBUG
- if (nrData < 3)
- {
- ::MessageBox(0, "Attempt to chance z-value to a vector\n"
- "With size smaller than 3 in function\n"
- " Vector::SubtractZ(double);", "Error", MB_OK);
- exit(1);
- }
- #endif
- data[2] -= z;
-}
-
-
-inline Vector& Vector::operator= (Vector& other)
-{
- if (data)
- delete[] data;
- build(other.nrData);
- memcpy(data, other.data, nrData*sizeof(double));
- return *this;
-}
-
-inline double& Vector::operator [](int index)
-{
- return *(data+index);
-}
-
-
-inline int Vector::getDim()
-{
- return nrData;
-}
-
-/*-----------------------------------------------------------------------------
- Some generic conversion routines
-------------------------------------------------------------------------------*/
-
-float CosD(float angle);
-float SinD(float angle);
-float Radians(float angle);
-int Round(float value);
-
-/* ----------------------------------------------------------------------------
- And their inlined implementation
-------------------------------------------------------------------------------*/
-
-inline float CosD(float angle)
-{
- return cos(Radians(angle));
-}
-
-inline float SinD(float angle)
-{
- return(Radians(angle));
-}
-
-
-inline float Radians(float angle)
-{
- return (angle*PiOver180);
-}
-
-inline int Round(float value)
-{
- return ( (int) (value+0.5));
-}
-
-
-
-/******************************************************************************
-
- Matrix class
-
-******************************************************************************/
-
-class Matrix
-{
- protected:
- int rows;
- int columns;
- Vector* data;
-
- public:
-
- Matrix();
- Matrix(int r, int c);
- Matrix(int r, int c, double* dta);
- Matrix(int r, int c, double** dta);
- Matrix(int r, int c, Vector*dta);
- Matrix(Matrix&);
- ~Matrix();
-
- void build(int r, int c);
- Matrix& operator=(Matrix&);
- Vector& operator[](int);
- Vector operator ()(int);
-
- int getrows();
- int getcols();
- void norm(int scal);
-
- friend Vector operator*(Matrix mc, Vector vc);
-};
-
-/*------------------------------------------------------------------------------
- inline Matrix routines
-------------------------------------------------------------------------------*/
-
-inline Matrix::Matrix()
-{
- rows = 0;
- columns = 0;
- data = 0;
-}
-
-inline Matrix::Matrix(int r, int c)
-{
- build(r, c);
-}
-
-inline Matrix::~Matrix()
-{
- delete [] data;
-}
-
-
-inline Vector& Matrix::operator[] (int row)
-{
- return data[row];
-}
-
-
-#endif // _MYMATH_H_
-
-