moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kig / objects / curve_imp.h
blob64f2a320440c1e14b9f3dfcecb2be785f9fa546a
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
16 // 02111-1307, USA.
18 #ifndef KIG_OBJECTS_CURVE_IMP_H
19 #define KIG_OBJECTS_CURVE_IMP_H
21 #include "object_imp.h"
23 /**
24 * This class represents a curve: something which is composed of
25 * points, like a line, a circle, a locus...
27 class CurveImp
28 : public ObjectImp
30 public:
31 typedef ObjectImp Parent;
33 /**
34 * Returns the ObjectImpType representing the CurveImp type.
36 static const ObjectImpType* stype();
38 Coordinate attachPoint() const;
40 // param is between 0 and 1. Note that 0 and 1 should be the
41 // end-points. E.g. for a Line, getPoint(0) returns a more or less
42 // infinite point. getPoint(0.5) should return the point in the
43 // middle.
44 virtual double getParam( const Coordinate& point, const KigDocument& ) const = 0;
45 // this should be the inverse function of getPoint().
46 // Note that it should also do something reasonable when p is not on
47 // the curve. You can return an invalid Coordinate(
48 // Coordinate::invalidCoord() ) if you need to in some cases.
49 virtual const Coordinate getPoint( double param, const KigDocument& ) const = 0;
51 virtual CurveImp* copy() const = 0;
53 /**
54 * Return whether this Curve contains the given point. This is
55 * implemented as a numerical approximation. Implementations
56 * can/should use the value test_threshold in common.h as a
57 * threshold value.
59 virtual bool containsPoint( const Coordinate& p, const KigDocument& ) const = 0;
62 #endif