//$Header: /home/ben/Mapper/include/RCS/constraint.h,v 6.4 2002/06/10 22:16:16 ben Exp $
#ifndef CONSTRAINT_H
#define CONSTRAINT_H
// Copyright Benedict Adamson 2002.
// This file is part of Mapper.
// Mapper is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// Mapper is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Mapper; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include <vector>
#include "vector2.h"
class constraint
{
public: //Constructors and destructors.
constraint(
const double u
);
virtual ~constraint(void);
public: //Attributes
double energy(
const double tol
) const;
virtual void energy(
const double tol,
const vector< vector2 > &p,
double &e, //output
vector< vector2 > &dedp //output
) const = 0;
inline double uncertainty(void) const;
public: //Relationships
inline vector< vector2 * > &points(void);
inline const vector< vector2 * > &points(void) const;
public: //Messages
void uncertainty(
const double u
);
private: //State
double uncertainty_;
protected: //State
vector< vector2 * > points_;
};
inline double constraint::uncertainty(void) const
{
//A measure of how loose the constraint is.
return this->uncertainty_;
}
inline vector< vector2 * > &constraint::points(void)
{
//The points whose position the constraint directly applies to.
//Moving these points can change the energy of the constraint;
//Moving anyother points never changes the ernegy of the constraint.
return this->points_;
}
inline const vector< vector2 * > &constraint::points(void) const
{
//The points whose position the constraint directly applies to.
//Moving these points can change the energy of the constraint;
//Moving anyother points never changes the ernegy of the constraint.
return this->points_;
}
#endif