00001 //$Header: /home/ben/Mapper/include/RCS/angle_constraint.h,v 6.5 2002/07/02 19:45:34 ben Exp $
00002 #ifndef ANGLE_CONSTRAINT_H
00003 #define ANGLE_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 angle_constraint
00041 :public constraint
00042 {
00043 public: //Constructors and destructors.
00044
00062 angle_constraint(
00063 const double u,
00064 const double a
00065 );
00066
00067 virtual ~angle_constraint(void);
00068
00069 public: //Attributes
00070
00101 virtual void energy(
00102 const double tol,
00103 const vector< vector2 > &p,
00104 double &e, //output
00105 vector< vector2 > &dedp //output
00106 ) const;
00107
00121 inline double wanted_angle(void) const;
00122
00123 public: //Messages
00124
00140 void wanted_angle(
00141 const double a
00142 );
00143
00144 private: //State
00145
00146 double wanted_angle_;
00147
00148 friend void assoc(
00149 angle_constraint &c,
00150 vector2 &p0,
00151 vector2 &p1,
00152 vector2 &p2
00153 );
00154
00155 friend void unassoc(
00156 angle_constraint &c
00157 );
00158
00159 };
00160
00161
00162
00163 inline double angle_constraint::wanted_angle(void) const
00164 {
00165 //The expected separation of the two constrained points.
00166 return this->wanted_angle_;
00167 }
00168
00169
00170
00171 #endif