Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Line.cpp

Go to the documentation of this file.
00001 
00002 /*
00003     TEDDY - General graphics application library
00004     Copyright (C) 1999-2002  Timo Suoranta
00005     tksuoran@cc.helsinki.fi
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2.1 of the License, or (at your option) any later version.
00011 
00012     This library 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 GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021     $Id: Line.cpp,v 1.4 2002/01/11 14:35:02 tksuoran Exp $
00022 */
00023 
00024 
00025 #include "Teddy/Models/Line.h"
00026 #include "Teddy/Models/Vertex.h"
00027 
00028 
00029 namespace Teddy  {
00030 namespace Models {
00031 
00032 
00034 Line::Line( Vertex *v1, Vertex * v2 ){
00035     start_point = v1;
00036     end_point   = v2;
00037 }
00038 
00039 
00041 Line::Line( const Line &l ){
00042     start_point = l.start_point;
00043     end_point   = l.end_point;
00044 //  state       = 0;
00045 }
00046 
00047 
00051 void Line::draw( Projection *p ){
00052     start_point->draw( p );
00053     end_point  ->draw( p );
00054 }
00055 
00056 
00058 //void Line::debug(){
00059 //  printf( "(" );
00060 //  start_point->debug(); printf( ") - (" );
00061 //  end_point->debug(); printf( ")" );
00062 //}
00063 
00064 
00066 void Line::swap(){
00067     Vertex *old_start = start_point;
00068     start_point = end_point;
00069     end_point   = old_start;
00070 }
00071 
00072 
00077 bool Line::operator==( const Line &l ) const {
00078     if( (start_point==l.start_point &&
00079          end_point  ==l.end_point      ) ||
00080         (start_point==l.end_point   &&
00081          end_point  ==l.start_point    )    )
00082     {
00083         return true;
00084     }else{
00085         return false;
00086     }
00087 }
00088 
00089 
00091 bool Line::operator!=( const Line &l ) const {
00092     if( (start_point==l.start_point &&
00093          end_point  ==l.end_point      ) ||
00094         (start_point==l.end_point   &&
00095          end_point  ==l.start_point    )    )
00096     {
00097         return false;
00098     }else{
00099         return true;
00100     }
00101 }
00102 
00103 
00104 };  //  namespace Models
00105 };  //  namespace Teddy
00106