00001 //$Header: /home/ben/Mapper/include/RCS/bearing_constraint.h,v 6.4 2002/07/02 19:45:15 ben Exp $
00002 #ifndef BEARING_CONSTRAINT_H
00003 #define BEARING_CONSTRAINT_H
00004 // Copyright Benedict Adamson 2002.
00005 // This file is part of Mapper.
00006
00007 // Mapper is free software; you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation; either version 2 of the License, or
00010 // (at your option) any later version.
00011
00012 // Mapper 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
00015 // GNU General Public License for more details.
00016
00017 // You should have received a copy of the GNU General Public License
00018 // along with Mapper; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
00020
00031 #include "assoc.h"
00032 #include "constraint.h"
00033
00034
00035
00040 class bearing_constraint
00041 :public constraint
00042 {
00043 public: //Constructors and destructors.
00044
00057 bearing_constraint(
00058 const double u,
00059 const double b
00060 );
00061
00062 virtual ~bearing_constraint(void);
00063
00064 public: // Attributes
00065
00096 virtual void energy(
00097 const double tol,
00098 const vector< vector2 > &p,
00099 double &e, // output
00100 vector< vector2 > &dedp // output
00101 ) const;
00102
00114 inline double wanted_bearing(void) const;
00115
00116 public: // Messages
00117
00133 void wanted_bearing(
00134 const double b
00135 );
00136
00137 private: // State
00138
00139 double wanted_bearing_;
00140
00141 friend void assoc(
00142 bearing_constraint &c,
00143 vector2 &p0,
00144 vector2 &p1
00145 );
00146
00147 friend void unassoc(
00148 bearing_constraint &c
00149 );
00150
00151 };
00152
00153
00154
00155 inline double bearing_constraint::wanted_bearing(void) const
00156 {
00157 // The expected separation of the two constrained points.
00158 return this->wanted_bearing_;
00159 }
00160
00161
00162
00163 #endif