Logo
  • Main Page
  • Related Pages
  • Modules
  • Classes
  • Files

mmsftvertex.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2007 Stefan Schwarzer, Jens Schneider,             *
00003  *                           Matthias Hardt, Guido Madaus                  *
00004  *                                                                         *
00005  *   Copyright (C) 2007-2008 BerLinux Solutions GbR                        *
00006  *                           Stefan Schwarzer & Guido Madaus               *
00007  *                                                                         *
00008  *   Copyright (C) 2009-2011 BerLinux Solutions GmbH                       *
00009  *                                                                         *
00010  *   Authors:                                                              *
00011  *      Stefan Schwarzer   <stefan.schwarzer@diskohq.org>,                 *
00012  *      Matthias Hardt     <matthias.hardt@diskohq.org>,                   *
00013  *      Jens Schneider     <jens.schneider@diskohq.org>,                   *
00014  *      Guido Madaus       <guido.madaus@diskohq.org>,                     *
00015  *      Patrick Helterhoff <patrick.helterhoff@diskohq.org>,               *
00016  *      René Bählkow       <rene.baehlkow@diskohq.org>                     *
00017  *                                                                         *
00018  *   This library is free software; you can redistribute it and/or         *
00019  *   modify it under the terms of the GNU Lesser General Public            *
00020  *   License version 2.1 as published by the Free Software Foundation.     *
00021  *                                                                         *
00022  *   This library is distributed in the hope that it will be useful,       *
00023  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00024  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00025  *   Lesser General Public License for more details.                       *
00026  *                                                                         *
00027  *   You should have received a copy of the GNU Lesser General Public      *
00028  *   License along with this library; if not, write to the                 *
00029  *   Free Software Foundation, Inc.,                                       *
00030  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
00031  **************************************************************************/
00032 
00033 #ifndef MMSFTVERTEX_H_
00034 #define MMSFTVERTEX_H_
00035 
00036 #include <list>
00037 #include <vector>
00038 
00039 #include <ft2build.h>
00040 #include FT_GLYPH_H
00041 
00042 //! describes a vertex including operators
00043 class MMSFTVertex {
00044     private:
00045         double values[3];
00046 
00047     public:
00048         inline MMSFTVertex() {
00049             values[0] = values[1] = values[2] = 0;
00050         }
00051 
00052         inline MMSFTVertex(const double x, const double y, const double z = 0) {
00053             values[0] = x;
00054             values[1] = y;
00055             values[2] = z;
00056         }
00057 
00058         inline MMSFTVertex(const FT_Vector &ft_vector) {
00059             values[0] = ft_vector.x;
00060             values[1] = ft_vector.y;
00061             values[2] = 0;
00062         }
00063 
00064         MMSFTVertex Normalise();
00065 
00066         inline MMSFTVertex& operator += (const MMSFTVertex &point) {
00067             values[0] += point.values[0];
00068             values[1] += point.values[1];
00069             values[2] += point.values[2];
00070             return *this;
00071         }
00072 
00073         inline MMSFTVertex operator + (const MMSFTVertex &point) const {
00074             MMSFTVertex temp;
00075             temp.values[0] = values[0] + point.values[0];
00076             temp.values[1] = values[1] + point.values[1];
00077             temp.values[2] = values[2] + point.values[2];
00078             return temp;
00079         }
00080 
00081         inline MMSFTVertex& operator -= (const MMSFTVertex &point) {
00082             values[0] -= point.values[0];
00083             values[1] -= point.values[1];
00084             values[2] -= point.values[2];
00085             return *this;
00086         }
00087 
00088         inline MMSFTVertex operator - (const MMSFTVertex &point) const {
00089             MMSFTVertex temp;
00090             temp.values[0] = values[0] - point.values[0];
00091             temp.values[1] = values[1] - point.values[1];
00092             temp.values[2] = values[2] - point.values[2];
00093             return temp;
00094         }
00095 
00096         inline MMSFTVertex operator * (double multiplier) const {
00097             MMSFTVertex temp;
00098             temp.values[0] = values[0] * multiplier;
00099             temp.values[1] = values[1] * multiplier;
00100             temp.values[2] = values[2] * multiplier;
00101             return temp;
00102         }
00103 
00104         inline friend MMSFTVertex operator * (double multiplier, MMSFTVertex &point) {
00105             return point * multiplier;
00106         }
00107 
00108         inline friend double operator * (MMSFTVertex &a, MMSFTVertex &b) {
00109             return a.values[0] * b.values[0]
00110                  + a.values[1] * b.values[1]
00111                  + a.values[2] * b.values[2];
00112         }
00113 
00114         inline MMSFTVertex operator ^ (const MMSFTVertex &point) {
00115             MMSFTVertex temp;
00116             temp.values[0] = values[1] * point.values[2]
00117                               - values[2] * point.values[1];
00118             temp.values[1] = values[2] * point.values[0]
00119                               - values[0] * point.values[2];
00120             temp.values[2] = values[0] * point.values[1]
00121                               - values[1] * point.values[0];
00122             return temp;
00123         }
00124 
00125 
00126         inline operator const double*() const {
00127             return values;
00128         }
00129 
00130         inline void X(double x) { values[0] = x; };
00131         inline void Y(double y) { values[1] = y; };
00132         inline void Z(double z) { values[2] = z; };
00133 
00134         inline double X() const { return values[0]; };
00135         inline double Y() const { return values[1]; };
00136         inline double Z() const { return values[2]; };
00137 };
00138 
00139 typedef std::list<MMSFTVertex> MMSFTVertexList;
00140 typedef std::vector<MMSFTVertex> MMSFTVertexVector;
00141 
00142 #endif /* MMSFTVERTEX_H_ */

Generated by doxygen