LSSTApplications
20.0.0
LSSTDataManagementBasePackage
|
|
template<typename VertexIterator > |
UnitVector3d | centroid (VertexIterator const begin, VertexIterator const end) |
|
template<typename VertexIterator > |
Circle | boundingCircle (VertexIterator const begin, VertexIterator const end) |
|
template<typename VertexIterator > |
Box | boundingBox (VertexIterator const begin, VertexIterator const end) |
|
template<typename VertexIterator > |
Box3d | boundingBox3d (VertexIterator const begin, VertexIterator const end) |
|
template<typename VertexIterator > |
bool | contains (VertexIterator const begin, VertexIterator const end, UnitVector3d const &v) |
|
template<typename VertexIterator > |
Relationship | relate (VertexIterator const begin, VertexIterator const end, Box const &b) |
|
template<typename VertexIterator > |
Relationship | relate (VertexIterator const begin, VertexIterator const end, Circle const &c) |
|
template<typename VertexIterator1 , typename VertexIterator2 > |
Relationship | relate (VertexIterator1 const begin1, VertexIterator1 const end1, VertexIterator2 const begin2, VertexIterator2 const end2) |
|
template<typename VertexIterator > |
Relationship | relate (VertexIterator const begin, VertexIterator const end, ConvexPolygon const &p) |
|
template<typename VertexIterator > |
Relationship | relate (VertexIterator const begin, VertexIterator const end, Ellipse const &e) |
|
template<template< typename, bool > class Finder, bool InteriorOnly> |
RangeSet | findPixels (Region const &r, size_t maxRanges, int level) |
|
◆ boundingBox()
template<typename VertexIterator >
Box lsst::sphgeom::detail::boundingBox |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end |
|
) |
| |
Definition at line 85 of file ConvexPolygonImpl.h.
86 Angle const eps(5.0e-10);
89 VertexIterator j =
begin;
103 for (; j !=
end; i = j, ++j) {
105 bbox.expandTo(Box(p, eps, eps));
106 if (!haveCW || !haveCCW) {
108 haveCCW = haveCCW || (o > 0);
109 haveCW = haveCW || (o < 0);
112 Vector3d n = (*i).robustCross(*j);
120 Vector3d v(-n.x() * n.z(),
122 n.x() * n.x() + n.y() * n.y());
123 if (v != Vector3d()) {
127 double zni = i->y() * n.x() - i->x() * n.y();
128 double znj = j->y() * n.x() - j->x() * n.y();
130 if (zni > 0.0 && znj < 0.0) {
132 LonLat::latitudeOf(v) + eps));
133 }
else if (zni < 0.0 && znj > 0.0) {
135 LonLat::latitudeOf(-v) - eps));
142 Box northPole(Box::allLongitudes(), AngleInterval(
Angle(0.5 *
PI)));
143 bbox.expandTo(northPole);
144 }
else if (!haveCCW) {
145 Box southPole(Box::allLongitudes(), AngleInterval(
Angle(-0.5 *
PI)));
146 bbox.expandTo(southPole);
◆ boundingBox3d()
template<typename VertexIterator >
Box3d lsst::sphgeom::detail::boundingBox3d |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end |
|
) |
| |
Definition at line 152 of file ConvexPolygonImpl.h.
153 static double const maxError = 1.0e-14;
155 VertexIterator j =
begin;
156 double emin[3] = { j->x(), j->y(), j->z() };
157 double emax[3] = { j->x(), j->y(), j->z() };
158 for (++j; j !=
end; ++j) {
159 for (
int i = 0; i < 3; ++i) {
160 double v = j->operator()(i);
185 VertexIterator k =
begin;
186 for (; k !=
end; j = k, ++k) {
187 UnitVector3d n(j->robustCross(*k));
188 for (
int i = 0; i < 3; ++i) {
192 Vector3d e(i == 0 ? -d : n.x() * ni,
193 i == 1 ? -d : n.y() * ni,
194 i == 2 ? -d : n.z() * ni);
198 Vector3d v = e.cross(n);
199 double vdj = v.dot(*j);
200 double vdk = v.dot(*k);
201 if (vdj >= 0.0 && vdk <= 0.0) {
204 if (vdj <= 0.0 && vdk >= 0.0) {
212 bool a[3] = {
true,
true,
true };
213 bool b[3] = {
true,
true,
true };
216 for (; k !=
end; j = k, ++k) {
221 a[0] =
a[0] && (ox <= 0);
222 b[0] =
b[0] && (ox >= 0);
224 a[1] =
a[1] && (oy <= 0);
225 b[1] =
b[1] && (oy >= 0);
227 a[2] =
a[2] && (oz <= 0);
228 b[2] =
b[2] && (oz >= 0);
233 for (
int i = 0; i < 3; ++i) {
234 emin[i] =
a[i] ? -1.0 :
std::max(-1.0, emin[i] - maxError);
235 emax[i] =
b[i] ? 1.0 :
std::min(1.0, emax[i] + maxError);
237 return Box3d(Interval1d(emin[0], emax[0]),
238 Interval1d(emin[1], emax[1]),
239 Interval1d(emin[2], emax[2]));
◆ boundingCircle()
template<typename VertexIterator >
Circle lsst::sphgeom::detail::boundingCircle |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end |
|
) |
| |
◆ centroid()
template<typename VertexIterator >
UnitVector3d lsst::sphgeom::detail::centroid |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end |
|
) |
| |
Definition at line 48 of file ConvexPolygonImpl.h.
57 VertexIterator j =
begin;
58 for (; j !=
end; i = j, ++j) {
59 Vector3d v = (*i).robustCross(*j);
60 double s = 0.5 * v.normalize();
61 double c = (*i).dot(*j);
62 double a = (s == 0.0 && c == 0.0) ? 0.0 :
std::atan2(s, c);
65 return UnitVector3d(cm);
◆ contains()
template<typename VertexIterator >
bool lsst::sphgeom::detail::contains |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end, |
|
|
UnitVector3d const & |
v |
|
) |
| |
◆ findPixels()
template<template< typename, bool > class Finder, bool InteriorOnly>
RangeSet lsst::sphgeom::detail::findPixels |
( |
Region const & |
r, |
|
|
size_t |
maxRanges, |
|
|
int |
level |
|
) |
| |
Definition at line 150 of file PixelFinder.h.
152 Circle
const * c =
nullptr;
153 Ellipse
const * e =
nullptr;
154 Box
const *
b =
nullptr;
155 if ((c =
dynamic_cast<Circle
const *
>(&r))) {
156 Finder<Circle, InteriorOnly>
find(s, *c, level, maxRanges);
158 }
else if ((e =
dynamic_cast<Ellipse
const *
>(&r))) {
159 Finder<Circle, InteriorOnly>
find(
160 s, e->getBoundingCircle(), level, maxRanges);
162 }
else if ((
b =
dynamic_cast<Box
const *
>(&r))) {
163 Finder<Box, InteriorOnly>
find(s, *
b, level, maxRanges);
166 Finder<ConvexPolygon, InteriorOnly>
find(
167 s,
dynamic_cast<ConvexPolygon
const &
>(r), level, maxRanges);
◆ relate() [1/5]
template<typename VertexIterator >
Relationship lsst::sphgeom::detail::relate |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end, |
|
|
Box const & |
b |
|
) |
| |
◆ relate() [2/5]
template<typename VertexIterator >
Relationship lsst::sphgeom::detail::relate |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end, |
|
|
Circle const & |
c |
|
) |
| |
Definition at line 267 of file ConvexPolygonImpl.h.
272 return CONTAINS | DISJOINT;
281 for (VertexIterator v = begin; v !=
end; ++v) {
282 double d = (*v - c.getCenter()).getSquaredNorm();
283 if (
std::fabs(d - c.getSquaredChordLength()) <
288 bool b = d < c.getSquaredChordLength();
291 }
else if (inside !=
b) {
300 Vector3d n =
a->robustCross(*
b);
302 if (d > c.getSquaredChordLength() -
319 Vector3d n =
a->robustCross(*
b);
◆ relate() [3/5]
template<typename VertexIterator >
◆ relate() [4/5]
template<typename VertexIterator >
Relationship lsst::sphgeom::detail::relate |
( |
VertexIterator const |
begin, |
|
|
VertexIterator const |
end, |
|
|
Ellipse const & |
e |
|
) |
| |
◆ relate() [5/5]
template<typename VertexIterator1 , typename VertexIterator2 >
Relationship lsst::sphgeom::detail::relate |
( |
VertexIterator1 const |
begin1, |
|
|
VertexIterator1 const |
end1, |
|
|
VertexIterator2 const |
begin2, |
|
|
VertexIterator2 const |
end2 |
|
) |
| |
Definition at line 336 of file ConvexPolygonImpl.h.
354 for (VertexIterator1 i = begin1; i != end1; ++i) {
359 for (VertexIterator2 j = begin2; j != end2; ++j) {
366 return (all1 ? WITHIN : INTERSECTS) | (all2 ? CONTAINS : INTERSECTS);
374 for (VertexIterator1
a =
std::prev(end1),
b = begin1;
375 b != end1;
a =
b, ++
b) {
376 for (VertexIterator2 c =
std::prev(end2), d = begin2;
377 d != end2; c = d, ++d) {
380 if (acd == bdc && acd != 0) {
383 if (cba == dab && cba == acd) {
bool contains(VertexIterator const begin, VertexIterator const end, UnitVector3d const &v)
constexpr double PI
The ratio of a circle's circumference to diameter.
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.
Relationship relate(VertexIterator const begin, VertexIterator const end, Ellipse const &e)
Box boundingBox(VertexIterator const begin, VertexIterator const end)
Relationship relate(LonLat const &p) const
UnitVector3d centroid(VertexIterator const begin, VertexIterator const end)
int orientationX(UnitVector3d const &b, UnitVector3d const &c)
orientationX(b, c) is equivalent to orientation(UnitVector3d::X(), b, c).
constexpr double MAX_SQUARED_CHORD_LENGTH_ERROR
double getMaxSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector furthest from v that lies on the plane with normal n in the direction of the...
int orientationY(UnitVector3d const &b, UnitVector3d const &c)
orientationY(b, c) is equivalent to orientation(UnitVector3d::Y(), b, c).
int orientationZ(UnitVector3d const &b, UnitVector3d const &c)
orientationZ(b, c) is equivalent to orientation(UnitVector3d::Z(), b, c).
double getMinSquaredChordLength(Vector3d const &v, Vector3d const &a, Vector3d const &b, Vector3d const &n)
Let p be the unit vector closest to v that lies on the plane with normal n in the direction of the cr...