46 if (buffer + 8 >
end) {
78 : _operands{other.getOperand(0).
clone(), other.getOperand(1).
clone()} {}
90 buffer.
insert(buffer.
end(), buffer1.begin(), buffer1.end());
93 buffer.
insert(buffer.
end(), buffer2.begin(), buffer2.end());
103 if (buffer[0] != tc) {
115 throw std::runtime_error(
"Encoded CompoundRegion is has unexpected additional bytes.");
156 ((r1 & DISJOINT) & (r2 & DISJOINT))
159 | ((r1 & WITHIN) & (r2 & WITHIN))
161 | ((r1 & CONTAINS) | (r2 & CONTAINS));
186 ((r1 & CONTAINS) & (r2 & CONTAINS))
189 | ((r1 & DISJOINT) | (r2 & DISJOINT))
192 | ((r1 & WITHIN) | (r2 & WITHIN));
This file declares a class for representing axis-aligned bounding boxes in ℝ³.
This file declares a class for representing circular regions on the unit sphere.
This file declares classes for representing compound regions on the unit sphere.
This file declares a class for representing convex polygons with great circle edges on the unit spher...
Box3d represents a box in ℝ³.
Box represents a rectangle in spherical coordinate space that contains its boundary.
Circle is a circular region on the unit sphere that contains its boundary.
CompoundRegion is an intermediate base class for spherical regions that are comprised of a point-set ...
virtual Relationship relate(Region const &r) const =0
Region const & getOperand(std::size_t n) const
std::vector< std::uint8_t > _encode(std::uint8_t tc) const
static std::unique_ptr< CompoundRegion > decode(std::vector< uint8_t > const &s)
CompoundRegion(Region const &first, Region const &second)
Construct by copying or taking ownership of operands.
static std::array< std::unique_ptr< Region >, 2 > _decode(std::uint8_t tc, std::uint8_t const *buffer, std::size_t nBytes)
ConvexPolygon is a closed convex polygon on the unit sphere.
Ellipse is an elliptical region on the sphere.
IntersectionRegion is a lazy point-set inersection of its operands.
Relationship relate(Region const &r) const override
static std::unique_ptr< IntersectionRegion > decode(std::vector< uint8_t > const &s)
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
static constexpr uint8_t TYPE_CODE
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
Region is a minimal interface for 2-dimensional regions on the unit sphere.
virtual Circle getBoundingCircle() const =0
getBoundingCircle returns a bounding-circle for this region.
virtual Relationship relate(Region const &) const =0
static std::unique_ptr< Region > decode(std::vector< uint8_t > const &s)
virtual Box getBoundingBox() const =0
getBoundingBox returns a bounding-box for this region.
virtual bool contains(UnitVector3d const &) const =0
contains tests whether the given unit vector is inside this region.
virtual std::vector< uint8_t > encode() const =0
encode serializes this region into an opaque byte string.
virtual Box3d getBoundingBox3d() const =0
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
UnionRegion is a lazy point-set union of its operands.
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
static std::unique_ptr< UnionRegion > decode(std::vector< uint8_t > const &s)
static constexpr uint8_t TYPE_CODE
Relationship relate(Region const &r) const override
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
This file contains simple helper functions for encoding and decoding primitive types to/from byte str...
void encodeU64(std::uint64_t item, std::vector< uint8_t > &buffer)
encodeU64 appends an uint64 in little-endian byte order to the end of buffer.
std::uint64_t decodeU64(uint8_t const *buffer)
decodeU64 extracts an uint64 from the 8 byte little-endian byte sequence in buffer.
A base class for image defects.
This file declares a class for representing longitude/latitude angle boxes on the unit sphere.
This file declares a class for representing elliptical regions on the unit sphere.