Triangle.h

Go to the documentation of this file.
00001 /*
00002 **    Mesh Converter
00003 **    Copyright (C) 2008 Damien Rohmer
00004 **
00005 **    This program is free software: you can redistribute it and/or modify
00006 **    it under the terms of the GNU General Public License as published by
00007 **    the Free Software Foundation, either version 3 of the License, or
00008 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 
00021 /*
00022 ** Triangle.h
00023 ** 
00024 ** Made by damien
00025 ** Login   <damien@ortie>
00026 ** 
00027 ** Started on  Sun Jul  6 12:35:08 2008 damien
00028 ** Last update Sun Jul  6 12:35:08 2008 damien
00029 */
00030 
00031 
00032 
00033 #ifndef         TRIANGLE_H_
00034 # define        TRIANGLE_H_
00035 
00036 #include <V_3D.h>
00037 #include <Segment.h>
00038 
00039 #include <vector>
00040 using namespace std;
00041 
00042 
00044 
00047 class Triangle
00048 {
00049 public:
00050 
00051   //*********************************************//
00052   // CONSTRUCTORS
00053   //*********************************************//
00054   
00056   Triangle();
00058   Triangle(const V_3D& x0,const V_3D& x1,const V_3D& x2);
00060   Triangle(const Triangle& t);
00062   ~Triangle();
00063 
00064   //*********************************************//
00065   // Manipulation
00066   //*********************************************//
00067   
00069   int destroy();
00070 
00072   V_3D normal() const;
00073 
00075   double area() const;
00076   
00078 
00079   Segment get_segment(int k_edge) const;
00080 
00081 
00082   //*********************************************//
00083   // Informations
00084   //*********************************************//
00085 
00087 
00089   int barycentric_coordinates(const V_3D& x,double *alpha,double *beta,double *gamma) const;
00090 
00092   int is_vertex_inside(const V_3D _x) const;
00093 
00094 
00096 
00104   V_3D closest_point(const V_3D& x,int *type) const;
00105 
00107 
00114   std::vector <V_3D> plane_intersection(const V_3D& n,const V_3D& x0,int *type) const;
00116 
00117   std::vector <V_3D> plane_intersection(const V_3D& n,const V_3D& x0,int *type,int *type_edge_0,int *type_edge_1,int *type_edge_2) const;
00118 
00119   //*********************************************//
00120   // Operators
00121   //*********************************************//
00122 
00124   V_3D  operator()(int index) const;
00126   V_3D& operator()(int index);
00128   V_3D  operator[](int index) const;
00130   V_3D  operator[](int index);
00131 
00133   Triangle& operator=(const Triangle& t);
00134 
00135 
00136 private:
00137   
00138   V_3D x[3];
00139 
00140 
00141 };
00142 
00143 #endif      /* !TRIANGLE_H_ */

Generated on Mon Mar 30 16:55:54 2009 by  doxygen 1.5.6