22 #ifndef KIG_MISC_COMMON_H
23 #define KIG_MISC_COMMON_H
25 #include "coordinate.h"
29 #include <tdeversion.h>
35 #if KDE_IS_VERSION( 3, 1, 0 )
36 #define KIG_USE_KDOUBLEVALIDATOR
38 #undef KIG_USE_KDOUBLEVALIDATOR
41 #undef KIG_USE_KDOUBLEVALIDATOR
47 extern const double double_inf;
54 double getDoubleFromUser(
const TQString& caption,
const TQString& label,
double value,
55 TQWidget* parent,
bool* ok,
double min,
double max,
int decimals );
87 double length()
const {
return (
b -
a ).length(); }
165 const double sa,
const double angle,
178 double calcDistancePointLine(
const Coordinate& p,
189 void calcBorderPoints(
double& xa,
double& xb,
double& ya,
double& yb,
const Rect& r);
210 void calcRayBorderPoints(
const double xa,
const double xb,
double& ya,
211 double& yb,
const Rect& r );
229 bool isSingular(
const double& a,
const double& b,
230 const double& c,
const double& d );
251 const double sa,
const double a,
const double fault );
255 double sqra,
double sqrb );
263 const int width,
const ObjectImp* imp,
const KigWidget& w );
265 template <
typename T>
266 T kigMin(
const T& a,
const T& b )
268 return a < b ? a : b;
271 template <
typename T>
272 T kigMax(
const T& a,
const T& b )
274 return a > b ? a : b;
277 template <
typename T>
278 T kigAbs(
const T& a )
280 return a >= 0 ? a : -a;
283 template <
typename T>
284 int kigSgn(
const T& a )
286 return a == 0 ? 0 : a > 0 ? +1 : -1;
289 extern const double test_threshold;
The Coordinate class is the basic class representing a 2D location by its x and y components.
Definition: coordinate.h:34
Simple class representing a line.
Definition: common.h:60
Coordinate b
Another point on the line.
Definition: common.h:79
const Coordinate dir() const
The direction of the line.
Definition: common.h:83
LineData(const Coordinate &na, const Coordinate &nb)
Constructor.
Definition: common.h:71
bool isOrthogonalTo(const LineData &l) const
Return true if this line is orthogonal to l.
Coordinate a
One point on the line.
Definition: common.h:75
double length() const
The length from a to b.
Definition: common.h:87
bool isParallelTo(const LineData &l) const
Return true if this line is parallel to l.