
2010/3/6 Jeff Flinn <TriumphSprint2000@hotmail.com>:
John Reid wrote:
John Reid wrote:
I have some further unrelated design questions/points:
Is there a function to return the gap between 2 intervals? I guess I can subtract the 2 intervals from their hull but one function call would be nice.
I actually had a need to iterate on the implied intervals that constitute the empty space between the intervals stored in an interval map. This was used as a post processing step to assure at least one pixel wide gaps were not lost in a bar chart display of scaled data.
Hi Jeff and John, I have implemented gap and distance functions and checked them into the sandbox. template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval> Interval<DomainT,Compare> inner_complement(const Interval<DomainT,Compare>& left, const Interval<DomainT,Compare>& right); template <class DomainT, ITL_COMPARE Compare, template<class,ITL_COMPARE>class Interval> inline typename Interval<DomainT,Compare>::difference_type distance(const Interval<DomainT,Compare>& left, const Interval<DomainT,Compare>& right); According to your suggestions I am going to rework the design in general and for intervals in particular, such that intervals will generally be simpler, static bound_types can be chosen and user defined interval types can be used. This will take a little longer but I am looking forward to improve my design. It's always an adventure to discover one's own partial ignorance :-D Cheers, Joachim