HTMesh

Search for usage in LXR

HTMesh Class Reference

#include <HTMesh.h>

Inheritance diagram for HTMesh:

Public Member Functions

 HTMesh (int level, int buildLevel, int numBuffers=1)
 
Trixel index (double ra, double dec) const
 
void intersect (double ra, double dec, double radius, BufNum bufNum=0)
 
void intersect (double ra1, double dec1, double ra2, double dec2, BufNum bufNum=0)
 
void intersect (double ra1, double dec1, double ra2, double dec2, double ra3, double dec3, BufNum bufNum=0)
 
void intersect (double ra1, double dec1, double ra2, double dec2, double ra3, double dec3, double ra4, double dec4, BufNum bufNum=0)
 
int intersectSize (BufNum bufNum=0)
 
int level () const
 
MeshBuffermeshBuffer (BufNum bufNum=0)
 
void setDebug (int debug)
 
int size () const
 
void vertices (Trixel id, double *ra1, double *dec1, double *ra2, double *dec2, double *ra3, double *dec3)
 

Detailed Description

HTMesh was originally intended to be a simple interface to the HTM library for the KStars project that would hide some of the complexity.

But it has gained some complexity of its own.

The most complex addition was the routine that performs an intersection on a line segment, finding all the trixels that cover the line. Perhaps there is an easier and faster way to do it. Right now we convert to cartesian coordinates to take the cross product of the two input vectors in order to create a perpendicular which is used to form a very narrow triangle that contains the original line segment as one of its long legs.

Error detection and prevention added a little bit more complexity. The raw HTM library is vulnerable to misbehavior if the polygon intersection routines are given duplicate consecutive points, including the first point of a polygon duplicating the last point. We test for duplicated points now. If they are found, we drop down to the intersection routine with one fewer vertices, ending at the line segment. If the two ends of a line segment are much close together than the typical edge of a trixel then we simply index each point separately and the result set is consists of the union of these two trixels.

The final (I hope) level of complexity was the addition of multiple results buffers. You can set the number of results buffers in the HTMesh constructor. Since each buffer has to be able to hold one integer for each trixel in the mesh, multiple buffers can quickly eat up memory. The default is just one buffer and all routines that use the buffers default to using the just the first buffer.

NOTE: all Right Ascensions (ra) and Declinations (dec) are in degrees.

Definition at line 56 of file HTMesh.h.

Constructor & Destructor Documentation

◆ HTMesh()

HTMesh::HTMesh ( int level,
int buildLevel,
int numBuffers = 1 )

constructor.

Parameters
levelis passed on to the underlying SpatialIndex
buildLevelis also passed on to the SpatialIndex
numBufferscontrols how many output buffers are created. Don't use more than require because they eat up mucho RAM. The default is just one output buffer.

Definition at line 22 of file HTMesh.cpp.

◆ ~HTMesh()

HTMesh::~HTMesh ( )

Definition at line 64 of file HTMesh.cpp.

Member Function Documentation

◆ index()

Trixel HTMesh::index ( double ra,
double dec ) const

returns the index of the trixel that contains the specified point.

Definition at line 72 of file HTMesh.cpp.

◆ intersect() [1/4]

void HTMesh::intersect ( double ra,
double dec,
double radius,
BufNum bufNum = 0 )

NOTE: The intersect() routines below are all used to find the trixels needed to cover a geometric object: circle, line, triangle, and quadrilateral.

Since the number of trixels needed can be large and is not known a priori, you must construct a MeshIterator to iterate over the trixels that are the result of any of these 4 calculations.

The HTMesh is created with one or more output buffers used for storing the results. You can specify which output buffer is to be used to hold the results by supplying an optional integer bufNum parameter.

finds the trixels that cover the specified circle

Parameters
raCentral ra in degrees
decCentral dec in degrees
radiusRadius of the circle in degrees
bufNumthe output buffer to hold the results
Note
You will need to supply unprecessed (ra, dec) in most situations. Please see SkyMesh::aperture()'s code before messing with this method.

Definition at line 104 of file HTMesh.cpp.

◆ intersect() [2/4]

void HTMesh::intersect ( double ra1,
double dec1,
double ra2,
double dec2,
BufNum bufNum = 0 )

finds the trixels that cover the specified line segment

Definition at line 181 of file HTMesh.cpp.

◆ intersect() [3/4]

void HTMesh::intersect ( double ra1,
double dec1,
double ra2,
double dec2,
double ra3,
double dec3,
BufNum bufNum = 0 )

find the trixels that cover the specified triangle

Definition at line 116 of file HTMesh.cpp.

◆ intersect() [4/4]

void HTMesh::intersect ( double ra1,
double dec1,
double ra2,
double dec2,
double ra3,
double dec3,
double ra4,
double dec4,
BufNum bufNum = 0 )

finds the trixels that cover the specified quadrilateral

Definition at line 137 of file HTMesh.cpp.

◆ intersectSize()

int HTMesh::intersectSize ( BufNum bufNum = 0)

returns the number of trixels in the result buffer bufNum.

Definition at line 262 of file HTMesh.cpp.

◆ level()

int HTMesh::level ( ) const
inline

returns the mesh level.

Definition at line 122 of file HTMesh.h.

◆ meshBuffer()

MeshBuffer * HTMesh::meshBuffer ( BufNum bufNum = 0)

returns a pointer to the MeshBuffer specified by bufNum.

Currently this is only used in the MeshIterator constructor.

Definition at line 255 of file HTMesh.cpp.

◆ setDebug()

void HTMesh::setDebug ( int debug)
inline

sets the debug level which is used to print out intermediate results in the line intersection routine.

Definition at line 127 of file HTMesh.h.

◆ size()

int HTMesh::size ( ) const
inline

returns the total number of trixels in the HTM.

This number is 8 * 4^level.

Definition at line 118 of file HTMesh.h.

◆ vertices()

void HTMesh::vertices ( Trixel id,
double * ra1,
double * dec1,
double * ra2,
double * dec2,
double * ra3,
double * dec3 )

Definition at line 269 of file HTMesh.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:04 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.