42#ifndef LIBLAS_LASBOUNDS_HPP_INCLUDED
43#define LIBLAS_LASBOUNDS_HPP_INCLUDED
45#include <liblas/detail/fwd.hpp>
48#include <liblas/detail/private_utility.hpp>
51#include <boost/concept_check.hpp>
72 Range(T mmin=(std::numeric_limits<T>::max)(), T mmax=(std::numeric_limits<T>::min)())
131 return detail::compare_distance(
minimum, (std::numeric_limits<T>::max)()) && detail::compare_distance(
maximum, (std::numeric_limits<T>::min)());
215 ranges[0].minimum =
minx;
216 ranges[1].minimum =
miny;
217 ranges[2].minimum =
minz;
219 ranges[0].maximum =
maxx;
220 ranges[1].maximum =
maxy;
221 ranges[2].maximum =
maxz;
237 ranges[0].minimum =
minx;
238 ranges[1].minimum =
miny;
240 ranges[0].maximum =
maxx;
241 ranges[1].maximum =
maxy;
253 ranges[0].minimum =
min.GetX();
254 ranges[1].minimum =
min.GetY();
255 ranges[2].minimum =
min.GetZ();
257 ranges[0].maximum =
max.GetX();
258 ranges[1].maximum =
max.GetY();
259 ranges[2].maximum =
max.GetZ();
289 if (ranges.size() <=
index) {
296 return ranges[
index].minimum;
301 if (ranges.size() <=
index) {
302 ranges.resize(
index + 1);
304 ranges[
index].minimum = v;
309 if (ranges.size() <=
index) {
316 return ranges[
index].maximum;
321 if (ranges.size() <=
index) {
322 ranges.resize(
index + 1);
324 ranges[
index].maximum = v;
356T
minx()
const {
if (ranges.size() == 0)
return 0;
return ranges[0].minimum; }
357T
miny()
const {
if (ranges.size() < 2)
return 0;
return ranges[1].minimum; }
358T
minz()
const {
if (ranges.size() < 3)
return 0;
return ranges[2].minimum; }
359T
maxx()
const {
if (ranges.size() == 0)
return 0;
return ranges[0].maximum; }
360T
maxy()
const {
if (ranges.size() < 2)
return 0;
return ranges[1].maximum; }
361T
maxz()
const {
if (ranges.size() < 3)
return 0;
return ranges[2].maximum; }
370 return (!
equal(rhs));
389 return ranges.size();
395 if (ranges.size() < d) {
404 if ( ranges[i] != other.ranges[i] )
415 if ( ranges[i].
overlaps(other.ranges[i]) )
433 if ( ranges[i].
contains(other.ranges[i]) )
465 if (detail::compare_distance(ranges[2].length(), 0.0))
474 typedef typename std::vector< T >::size_type
size_type;
479 std::ostringstream msg;
480 msg <<
"liblas::Bounds::shift: Delta vector size, " << deltas.size()
481 <<
", is larger than the dimensionality of the bounds, "<<
dimension() <<
".";
482 throw std::runtime_error(msg.str());
484 for (i = 0; i < deltas.size(); ++i){
485 ranges[i].shift(deltas[i]);
492 typedef typename std::vector< T >::size_type
size_type;
497 std::ostringstream msg;
498 msg <<
"liblas::Bounds::scale: Delta vector size, " << deltas.size()
499 <<
", is larger than the dimensionality of the bounds, "<<
dimension() <<
".";
500 throw std::runtime_error(msg.str());
502 for (i = 0; i < deltas.size(); ++i){
503 ranges[i].scale(deltas[i]);
512 ranges[i].clip(ds[i]);
521 ranges[i].grow(ds[i]);
528 ranges[0].grow(p.
GetX());
529 ranges[1].grow(p.
GetY());
530 ranges[2].grow(p.
GetZ());
537 output = output * ranges[i].length();
546 if (ranges[i].
empty())
559 if ( (detail::compare_distance((
min)(d), (std::numeric_limits<T>::max)()) ||
560 detail::compare_distance((
max)(d), -(std::numeric_limits<T>::max)()) ))
562 std::ostringstream msg;
563 msg <<
"liblas::Bounds::verify: Minimum point at dimension " << d
564 <<
"is greater than maximum point. Neither point is infinity.";
565 throw std::runtime_error(msg.str());
Definition bounds.hpp:176
std::vector< Range< T > > RangeVec
Definition bounds.hpp:182
void grow(Bounds const &r)
Grow to the union of two liblas::Bounds.
Definition bounds.hpp:517
bool equal(Bounds< T > const &other) const
Is this Bounds equal to other?
Definition bounds.hpp:401
void dimension(size_type d)
Resize the dimensionality of the Bounds to d.
Definition bounds.hpp:393
Bounds()
Definition bounds.hpp:189
Bounds(const Point &min, const Point &max)
Definition bounds.hpp:249
bool empty() const
Definition bounds.hpp:543
T volume() const
Definition bounds.hpp:533
void verify()
Definition bounds.hpp:552
Bounds(T minx, T miny, T minz, T maxx, T maxy, T maxz)
Definition bounds.hpp:206
bool operator==(Bounds< T > const &rhs) const
Definition bounds.hpp:363
bool contains(Point const &point) const
Does this Bounds this point other?
Definition bounds.hpp:442
bool overlaps(Bounds const &other) const
Synonym for intersects for now.
Definition bounds.hpp:424
size_type dimension() const
The number of dimensions of the Bounds.
Definition bounds.hpp:387
void clip(Bounds const &r)
Clip this Bounds to the extent of r.
Definition bounds.hpp:508
Bounds< T > & operator=(Bounds< T > const &rhs)
Definition bounds.hpp:374
Bounds(RangeVec const &rngs)
Definition bounds.hpp:200
T maxy() const
Definition bounds.hpp:360
std::vector< Range< T > >::size_type size_type
Definition bounds.hpp:180
T max(std::size_t const &index) const
Definition bounds.hpp:307
bool intersects(Bounds const &other) const
Does this Bounds intersect other?
Definition bounds.hpp:411
void shift(std::vector< T > deltas)
Shift each dimension by a vector of detlas.
Definition bounds.hpp:472
RangeVec const & dims() const
The vector of Range<T> for the Bounds.
Definition bounds.hpp:384
T minz() const
Definition bounds.hpp:358
bool contains(Bounds const &other) const
Does this Bounds contain other?
Definition bounds.hpp:430
bool operator!=(Bounds< T > const &rhs) const
Definition bounds.hpp:368
T min(std::size_t const &index) const
Definition bounds.hpp:287
T miny() const
Definition bounds.hpp:357
void grow(Point const &p)
Expand the liblas::Bounds to include this point.
Definition bounds.hpp:526
T maxz() const
Definition bounds.hpp:361
void scale(std::vector< T > deltas)
Scale each dimension by a vector of deltas.
Definition bounds.hpp:490
T minx() const
Definition bounds.hpp:356
T value_type
Definition bounds.hpp:179
Bounds(Bounds const &other)
Definition bounds.hpp:194
T maxx() const
Definition bounds.hpp:359
Bounds(T minx, T miny, T maxx, T maxy)
Definition bounds.hpp:229
Point data record composed with X, Y, Z coordinates and attributes.
Definition point.hpp:69
T length() const
Definition bounds.hpp:168
Range & operator=(Range< T > const &rhs)
Definition bounds.hpp:82
T maximum
Definition bounds.hpp:68
Range(T mmin=(std::numeric_limits< T >::max)(), T mmax=(std::numeric_limits< T >::min)())
Definition bounds.hpp:72
bool overlaps(Range const &r) const
Definition bounds.hpp:114
void clip(Range const &r)
Definition bounds.hpp:146
bool operator!=(Range const &rhs) const
Definition bounds.hpp:97
bool contains(T v) const
Definition bounds.hpp:124
void grow(T v)
Definition bounds.hpp:154
void scale(T v)
Definition bounds.hpp:140
void grow(Range const &r)
Definition bounds.hpp:162
bool operator==(Range< T > const &rhs) const
Definition bounds.hpp:92
T minimum
Definition bounds.hpp:67
Range(Range const &other)
Definition bounds.hpp:76
bool contains(Range const &r) const
Definition bounds.hpp:119
bool empty(void) const
Definition bounds.hpp:129
T value_type
Definition bounds.hpp:70
void shift(T v)
Definition bounds.hpp:134
bool equal(Range const &other) const
Definition bounds.hpp:102
#define LAS_DLL
Definition export.hpp:58
Namespace grouping all elements of libLAS public interface.
Definition bounds.hpp:60