50 _a(alpha.asRadians() - 0.5 *
PI)
57 }
else if (f1 == -f2) {
77 b1.
x(), b1.
y(), b1.
z(),
78 f1.
x(), f1.
y(), f1.
z());
94 b1.
x(), b1.
y(), b1.
z(),
95 b2.
x(), b2.
y(), b2.
z());
101 }
else if (_a.
asRadians() > 0.0 && _b < _a) {
139 b1.
x(), b1.
y(), b1.
z(),
140 center.
x(), center.
y(), center.
z());
148 if ((alpha.
asRadians() < 0.5 *
PI && alpha < beta) ||
157 b1.
x(), b1.
y(), b1.
z(),
158 center.
x(), center.
y(), center.
z());
169 double vdotc = v.
dot(c);
178 }
else if (vdotc < -0.5) {
186 double x = u.
x() * _tana;
187 double y = u.
y() * _tanb;
188 double z = u.
z() + scz;
189 double d = (
x *
x +
y *
y) -
z *
z;
191 return z >= 0.0 || d >= 0.0;
193 return z >= 0.0 && d <= 0.0;
351 for (
int r = 0; r < 3; ++r) {
352 for (
int c = 0; c < 3; ++c) {
365 if (buffer ==
nullptr || n != ENCODED_SIZE || buffer[0] !=
TYPE_CODE) {
379 ellipse->_S =
Matrix3d(m00, m01, m02,
385 ellipse->_a =
Angle(a);
387 ellipse->_gamma =
Angle(gamma);
390 ellipse->_tana = tana;
391 ellipse->_tanb = tanb;
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 a class for representing convex polygons with great circle edges on the unit spher...
Angle represents an angle in radians.
bool isNan() const
isNan returns true if the angle value is NaN.
double asRadians() const
asRadians returns the value of this angle in units of radians.
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.
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
Relationship relate(UnitVector3d const &v) const
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
ConvexPolygon is a closed convex polygon on the unit sphere.
Ellipse is an elliptical region on the sphere.
static constexpr uint8_t TYPE_CODE
Angle getAlpha() const
getAlpha returns α, the first semi-axis length of the ellipse.
Angle getBeta() const
getBeta returns β, the second semi-axis length of the ellipse.
Relationship relate(Region const &r) const override
Circle getBoundingCircle() const override
getBoundingCircle returns a bounding-circle for this region.
Box getBoundingBox() const override
getBoundingBox returns a bounding-box for this region.
std::vector< uint8_t > encode() const override
encode serializes this region into an opaque byte string.
Ellipse()
This constructor creates an empty ellipse.
static std::unique_ptr< Ellipse > decode(std::vector< uint8_t > const &s)
Matrix3d const & getTransformMatrix() const
getTransformMatrix returns the orthogonal matrix that maps vectors to the basis in which the quadrati...
bool contains(UnitVector3d const &v) const override
contains tests whether the given unit vector is inside this region.
UnitVector3d getCenter() const
getCenter returns the center of the ellipse as a unit vector.
Box3d getBoundingBox3d() const override
getBoundingBox3d returns a 3-dimensional bounding-box for this region.
A 3x3 matrix with real entries stored in double precision.
NormalizedAngle is an angle that lies in the range [0, 2π), with one exception - a NormalizedAngle ca...
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
double dot(Vector3d const &v) const
dot returns the inner product of this unit vector and v.
UnitVector3d rotatedAround(UnitVector3d const &k, Angle a) const
rotatedAround returns a copy of this unit vector, rotated around the unit vector k by angle a accordi...
static UnitVector3d orthogonalTo(Vector3d const &v)
orthogonalTo returns an arbitrary unit vector that is orthogonal to v.
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this unit vector and v.
static UnitVector3d northFrom(Vector3d const &v)
northFrom returns the unit vector orthogonal to v that points "north" from v.
Vector3d is a vector in ℝ³ with components stored in double precision.
double normalize()
normalize scales this vector to have unit norm and returns its norm prior to scaling.
Vector3d cross(Vector3d const &v) const
cross returns the cross product of this vector and v.
This file contains simple helper functions for encoding and decoding primitive types to/from byte str...
constexpr double MAX_ASIN_ERROR
void encodeDouble(double item, std::vector< uint8_t > &buffer)
encodeDouble appends an IEEE double in little-endian byte order to the end of buffer.
std::ostream & operator<<(std::ostream &, Angle const &)
int orientation(UnitVector3d const &a, UnitVector3d const &b, UnitVector3d const &c)
orientation computes and returns the orientations of 3 unit vectors a, b and c.
double tan(Angle const &a)
double decodeDouble(uint8_t const *buffer)
decodeDouble extracts an IEEE double from the 8 byte little-endian byte sequence in buffer.
double cos(Angle const &a)
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.