contrib/gel/pop/pop_edge.cxx

Go to the documentation of this file.
00001 // This is gel/pop/pop_edge.cxx
00002 #include "pop_edge.h"
00003 //:
00004 // \file
00005 #include <pop/pop_transform.h>
00006 #include <pop/pop_vertex.h>
00007 
00008 //: constructor
00009 pop_edge::pop_edge()
00010 {
00011   v1_ = 0;
00012   v2_ = 0;
00013   transform_ = 0;
00014 }
00015 
00016 
00017 //: destructor
00018 pop_edge::~pop_edge()
00019 {
00020 }
00021 
00022 
00023 //: set the first and second vertex
00024 void pop_edge::set_vertex(pop_vertex *v1, pop_vertex *v2)
00025 {
00026   v1_ = v1;
00027   v2_ = v2;
00028   v1_->add_edge(this);
00029 }
00030 
00031 
00032 //: set the transform
00033 void pop_edge::set_transform(pop_transform *t)
00034 {
00035   transform_ = t;
00036 }
00037 
00038 
00039 //: get the transform
00040 pop_transform* pop_edge::get_transform()
00041 {
00042   return transform_;
00043 }
00044 
00045 
00046 //: help search to find a destination vertex
00047 bool pop_edge::search(pop_vertex* destination, vcl_list<pop_edge*> &path)
00048 {
00049   if (v2_==destination) {
00050     // the path is complete
00051     path.push_front(this);
00052     return true;
00053   }
00054   // we must push ahead and see if v2 leads to path;
00055   if (v2_->search(destination,path)) {
00056     // add this node to the path
00057     path.push_front(this);
00058     return true;
00059   }
00060   // it appears that this edge does not lead to the destination
00061   return false;
00062 }
00063 

Generated on Sun Sep 7 05:15:06 2008 for contrib/gel/pop by  doxygen 1.5.1