22 #ifndef KIG_MISC_COMMON_H
23 #define KIG_MISC_COMMON_H
25 #include "coordinate.h"
36 extern const double double_inf;
43 double getDoubleFromUser(
const TQString& caption,
const TQString& label,
double value,
44 TQWidget* parent,
bool* ok,
double min,
double max,
int decimals );
76 double length()
const {
return (
b -
a ).length(); }
154 const double sa,
const double angle,
167 double calcDistancePointLine(
const Coordinate& p,
178 void calcBorderPoints(
double& xa,
double& xb,
double& ya,
double& yb,
const Rect& r);
199 void calcRayBorderPoints(
const double xa,
const double xb,
double& ya,
200 double& yb,
const Rect& r );
218 bool isSingular(
const double& a,
const double& b,
219 const double& c,
const double& d );
240 const double sa,
const double a,
const double fault );
244 double sqra,
double sqrb );
252 const int width,
const ObjectImp* imp,
const KigWidget& w );
254 template <
typename T>
255 T kigMin(
const T& a,
const T& b )
257 return a < b ? a : b;
260 template <
typename T>
261 T kigMax(
const T& a,
const T& b )
263 return a > b ? a : b;
266 template <
typename T>
267 T kigAbs(
const T& a )
269 return a >= 0 ? a : -a;
272 template <
typename T>
273 int kigSgn(
const T& a )
275 return a == 0 ? 0 : a > 0 ? +1 : -1;
278 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:49
Coordinate b
Another point on the line.
Definition: common.h:68
const Coordinate dir() const
The direction of the line.
Definition: common.h:72
LineData(const Coordinate &na, const Coordinate &nb)
Constructor.
Definition: common.h:60
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:64
double length() const
The length from a to b.
Definition: common.h:76
bool isParallelTo(const LineData &l) const
Return true if this line is parallel to l.