22#include "pybind11/pybind11.h"
23#include "pybind11/numpy.h"
42using namespace pybind11::literals;
62 cls.def(py::init<>());
63 cls.def(py::init<LonLat const &>(),
"point"_a);
64 cls.def(py::init<LonLat const &, LonLat const &>(),
"point1"_a,
"point2"_a);
65 cls.def(py::init<LonLat const &, Angle, Angle>(),
"center"_a,
"width"_a,
67 cls.def(py::init<NormalizedAngleInterval const &, AngleInterval const &>(),
69 cls.def(py::init<Box const &>(),
"box"_a);
71 cls.def(
"__eq__", (
bool (
Box::*)(
Box const &)
const) & Box::operator==,
73 cls.def(
"__eq__", (
bool (
Box::*)(
LonLat const &)
const) & Box::operator==,
75 cls.def(
"__ne__", (
bool (
Box::*)(
Box const &)
const) & Box::operator!=,
77 cls.def(
"__ne__", (
bool (
Box::*)(
LonLat const &)
const) & Box::operator!=,
79 cls.def(
"__contains__",
85 cls.def(
"__contains__",
101 cls.def(
"contains", py::vectorize((
bool (
Box::*)(
double,
double,
double)
const)&
Box::contains),
102 "x"_a,
"y"_a,
"z"_a);
103 cls.def(
"contains", py::vectorize((
bool (
Box::*)(
double,
double)
const)&
Box::contains),
105 cls.def(
"isDisjointFrom",
107 cls.def(
"isDisjointFrom",
109 cls.def(
"intersects",
120 cls.def(
"expandedTo",
125 "width"_a,
"height"_a);
129 "width"_a,
"height"_a);
135 "width"_a,
"height"_a);
147 cls.def(
"__str__", [](
Box const &
self) {
148 return py::str(
"Box({!s}, {!s})").format(
self.getLon(),
self.getLat());
150 cls.def(
"__repr__", [](
Box const &
self) {
151 return py::str(
"Box({!r}, {!r})").format(
self.getLon(),
self.getLat());
This file defines a class for representing angle intervals.
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...
This file contains a class representing spherical coordinates.
This file declares a class representing closed intervals of normalized angles, i.e.
This file defines an interface for spherical regions.
This file declares a class for representing unit vectors in ℝ³.
Angle represents an angle in radians.
Box represents a rectangle in spherical coordinate space that contains its boundary.
Box clippedTo(LonLat const &x) const
clippedTo returns the intersection of this box and x.
AngleInterval const & getLat() const
getLat returns the latitude interval of this box.
Box dilatedBy(Angle r) const
static NormalizedAngle halfWidthForCircle(Angle r, Angle lat)
halfWidthForCircle computes the half-width of bounding boxes for circles with radius r and centers at...
NormalizedAngle getWidth() const
getWidth returns the width in longitude angle of this box.
double getArea() const
getArea returns the area of this box in steradians.
static Box fromRadians(double lon1, double lat1, double lon2, double lat2)
Box expandedTo(LonLat const &x) const
NormalizedAngleInterval const & getLon() const
getLon returns the longitude interval of this box.
Relationship relate(LonLat const &p) const
bool isDisjointFrom(LonLat const &x) const
bool isFull() const
isFull returns true if this box contains all points on the unit sphere.
static constexpr uint8_t TYPE_CODE
Box & dilateBy(Angle r)
dilateBy minimally expands this Box to include all points within angular separation r of its boundary...
Angle getHeight() const
getHeight returns the height in latitude angle of this box.
LonLat getCenter() const
getCenter returns the center of this box.
static NormalizedAngleInterval allLongitudes()
allLongitudes returns a normalized angle interval containing all valid longitude angles.
bool isWithin(LonLat const &x) const
Box erodedBy(Angle r) const
Box & expandTo(LonLat const &x)
static AngleInterval allLatitudes()
allLatitudes returns an angle interval containing all valid latitude angles.
bool contains(LonLat const &x) const
static Box fromDegrees(double lon1, double lat1, double lon2, double lat2)
bool isEmpty() const
isEmpty returns true if this box does not contain any points.
Box & clipTo(LonLat const &x)
clipTo shrinks this box until it contains only x.
bool intersects(LonLat const &x) const
LonLat represents a spherical coordinate (longitude/latitude angle) pair.
Region is a minimal interface for 2-dimensional regions on the unit sphere.
UnitVector3d is a unit vector in ℝ³ with components stored in double precision.
pybind11::bytes encode(Region const &self)
Encode a Region as a pybind11 bytes object.
std::bitset< 3 > Relationship
Relationship describes how two sets are related.
void defineClass(Pybind11Class &cls)
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.