GEOS  3.9.1dev
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::noding::snapround::HotPixel Class Reference

Implements a "hot pixel" as used in the Snap Rounding algorithm. More...

#include <HotPixel.h>

Collaboration diagram for geos::noding::snapround::HotPixel:
[legend]

Public Member Functions

double getWidth () const
 
double getScaleFactor () const
 
 HotPixel (const geom::Coordinate &pt, double scaleFactor)
 
const geom::CoordinategetCoordinate () const
 
bool intersects (const geom::Coordinate &p0, const geom::Coordinate &p1) const
 
bool intersects (const geom::Coordinate &p) const
 
bool isNode () const
 
void setToNode ()
 
std::ostream & operator<< (std::ostream &os)
 

Private Member Functions

double scaleRound (double val) const
 
double scale (double val) const
 
bool intersectsPixelClosure (const geom::Coordinate &p0, const geom::Coordinate &p1) const
 
bool intersectsScaled (double p0x, double p0y, double p1x, double p1y) const
 
 HotPixel (const HotPixel &other)=delete
 
HotPixeloperator= (const HotPixel &rhs)=delete
 

Private Attributes

geom::Coordinate originalPt
 
double scaleFactor
 
bool hpIsNode
 
double hpx
 
double hpy
 

Static Private Attributes

static constexpr double TOLERANCE = 0.5
 
static constexpr int UPPER_RIGHT = 0
 
static constexpr int UPPER_LEFT = 1
 
static constexpr int LOWER_LEFT = 2
 
static constexpr int LOWER_RIGHT = 3
 

Detailed Description

Implements a "hot pixel" as used in the Snap Rounding algorithm.

A hot pixel contains the interior of the tolerance square and the boundary minus the top and right segments.

The hot pixel operations are all computed in the integer domain to avoid rounding problems.

Definition at line 63 of file HotPixel.h.

Constructor & Destructor Documentation

geos::noding::snapround::HotPixel::HotPixel ( const HotPixel other)
privatedelete
geos::noding::snapround::HotPixel::HotPixel ( const geom::Coordinate pt,
double  scaleFactor 
)

Creates a new hot pixel.

Parameters
ptthe coordinate at the centre of the pixel. Will be kept by reference, so make sure to keep it alive.
scaleFactorthe scaleFactor determining the pixel size

Member Function Documentation

const geom::Coordinate& geos::noding::snapround::HotPixel::getCoordinate ( ) const
double geos::noding::snapround::HotPixel::getScaleFactor ( ) const
inline

Definition at line 104 of file HotPixel.h.

double geos::noding::snapround::HotPixel::getWidth ( ) const
inline

Gets the width of the hot pixel in the original coordinate system.

Definition at line 102 of file HotPixel.h.

bool geos::noding::snapround::HotPixel::intersects ( const geom::Coordinate p0,
const geom::Coordinate p1 
) const

Tests whether the line segment (p0-p1) intersects this hot pixel.

Parameters
p0the first coordinate of the line segment to test
p1the second coordinate of the line segment to test
Returns
true if the line segment intersects this hot pixel
bool geos::noding::snapround::HotPixel::intersects ( const geom::Coordinate p) const

Tests whether a coordinate lies in (intersects) this hot pixel.

Parameters
pthe coordinate to test
Returns
true if the coordinate intersects this hot pixel
bool geos::noding::snapround::HotPixel::intersectsPixelClosure ( const geom::Coordinate p0,
const geom::Coordinate p1 
) const
private
bool geos::noding::snapround::HotPixel::intersectsScaled ( double  p0x,
double  p0y,
double  p1x,
double  p1y 
) const
private
bool geos::noding::snapround::HotPixel::isNode ( ) const
inline

Definition at line 139 of file HotPixel.h.

std::ostream& geos::noding::snapround::HotPixel::operator<< ( std::ostream &  os)
HotPixel& geos::noding::snapround::HotPixel::operator= ( const HotPixel rhs)
privatedelete
double geos::noding::snapround::HotPixel::scale ( double  val) const
private
double geos::noding::snapround::HotPixel::scaleRound ( double  val) const
private
void geos::noding::snapround::HotPixel::setToNode ( )
inline

Definition at line 140 of file HotPixel.h.

References geos::geom::operator<<().

Here is the call graph for this function:

Member Data Documentation

bool geos::noding::snapround::HotPixel::hpIsNode
private

Definition at line 78 of file HotPixel.h.

double geos::noding::snapround::HotPixel::hpx
private

Definition at line 81 of file HotPixel.h.

double geos::noding::snapround::HotPixel::hpy
private

Definition at line 82 of file HotPixel.h.

constexpr int geos::noding::snapround::HotPixel::LOWER_LEFT = 2
staticprivate

Definition at line 71 of file HotPixel.h.

constexpr int geos::noding::snapround::HotPixel::LOWER_RIGHT = 3
staticprivate

Definition at line 72 of file HotPixel.h.

geom::Coordinate geos::noding::snapround::HotPixel::originalPt
private

Definition at line 74 of file HotPixel.h.

double geos::noding::snapround::HotPixel::scaleFactor
private

Definition at line 75 of file HotPixel.h.

constexpr double geos::noding::snapround::HotPixel::TOLERANCE = 0.5
staticprivate

Definition at line 67 of file HotPixel.h.

constexpr int geos::noding::snapround::HotPixel::UPPER_LEFT = 1
staticprivate

Definition at line 70 of file HotPixel.h.

constexpr int geos::noding::snapround::HotPixel::UPPER_RIGHT = 0
staticprivate

Definition at line 69 of file HotPixel.h.


The documentation for this class was generated from the following file: