Segment.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 ** Segment.h
00022 ** 
00023 ** Made by damien
00024 ** Login   <damien@ortie>
00025 ** 
00026 ** Started on  Fri Jul  4 22:07:03 2008 damien
00027 ** Last update Fri Jul  4 22:07:03 2008 damien
00028 */
00029 
00030 #ifndef         SEGMENT_H_
00031 # define        SEGMENT_H_
00032 
00033 #include <V_3D.h>
00034 
00036 
00038 class Segment
00039 {
00040 public:
00041 
00042   //*********************************************//
00043   // CONSTRUCTORS
00044   //*********************************************//
00045 
00047   Segment();
00049   Segment(const V_3D& start_point,const V_3D& end_point);
00051   Segment(const Segment& s);
00052 
00054   ~Segment();
00055 
00056 
00057 
00058   //*********************************************//
00059   // Manipulation
00060   //*********************************************//
00061 
00063   int set(const V_3D x0,const V_3D x1);
00065   const V_3D& get_start() const;
00067   const V_3D& get_last() const;
00068 
00070   V_3D unit_vector() const;
00071 
00073   int flip();
00074 
00075 
00076 
00078   int destroy();
00079 
00080 
00081   //*********************************************//
00082   // Informations
00083   //*********************************************//
00084 
00086   double length() const;
00087 
00089   V_3D closest_point(const V_3D& x) const;
00090 
00092   double distance_to_point(const V_3D& x) const;
00093 
00095 
00102   Segment closest_to_segment(const Segment& s) const;
00103 
00105 
00106   double distance_to_segment(const Segment& s) const;
00107 
00109 
00117   V_3D plane_intersection(const V_3D& n,const V_3D& x0,int *type) const;
00118 
00119 
00120   //*********************************************//
00121   // Operators
00122   //*********************************************//
00123 
00125   V_3D  operator()(int index) const;
00127   V_3D& operator()(int index);
00129   V_3D  operator[](int index) const;
00131   V_3D  operator[](int index);
00132 
00134   friend ostream& operator << (ostream& flux, const Segment& s);
00135   
00136 private:
00137 
00139   V_3D x0,x1;
00140 
00141 };
00142 
00143 
00144 #endif      /* !SEGMENT_H_ */

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