Terrain Rasterizer
Conversion of GPS data into 2.5D topographic maps
Loading...
Searching...
No Matches
quadtree.cpp File Reference

Implementation of the QuadTree for spatial indexing. More...

#include "quadtree.hpp"
#include <algorithm>
#include <iostream>
Include dependency graph for quadtree.cpp:

Functions

BoundingBox getTriangleBounds (const Triangle &t, const std::vector< Point > &points)
 Computes the bounding box of a single triangle.
 
bool isPointInTriangle (double px, double py, const Point &p1, const Point &p2, const Point &p3)
 Checks if a 2D point lies inside a 2D triangle using barycentric coordinates.
 

Detailed Description

Implementation of the QuadTree for spatial indexing.

Function Documentation

◆ getTriangleBounds()

BoundingBox getTriangleBounds ( const Triangle t,
const std::vector< Point > &  points 
)

Computes the bounding box of a single triangle.

Parameters
tThe triangle.
pointsThe list of vertex points.
Returns
BoundingBox The minimal bounding box containing the triangle.

◆ isPointInTriangle()

bool isPointInTriangle ( double  px,
double  py,
const Point p1,
const Point p2,
const Point p3 
)

Checks if a 2D point lies inside a 2D triangle using barycentric coordinates.

Parameters
pxX coordinate of the point.
pyY coordinate of the point.
p1First vertex of the triangle.
p2Second vertex of the triangle.
p3Third vertex of the triangle.
Returns
true if the point is inside or on the edge, false otherwise.