1 #ifndef linerectangleclipper_h 2 #define linerectangleclipper_h 33 inline bool isIntersecting()
const;
34 inline bool isStartChanged()
const;
35 inline bool isStopChanged()
const;
40 inline const T castDouble2T(
double)
const;
52 template <
class T>
inline 63 for (
int idx=1; idx<polyline.size(); idx++ )
65 clipper.
setLine( polyline[idx-1], polyline[idx] );
78 result += currentline;
79 (*currentline) += clipper.
getStart();
82 (*currentline) += clipper.
getStop();
89 template <
class T>
inline 92 , isintersecting_( true )
93 , startchanged_( false )
94 , stopchanged_( false )
100 template <
class T>
inline 105 return fabs(d-t1) < fabs(d-t2) ? t1 : t2;
109 #define mBoundaryClip( delta, offset ) \ 113 double tnew = (double) (offset) / (delta); \ 116 if ( tnew > tstop ) return; \ 117 if ( tnew > tstart ) tstart = tnew; \ 121 if ( tnew < tstart ) return; \ 122 if ( tnew < tstop ) tstop = tnew; \ 126 if ( (offset) < 0 ) return; \ 129 #define mAdjustPoint( which ) \ 131 Geom::Point2D<T> newpoint; \ 132 newpoint.x = start.x + castDouble2T( dx * t##which ); \ 133 newpoint.y = start.y + castDouble2T( dy * t##which ); \ 134 which##changed_ = which##_ != newpoint; \ 135 which##_ = newpoint; \ 139 template <
class T>
inline 152 const double dx = stop.
x - start.
x;
156 const double dy = stop.
y - start.
y;
170 template <
class T>
inline 175 template <
class T>
inline 180 template <
class T>
inline 185 template <
class T>
inline 190 template <
class T>
inline Geom::Point2D< T > stop_
Definition: linerectangleclipper.h:46
bool isStartChanged() const
Definition: linerectangleclipper.h:176
#define mBoundaryClip(delta, offset)
Definition: linerectangleclipper.h:109
LineRectangleClipper(const Geom::Rectangle< T > &)
Definition: linerectangleclipper.h:90
bool startchanged_
Definition: linerectangleclipper.h:43
void clipPolyLine(const Geom::Rectangle< T > &rect, const TypeSet< Geom::Point2D< T > > &polyline, ObjectSet< TypeSet< Geom::Point2D< T > > > &result)
Definition: linerectangleclipper.h:53
const Geom::Point2D< T > & getStop() const
Definition: linerectangleclipper.h:191
void setLine(uiLineItem &, const LineParameters< float > &, const uiAxisHandler &xah, const uiAxisHandler &yah, const Interval< float > *xvalrg=0)
draws line not outside box defined by X and Y value ranges
Set of pointers to objects.
Definition: commontypes.h:32
void setLine(const Geom::Point2D< T > &start, const Geom::Point2D< T > &stop)
Definition: linerectangleclipper.h:140
Clips a line between two points by a rectangle. The line may be completely outside, completely inside or partially inside. If partially inside, new endpoints are calculated.
Definition: linerectangleclipper.h:25
Set of (small) copyable elements.
Definition: commontypes.h:30
#define mAdjustPoint(which)
Definition: linerectangleclipper.h:129
T y
Definition: geometry.h:67
const T castDouble2T(double) const
Definition: linerectangleclipper.h:101
Geom::Point2D< T > start_
Definition: linerectangleclipper.h:45
Basic 2D rectangle class.
Definition: geometry.h:113
const Geom::Point2D< T > & getStart() const
Definition: linerectangleclipper.h:186
Geom::Rectangle< T > rect_
Definition: linerectangleclipper.h:48
T x
Definition: geometry.h:66
bool isStopChanged() const
Definition: linerectangleclipper.h:181
#define mClass(module)
Definition: commondefs.h:164
Basic point class.
Definition: geometry.h:27
bool isIntersecting() const
Definition: linerectangleclipper.h:171
bool stopchanged_
Definition: linerectangleclipper.h:44
bool isintersecting_
Definition: linerectangleclipper.h:42
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118