00001 // -*- C++ -*- 00002 // 00003 // This file is part of libgvectors. 00004 // libgvectors is a C++ library intended for visualizing mathematical vectors. 00005 // Copyright (C) 2007 Rafael Ostertag 00006 // 00007 // This program is free software; you can redistribute it and/or 00008 // modify it under the terms of the GNU General Public License 00009 // as published by the Free Software Foundation; either version 2 00010 // of the License, or (at your option) any later version. 00011 // 00012 // This program is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 // GNU General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU General Public License 00018 // along with this program; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00020 // USA. 00021 // 00022 // $Id: coordinates_8h-source.html,v 1.1 2007-09-08 19:02:31 rafi Exp $ 00023 // 00024 // File: coordinates.h 00025 // Author: Rafael Ostertag 00026 // 00027 // Created on July 1, 2007, 5:01 PM 00028 // 00029 00040 #ifndef _COORDINATES_H 00041 #define _COORDINATES_H 00042 00043 namespace GVectors { 00044 00051 class Coordinates { 00052 protected: 00058 double x_ord; 00059 00065 double y_ord; 00066 00067 public: 00069 Coordinates(); 00071 Coordinates(double x, double y); 00073 virtual ~Coordinates(); 00075 Coordinates(const Coordinates &c); 00076 00078 void X(double x); 00080 void setX(double x); 00082 void Y(double y); 00084 void setY(double y); 00086 void set(double x, double y); 00087 00089 double X() const; 00091 double getX() const; 00093 double Y() const; 00095 double getY() const; 00097 void get(double &x, double &y) const; 00098 00100 const Coordinates &operator=(const Coordinates &c); 00102 bool operator==(const Coordinates &c) const; 00104 bool operator!=(const Coordinates &c) const; 00105 00107 double operator[](unsigned int i) const; 00109 Coordinates operator+(const Coordinates &c) const; 00111 Coordinates operator-(const Coordinates &c) const; 00113 Coordinates operator*(double d) const; 00115 double operator*(const Coordinates &c) const; 00117 Coordinates operator/(double d) const; 00118 00120 const Coordinates& operator+=(const Coordinates &c); 00122 const Coordinates& operator-=(const Coordinates &c); 00123 00124 }; 00130 typedef Coordinates* co_ptr_t; 00136 typedef Coordinates& co_ref_t; 00142 typedef const Coordinates* const_co_ptr_t; 00148 typedef const Coordinates& const_co_ref_t; 00149 } 00150 00151 #endif /* _COORDINATES_H */
1.4.7