Qt 4.8
Public Functions | Properties | List of all members
QKdPointFinder Class Reference

Public Functions

QKdPointTree::Traversal operator() (QKdPointTree::Node &node, int depth)
 
 QKdPointFinder (int point, const QPathSegments &segments, QKdPointTree &tree)
 
int result () const
 

Properties

int m_point
 
int m_result
 
const QPathSegmentsm_segments
 
QKdPointTreem_tree
 
qreal pointComponents [2]
 

Detailed Description

Definition at line 712 of file qpathclipper.cpp.

Constructors and Destructors

◆ QKdPointFinder()

QKdPointFinder::QKdPointFinder ( int  point,
const QPathSegments segments,
QKdPointTree tree 
)
inline

Definition at line 715 of file qpathclipper.cpp.

716  : m_point(point)
717  , m_result(-1)
718  , m_segments(&segments)
719  , m_tree(&tree)
720  {
721  pointComponents[0] = segments.pointAt(point).x();
722  pointComponents[1] = segments.pointAt(point).y();
723  }
const QPathSegments * m_segments
QKdPointTree * m_tree
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
qreal pointComponents[2]
const QPointF & pointAt(int vertex) const
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

Functions

◆ operator()()

QKdPointTree::Traversal QKdPointFinder::operator() ( QKdPointTree::Node node,
int  depth 
)
inline

Definition at line 725 of file qpathclipper.cpp.

726  {
727  if (m_result != -1)
729 
730  const QPointF &nodePoint = m_segments->pointAt(node.point);
731 
732  const qreal pivotComponents[] = { nodePoint.x(), nodePoint.y() };
733 
734  const qreal pivot = pivotComponents[depth & 1];
735  const qreal value = pointComponents[depth & 1];
736 
737  if (fuzzyIsNull(pivot - value)) {
738  const qreal pivot2 = pivotComponents[(depth + 1) & 1];
739  const qreal value2 = pointComponents[(depth + 1) & 1];
740 
741  if (fuzzyIsNull(pivot2 - value2)) {
742  if (node.id < 0)
743  node.id = m_tree->nextId();
744 
745  m_result = node.id;
747  } else
749  } else if (value < pivot) {
751  } else {
753  }
754  }
double qreal
Definition: qglobal.h:1193
const QPathSegments * m_segments
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
QKdPointTree * m_tree
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
qreal pointComponents[2]
const QPointF & pointAt(int vertex) const
static bool fuzzyIsNull(qreal d)
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287

◆ result()

int QKdPointFinder::result ( ) const
inline

Definition at line 756 of file qpathclipper.cpp.

Referenced by QPathSegments::mergePoints().

757  {
758  return m_result;
759  }

Properties

◆ m_point

int QKdPointFinder::m_point
private

Definition at line 762 of file qpathclipper.cpp.

◆ m_result

int QKdPointFinder::m_result
private

Definition at line 764 of file qpathclipper.cpp.

◆ m_segments

const QPathSegments* QKdPointFinder::m_segments
private

Definition at line 765 of file qpathclipper.cpp.

◆ m_tree

QKdPointTree* QKdPointFinder::m_tree
private

Definition at line 766 of file qpathclipper.cpp.

◆ pointComponents

qreal QKdPointFinder::pointComponents[2]
private

Definition at line 763 of file qpathclipper.cpp.


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