Inkscape
Vector Graphics Editor
|
A range of numbers which is never empty. More...
#include <generic-interval.h>
Public Member Functions | |
Inspect contained values. | |
constexpr C | min () const |
constexpr C | max () const |
constexpr C | extent () const |
constexpr C | middle () const |
constexpr bool | isSingular () const |
C | operator[] (unsigned i) const |
constexpr C | operator[] (Dim2 d) const |
constexpr C | clamp (C val) const |
C | nearestEnd (C val) const |
Return the closer end of the interval. | |
template<size_t I> | |
constexpr C | get () const |
Test coordinates and other intervals for inclusion. | |
constexpr bool | contains (C val) const |
Check whether the interval includes this number. | |
constexpr bool | contains (CInterval const &val) const |
Check whether the interval includes the given interval. | |
constexpr bool | intersects (CInterval const &val) const |
Check whether the intervals have any common elements. | |
Modify the interval. | |
constexpr void | setMin (C val) |
Set the lower boundary of the interval. | |
constexpr void | setMax (C val) |
Set the upper boundary of the interval. | |
constexpr void | setEnds (C a, C b) |
Set both ends of the interval simultaneously. | |
constexpr void | expandTo (C val) |
Extend the interval to include the given number. | |
constexpr void | expandBy (C amount) |
Expand or shrink the interval in both directions by the given amount. | |
constexpr void | unionWith (CInterval const &a) |
Union the interval with another one. | |
Protected Attributes | |
C | _b [2] = { 0, 0 } |
Private Types | |
using | CInterval = typename CoordTraits< C >::IntervalType |
using | Self = GenericInterval< C > |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename C > | |
GenericInterval< C > | unify (GenericInterval< C > const &a, GenericInterval< C > const &b) |
Union two intervals. | |
Operators | |
using | output_type = C |
constexpr Self & | operator+= (C amnt) |
Offset the interval by a specified amount. | |
constexpr Self & | operator-= (C amnt) |
Offset the interval by the negation of the specified amount. | |
constexpr Self | operator- () const |
Return an interval mirrored about 0. | |
constexpr Self & | operator+= (CInterval const &o) |
Add two intervals. | |
constexpr Self & | operator-= (CInterval const &o) |
Subtract two intervals. | |
constexpr Self & | operator|= (CInterval const &o) |
Union two intervals. | |
constexpr bool | operator== (CInterval const &other) const |
Test for interval equality. | |
Create intervals. | |
constexpr | GenericInterval ()=default |
Create an interval that contains only zero. | |
constexpr | GenericInterval (C u) |
Create an interval that contains a single point. | |
constexpr | GenericInterval (C u, C v) |
Create an interval that contains all points between u and v . | |
template<typename InputIterator > | |
static CInterval | from_range (InputIterator start, InputIterator end) |
Create an interval containing a range of values. | |
static CInterval | from_array (C const *c, unsigned n) |
Create an interval from a C-style array of values it should contain. | |
A range of numbers which is never empty.
Definition at line 52 of file generic-interval.h.
|
private |
Definition at line 55 of file generic-interval.h.
using Geom::GenericInterval< C >::output_type = C |
Definition at line 197 of file generic-interval.h.
|
private |
Definition at line 56 of file generic-interval.h.
|
constexprdefault |
Create an interval that contains only zero.
|
inlineexplicitconstexpr |
Create an interval that contains a single point.
Definition at line 65 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Create an interval that contains all points between u
and v
.
Definition at line 67 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Definition at line 104 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
Referenced by Inkscape::UI::Widget::ColorPalette::scroll(), and Inkscape::UI::Widget::ColorPalette::scroll_cb().
|
inlineconstexpr |
Check whether the interval includes this number.
Definition at line 119 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
Referenced by Geom::EllipticalArc::_validateIntersection(), Geom::bezier_expand_to_image(), Geom::bezier_expand_to_image(), Geom::filter_line_segment_intersections(), Geom::GenericInterval< C >::intersects(), Geom::xAx::quad_ex(), Geom::EllipticalArc::roots(), TEST(), wrap_contains_coord(), and wrap_contains_ivl().
|
inlineconstexpr |
Check whether the interval includes the given interval.
Definition at line 123 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
|
inlineconstexpr |
Expand or shrink the interval in both directions by the given amount.
After this method, the interval's length (extent) will be increased by amount * 2
. Negative values can be given; they will shrink the interval. Shrinking by a value larger than half the interval's length will create a degenerate interval containing only the midpoint of the original.
Definition at line 175 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Extend the interval to include the given number.
Definition at line 166 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by Geom::bezier_expand_to_image(), Geom::bezier_expand_to_image(), Geom::xAx::extrema(), Geom::detail::bezier_clipping::fat_line_bounds(), and Geom::xAx::quad_ex().
|
inlineconstexpr |
Definition at line 99 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
Referenced by convole(), convole(), Inkscape::LivePathEffect::LPEInterpolate::doEffect_path(), Inkscape::LivePathEffect::LPEBendPath::doEffect_pwd2(), Inkscape::LivePathEffect::LPEEnvelope::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2(), Inkscape::LivePathEffect::LPEPatternAlongPath::doEffect_pwd2(), Inkscape::LivePathEffect::LPERecursiveSkeleton::doEffect_pwd2(), doEffect_pwd2(), Inkscape::LivePathEffect::LPERoughHatches::generateLevels(), Geom::detail::bezier_clipping::intersection(), Geom::detail::bezier_clipping::iterate< collinear_normal_tag >(), Geom::detail::bezier_clipping::iterate< intersection_point_tag >(), ls_sample_based(), monotonic_smash_intersect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::projectPoint(), Inkscape::LivePathEffect::LPEExtrude::resetDefaults(), Inkscape::LivePathEffect::LPEVonKoch::resetDefaults(), Geom::Piecewise< T >::setDomain(), and Inkscape::LivePathEffect::stretch_along().
|
inlinestatic |
Create an interval from a C-style array of values it should contain.
Definition at line 90 of file generic-interval.h.
References c, and Geom::GenericInterval< C >::from_range().
|
inlinestatic |
Create an interval containing a range of values.
The resulting interval will contain all values from the given range. The return type of iterators must be convertible to C. The given range must not be empty. For potentially empty ranges, see GenericOptInterval.
start | Beginning of the range |
end | End of the range |
Definition at line 83 of file generic-interval.h.
References end, result, and start.
Referenced by Geom::GenericInterval< C >::from_array().
|
inlineconstexpr |
Definition at line 113 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Check whether the intervals have any common elements.
Definition at line 127 of file generic-interval.h.
References Geom::GenericInterval< C >::contains().
|
inlineconstexpr |
Definition at line 101 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
Referenced by Geom::Piecewise< T >::bounds_local(), and Inkscape::LivePathEffect::LPESlice::doAfterEffect().
|
inlineconstexpr |
Definition at line 98 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by SPHatch::_calculateRenderInfo(), SPHatch::_calculateStripExtents(), Geom::Curve::allNearestTimes(), Geom::Piecewise< T >::bounds_local(), Geom::GenericInterval< C >::clamp(), Geom::detail::bezier_clipping::clip(), Geom::detail::bezier_clipping::clip_interval(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::GenericInterval< C >::contains(), Geom::GenericInterval< C >::contains(), convole(), convole(), Inkscape::LivePathEffect::LPEVonKoch::doBeforeEffect(), Inkscape::LivePathEffect::LPETiling::doBeforeEffect(), Inkscape::LivePathEffect::LPEBendPath::doBeforeEffect(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doBeforeEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doBeforeEffect(), Inkscape::LivePathEffect::LPESlice::doBeforeEffect(), Inkscape::LivePathEffect::LPETransform2Pts::doBeforeEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPEKnot::doEffect_path(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path(), Inkscape::LivePathEffect::LPECurveStitch::doEffect_path(), Inkscape::LivePathEffect::LPEEmbroderyStitch::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doEffect_path(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doOnApply(), Inkscape::LivePathEffect::LPESlice::doOnApply(), Inkscape::LivePathEffect::LPETransform2Pts::doOnApply(), Geom::GenericInterval< C >::extent(), Inkscape::LivePathEffect::LPERoughHatches::generateLevels(), generateLevels(), Geom::RedBlack::high(), Geom::Interval::interiorContains(), Geom::Interval::interiorIntersects(), Geom::detail::bezier_clipping::intersection(), interval_repr(), interval_to_tuple(), Geom::GenericInterval< C >::isSingular(), log(), Geom::Interval::lowerContains(), Geom::GenericInterval< C >::middle(), Geom::mono_intersect(), Geom::monotonic_smash_intersect(), Geom::nearest_time(), Geom::GenericInterval< C >::nearestEnd(), Geom::Curve::nearestTime(), Geom::Interval::operator*=(), Geom::GenericInterval< C >::operator==(), Geom::Interval::operator==(), Geom::pair_intersect(), Geom::parting_point(), plot(), Geom::portion(), Geom::portion(), Geom::Curve::portion(), Geom::Path::portion(), Geom::Sweeper< SweepSet >::process(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::projectPoint(), Geom::xAx::quad_ex(), Geom::reciprocalOnDomain(), Inkscape::LivePathEffect::LPETransform2Pts::reset(), Inkscape::LivePathEffect::LPEBendPath::resetDefaults(), Inkscape::LivePathEffect::LPEEnvelope::resetDefaults(), Inkscape::LivePathEffect::LPELattice::resetDefaults(), Inkscape::LivePathEffect::LPEVonKoch::resetDefaults(), Geom::Bezier::roots(), Geom::RedBlackTree::search(), Inkscape::LivePathEffect::LPELattice2::setDefaults(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::setDefaults(), Geom::Piecewise< T >::setDomain(), smash_intersect(), sore_tooth(), Inkscape::LivePathEffect::LPESlice::splititem(), Geom::Interval::upperContains(), and zaggy().
|
inlineconstexpr |
Definition at line 100 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
Referenced by Inkscape::LivePathEffect::LPEVonKoch::doBeforeEffect(), Inkscape::LivePathEffect::LPECopyRotate::doBeforeEffect(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doBeforeEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doBeforeEffect(), Inkscape::LivePathEffect::LPESlice::doBeforeEffect(), Inkscape::LivePathEffect::LPETransform2Pts::doBeforeEffect(), Inkscape::LivePathEffect::LPEBendPath::doEffect_pwd2(), doEffect_pwd2(), Inkscape::LivePathEffect::LPECopyRotate::doOnApply(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doOnApply(), Inkscape::LivePathEffect::LPESlice::doOnApply(), Inkscape::LivePathEffect::LPETransform2Pts::doOnApply(), Inkscape::LivePathEffect::LPETransform2Pts::reset(), Inkscape::LivePathEffect::LPEExtrude::resetDefaults(), and Inkscape::LivePathEffect::LPEVonKoch::resetDefaults().
|
inlineconstexpr |
Definition at line 97 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by SPHatch::_calculateRenderInfo(), SPHatch::_calculateStripExtents(), Geom::Curve::allNearestTimes(), Geom::Piecewise< T >::bounds_local(), Geom::GenericInterval< C >::clamp(), Geom::detail::bezier_clipping::clip(), Geom::detail::bezier_clipping::clip_interval(), Geom::computeLinfinityNeighborhood(), computeLinfinityNeighborhood(), Geom::GenericInterval< C >::contains(), Geom::GenericInterval< C >::contains(), convole(), convole(), Inkscape::LivePathEffect::LPEVonKoch::doBeforeEffect(), Inkscape::LivePathEffect::LPETiling::doBeforeEffect(), Inkscape::LivePathEffect::LPEBendPath::doBeforeEffect(), Inkscape::LivePathEffect::LPECopyRotate::doBeforeEffect(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doBeforeEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doBeforeEffect(), Inkscape::LivePathEffect::LPESlice::doBeforeEffect(), Inkscape::LivePathEffect::LPETransform2Pts::doBeforeEffect(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::doEffect(), Inkscape::LivePathEffect::LPEKnot::doEffect_path(), Inkscape::LivePathEffect::LPECopyRotate::doEffect_path(), Inkscape::LivePathEffect::LPECurveStitch::doEffect_path(), Inkscape::LivePathEffect::LPEEmbroderyStitch::doEffect_path(), Inkscape::LivePathEffect::LPEInterpolate::doEffect_path(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doEffect_path(), Inkscape::LivePathEffect::LPEPowerStroke::doEffect_path(), Inkscape::LivePathEffect::LPEBendPath::doEffect_pwd2(), Inkscape::LivePathEffect::LPEEnvelope::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice::doEffect_pwd2(), Inkscape::LivePathEffect::LPELattice2::doEffect_pwd2(), doEffect_pwd2(), Inkscape::LivePathEffect::LPECopyRotate::doOnApply(), Inkscape::LivePathEffect::LPEMirrorSymmetry::doOnApply(), Inkscape::LivePathEffect::LPESlice::doOnApply(), Inkscape::LivePathEffect::LPETransform2Pts::doOnApply(), Geom::GenericInterval< C >::extent(), Inkscape::LivePathEffect::LPERoughHatches::generateLevels(), generateLevels(), Geom::Interval::interiorContains(), Geom::Interval::interiorIntersects(), Geom::detail::bezier_clipping::intersection(), interval_repr(), interval_to_tuple(), Geom::GenericInterval< C >::isSingular(), Geom::RedBlack::key(), log(), Geom::Interval::lowerContains(), Geom::GenericInterval< C >::middle(), Geom::mono_intersect(), monotonic_smash_intersect(), Geom::monotonic_smash_intersect(), Geom::nearest_time(), Geom::GenericInterval< C >::nearestEnd(), Geom::Curve::nearestTime(), Geom::Interval::operator*=(), Geom::GenericInterval< C >::operator==(), Geom::Interval::operator==(), Geom::pair_intersect(), plot(), Geom::portion(), Geom::portion(), Geom::Curve::portion(), Geom::Path::portion(), Geom::Sweeper< SweepSet >::process(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::projectPoint(), Geom::xAx::quad_ex(), Geom::reciprocalOnDomain(), Inkscape::LivePathEffect::LPETransform2Pts::reset(), Inkscape::LivePathEffect::LPEBendPath::resetDefaults(), Inkscape::LivePathEffect::LPEEnvelope::resetDefaults(), Inkscape::LivePathEffect::LPELattice::resetDefaults(), Inkscape::LivePathEffect::LPEVonKoch::resetDefaults(), Geom::Bezier::roots(), Geom::RedBlackTree::search(), Inkscape::LivePathEffect::LPELattice2::setDefaults(), Inkscape::LivePathEffect::LPEPerspectiveEnvelope::setDefaults(), Geom::Piecewise< T >::setDomain(), smash_intersect(), sore_tooth(), Inkscape::LivePathEffect::LPESlice::splititem(), Geom::Interval::upperContains(), xlogx(), and zaggy().
|
inline |
Return the closer end of the interval.
Definition at line 108 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
|
inlineconstexpr |
Offset the interval by a specified amount.
Definition at line 199 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Add two intervals.
Sum is defined as the set of points that can be obtained by adding any two values from both operands: \(S = \{x \in A, y \in B: x + y\}\)
Definition at line 215 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Return an interval mirrored about 0.
Definition at line 210 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Offset the interval by the negation of the specified amount.
Definition at line 204 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Subtract two intervals.
Difference is defined as the set of points that can be obtained by subtracting any value from the second operand from any value from the first operand: \(S = \{x \in A, y \in B: x - y\}\)
Definition at line 224 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Test for interval equality.
Definition at line 238 of file generic-interval.h.
References Geom::GenericInterval< C >::max(), and Geom::GenericInterval< C >::min().
|
inlineconstexpr |
Definition at line 103 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inline |
Definition at line 102 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
|
inlineconstexpr |
Union two intervals.
Note that the intersection-and-assignment operator is not defined, because the result of an intersection can be empty, while Interval cannot.
Definition at line 233 of file generic-interval.h.
References Geom::GenericInterval< C >::unionWith().
|
inlineconstexpr |
Set both ends of the interval simultaneously.
Definition at line 156 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by Geom::detail::bezier_clipping::map_to(), and read_interval().
|
inlineconstexpr |
Set the upper boundary of the interval.
When the given number is smaller than the interval's smallest element, it will be reduced to the single number val
.
Definition at line 148 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by SPHatch::_calculateStripExtents().
|
inlineconstexpr |
Set the lower boundary of the interval.
When the given number is larger than the interval's largest element, it will be reduced to the single number val
.
Definition at line 138 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by SPHatch::_calculateStripExtents().
|
inlineconstexpr |
Union the interval with another one.
The resulting interval will contain all points of both intervals. It might also contain some points which didn't belong to either - this happens when the intervals did not have any common elements.
Definition at line 187 of file generic-interval.h.
References Geom::GenericInterval< C >::_b.
Referenced by Geom::GenericInterval< C >::operator|=().
|
related |
Union two intervals.
Definition at line 247 of file generic-interval.h.
|
protected |
Definition at line 58 of file generic-interval.h.
Referenced by Geom::GenericInterval< C >::expandBy(), Geom::GenericInterval< C >::expandTo(), Geom::GenericInterval< C >::GenericInterval(), Geom::GenericInterval< C >::GenericInterval(), Geom::GenericInterval< C >::get(), Geom::GenericInterval< C >::max(), Geom::GenericInterval< C >::min(), Geom::GenericInterval< C >::operator+=(), Geom::GenericInterval< C >::operator+=(), Geom::GenericInterval< C >::operator-(), Geom::GenericInterval< C >::operator-=(), Geom::GenericInterval< C >::operator-=(), Geom::GenericInterval< C >::operator[](), Geom::GenericInterval< C >::operator[](), Geom::GenericInterval< C >::setEnds(), Geom::GenericInterval< C >::setMax(), Geom::GenericInterval< C >::setMin(), and Geom::GenericInterval< C >::unionWith().