#include <HxBSplineInterval.h>
Public Methods | |
| HxBSplineInterval () | |
| Default constructor. More... | |
| HxBSplineInterval (double b, double e, double min, double max, HxBSplineType type) | |
| Construct interval [b,e) in a curve with total path from [min,max) and given type. More... | |
| HxBSplineInterval (double b, double e, double min, double max, int closed) | |
| Construct interval [b,e) in a curve with total path from [min,max) and given type. More... | |
| ~HxBSplineInterval () | |
| Destructor. More... | |
| double | begin () const |
| first t in interval. More... | |
| double | end () const |
| last t in interval. More... | |
| int | contains (double t) const |
| Determine if the path parameter t is inside this interval. More... | |
| double | next (double t, double delta) const |
| returns t+delta, with wrapping for closed intervals. More... | |
| double | prev (double t, double delta) const |
| returns t-delta, with wrapping for closed intervals. More... | |
| double | length () const |
| path lenght of interval. More... | |
| double | middle () const |
| middle t of interval. More... | |
| double | ratio (double r) const |
| t corresponding to given proportion of interval. More... | |
| int | isClosed () const |
| 1 if interval is wrapped. More... | |
| HxBSplineInterval | cropBegin (double t) const |
| cut begin of interval: [t,e). More... | |
| HxBSplineInterval | cropEnd (double t) const |
| cut end of interval: [b,t). More... | |
| HxBSplineInterval | part (double t1, double t2) const |
| get subinterval [t1,t2). More... | |
path interval (oriented). interval = [first, second). For open paths, first < second (always). For closed paths, first > second indicates wrap around t=min, max.
|
|
Default constructor.
00099 : pair<double,double>()
00100 {
00101 _min = 0;
00102 _max = 0;
00103 _wrap = 0;
00104 }
|
|
||||||||||||||||||||||||
|
Construct interval [b,e) in a curve with total path from [min,max) and given type.
00109 : pair<double,double>(b,e)
00110 {
00111 _min = min;
00112 _max = max;
00113 _wrap = (type == closed);
00114 }
|
|
||||||||||||||||||||||||
|
Construct interval [b,e) in a curve with total path from [min,max) and given type.
00119 : pair<double,double>(b,e)
00120 {
00121 _min = min;
00122 _max = max;
00123 _wrap = wrap;
00124 }
|
|
|
Destructor.
00128 {
00129 }
|
|
|
first t in interval.
00133 {
00134 return first;
00135 }
|
|
|
last t in interval.
00139 {
00140 return second;
00141 }
|
|
|
Determine if the path parameter t is inside this interval. Consider wrapping for closed curves. interval = [first, second)
00145 {
00146 if ( first == second ) // special case?
00147 return (t >= _min && t < _max);
00148 if ( first > second ) // is wrapped?
00149 return (t >= first && t < _max) || (t >= _min && t < second);
00150 else return (t >= first && t < second);
00151 }
|
|
||||||||||||
|
returns t+delta, with wrapping for closed intervals.
00155 {
00156 t += delta;
00157 if ( t >= _max && _wrap )
00158 t = _min + (t - _max);
00159 return t;
00160 }
|
|
||||||||||||
|
returns t-delta, with wrapping for closed intervals.
00164 {
00165 t -= delta;
00166 if ( t < _min && _wrap )
00167 t = _max - (_min - t);
00168 return t;
00169 }
|
|
|
path lenght of interval.
00173 {
00174 double tmp = second - first;
00175 if ( tmp < 0 && _wrap )
00176 return (_max - EPS - first) + (second - _min);
00177 else if ( tmp < EPS )
00178 return EPS;
00179 else return tmp - EPS;
00180 }
|
|
|
middle t of interval.
00184 {
00185 return ratio(0.5);
00186 }
|
|
|
t corresponding to given proportion of interval.
00190 {
00191 double t = length() * r + first;
00192 if ( t >= _max )
00193 t = _min + (t - _max);
00194 return t;
00195 }
|
|
|
1 if interval is wrapped.
00199 {
00200 return _wrap;
00201 }
|
|
|
cut begin of interval: [t,e).
00205 {
00206 HxBSplineInterval tmp(t, second, _min, _max, _wrap);
00207 return tmp;
00208 }
|
|
|
cut end of interval: [b,t).
00212 {
00213 HxBSplineInterval tmp(first, t, _min, _max, _wrap);
00214 return tmp;
00215 }
|
|
||||||||||||
|
get subinterval [t1,t2).
00219 {
00220 HxBSplineInterval tmp(t1, t2, _min, _max, closed);
00221 tmp._wrap = _wrap;
00222 return tmp;
00223 }
|
1.2.12 written by Dimitri van Heesch,
© 1997-2001