Growing an Extent is very common - we do this all the time in the Rapid code.
(Imagine code that loops over 1000 points to determine their bounding box).
In most cases, we modify the Extent's .min and .max directly for performance, rather than using the Extent.extend call. This is because Extent.extend(other) is written in an immutable style, so it returns a new Extent rather than just modifying the existing Extent in-place.
I'm going to change it so there are 2 functions:
Extent.extend(other) - immutable, returns a new Extent (same as before)
Extent.extendSelf(other) - mutable, modifies min and max in self (much more performant)
Growing an
Extent
is very common - we do this all the time in the Rapid code.(Imagine code that loops over 1000 points to determine their bounding box).
In most cases, we modify the
Extent
's.min
and.max
directly for performance, rather than using theExtent.extend
call. This is becauseExtent.extend(other)
is written in an immutable style, so it returns anew Extent
rather than just modifying the existingExtent
in-place.I'm going to change it so there are 2 functions:
Extent.extend(other)
- immutable, returns anew Extent
(same as before)Extent.extendSelf(other)
- mutable, modifiesmin
andmax
in self (much more performant)