00001 /* 00002 * lib-spamod : Visualisation des objets en discret. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-spamod 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 /****************************************************************************** 00025 * Fichier : Voxel.h * 00026 * Auteur : DEXET Martine * 00027 *----------------------------------------------------------------------------* 00028 * Ce fichier contient la spécification de la classe Voxel. Cette classe * 00029 * permet de représenter ce centre d'un voxel à l'aide de trois coordonnées * 00030 * entières. * 00031 * * 00032 *****************************************************************************/ 00033 00034 00035 #ifndef VOXEL_H 00036 #define VOXEL_H 00037 00038 00039 00040 /****************************************************************************** 00041 * Classe Voxel * 00042 *****************************************************************************/ 00043 00044 class Voxel { 00045 00046 public: 00047 00048 // Constructeurs. 00049 Voxel(); 00050 Voxel(int alpha, int b, int c); 00051 00052 // Méthodes permettant la lecture des coordonnées. 00053 int Get_X() const; 00054 int Get_Y() const; 00055 int Get_Z() const; 00056 00057 // Méthode permettant l'écriture des coordonnées. 00058 void Set_XYZ(int alpha, int b, int c); 00059 00060 // Opérateur de transfert <<. 00061 friend std::ostream & operator<<(std::ostream & s,Voxel * v); 00062 00063 00064 private: 00065 00066 // Variables représentant les coordonnées du centre du voxel. 00067 int x, y, z; 00068 }; 00069 00070 /****************************************************************************** 00071 * Fichier : Voxel.inl * 00072 * Auteur : DEXET Martine * 00073 *----------------------------------------------------------------------------* 00074 * Ce fichier contient l'implémentation des méthodes de la classe Voxel * 00075 * * 00076 *****************************************************************************/ 00077 00078 00079 // Constructeurs. 00080 inline 00081 Voxel::Voxel() 00082 :x(0), y(0), z(0) 00083 {} 00084 00085 inline 00086 Voxel::Voxel(int alpha, int b, int c) 00087 :x(alpha), y(b), z(c) 00088 {} 00089 00090 00091 // Méthodes permettant la lecture des coordonnées. 00092 inline 00093 int Voxel::Get_X() const 00094 { 00095 return x; 00096 } 00097 00098 inline 00099 int Voxel::Get_Y() const 00100 { 00101 return y; 00102 } 00103 00104 inline 00105 int Voxel::Get_Z() const 00106 { 00107 return z; 00108 } 00109 00110 00111 // Méthode permettant l'écriture des coordonnées. 00112 inline 00113 void Voxel::Set_XYZ(int alpha, int b, int c) 00114 { 00115 x = alpha; 00116 y = b; 00117 z = c; 00118 } 00119 00120 00121 // Opérateur de transfert <<. 00122 inline 00123 std::ostream & operator<<(std::ostream & s,Voxel * v) 00124 { 00125 s << v->Get_X() << " " << v->Get_Y() << " " << v->Get_Z() << std::endl; 00126 return s; 00127 } 00128 00129 #endif