31 inline bool isIntersecting()
const;
32 inline bool isStartChanged()
const;
33 inline bool isStopChanged()
const;
38 inline const T castDouble2T(
double)
const;
50 template <
class T>
inline 61 for (
int idx=1; idx<polyline.size(); idx++ )
63 clipper.
setLine( polyline[idx-1], polyline[idx] );
76 result += currentline;
77 (*currentline) += clipper.
getStart();
80 (*currentline) += clipper.
getStop();
87 template <
class T>
inline 90 , isintersecting_( true )
91 , startchanged_( false )
92 , stopchanged_( false )
98 template <
class T>
inline 103 return fabs(d-t1) < fabs(d-t2) ? t1 : t2;
107 #define mBoundaryClip( delta, offset ) \ 111 double tnew = (double) (offset) / (delta); \ 114 if ( tnew > tstop ) return; \ 115 if ( tnew > tstart ) tstart = tnew; \ 119 if ( tnew < tstart ) return; \ 120 if ( tnew < tstop ) tstop = tnew; \ 124 if ( (offset) < 0 ) return; \ 127 #define mAdjustPoint( which ) \ 129 Geom::Point2D<T> newpoint; \ 130 newpoint.x_ = start.x_ + castDouble2T( dx * t##which ); \ 131 newpoint.y_ = start.y_ + castDouble2T( dy * t##which ); \ 132 which##changed_ = which##_ != newpoint; \ 133 which##_ = newpoint; \ 137 template <
class T>
inline 150 const double dx = stop.
x_ - start.
x_;
154 const double dy = stop.
y_ - start.
y_;
168 template <
class T>
inline 173 template <
class T>
inline 178 template <
class T>
inline 183 template <
class T>
inline 188 template <
class T>
inline Geom::Point2D< T > stop_
Definition: linerectangleclipper.h:44
bool isStartChanged() const
Definition: linerectangleclipper.h:174
#define mBoundaryClip(delta, offset)
Definition: linerectangleclipper.h:107
LineRectangleClipper(const Geom::Rectangle< T > &)
Definition: linerectangleclipper.h:88
bool startchanged_
Definition: linerectangleclipper.h:41
void clipPolyLine(const Geom::Rectangle< T > &rect, const TypeSet< Geom::Point2D< T > > &polyline, ObjectSet< TypeSet< Geom::Point2D< T > > > &result)
Definition: linerectangleclipper.h:51
const Geom::Point2D< T > & getStop() const
Definition: linerectangleclipper.h:189
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:28
void setLine(const Geom::Point2D< T > &start, const Geom::Point2D< T > &stop)
Definition: linerectangleclipper.h:138
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:23
Set of (small) copyable elements.
Definition: commontypes.h:26
#define mAdjustPoint(which)
Definition: linerectangleclipper.h:127
const T castDouble2T(double) const
Definition: linerectangleclipper.h:99
T x_
Definition: geometry.h:80
Geom::Point2D< T > start_
Definition: linerectangleclipper.h:43
Basic 2D rectangle class.
Definition: geometry.h:228
const Geom::Point2D< T > & getStart() const
Definition: linerectangleclipper.h:184
Geom::Rectangle< T > rect_
Definition: linerectangleclipper.h:46
bool isStopChanged() const
Definition: linerectangleclipper.h:179
#define mClass(module)
Definition: commondefs.h:161
2D point or vector class.
Definition: commontypes.h:58
bool isIntersecting() const
Definition: linerectangleclipper.h:169
T y_
Definition: geometry.h:81
bool stopchanged_
Definition: linerectangleclipper.h:42
bool isintersecting_
Definition: linerectangleclipper.h:40
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122