HighMap library (C++)
Loading...
Searching...
No Matches
point.hpp File Reference

Go to the source code of this file.

Classes

class  hmap::Point
 A class to represent and manipulate 2D points that can carry a value. More...

Namespaces

namespace  hmap

Functions

float hmap::angle (const Point &p1, const Point &p2)
 Computes the angle between two points relative to the x-axis.
float hmap::angle (const Point &p0, const Point &p1, const Point &p2)
 Computes the angle formed by three points with p0 as the origin.
float hmap::classify_point (const Point &p_prev, const Point &p, const Point &p_next, const Point &pq)
 Classify point convexity relative to neighboring curve vertices.
float hmap::cross_product (const Point &p0, const Point &p1, const Point &p2)
 Computes the 2D cross product of vectors (p1 - p0) and (p2 - p0).
float hmap::cross_product (const Point &p1, const Point &p2)
 Computes the 2D cross product of vectors p1 and p2.
float hmap::curvature (const Point &p1, const Point &p2, const Point &p3)
 Calculates the curvature formed by three points in 2D space.
float hmap::curvature_signed (const Point &p1, const Point &p2, const Point &p3)
 Calculates the signed curvature formed by three points in 2D space.
float hmap::distance (const Point &p1, const Point &p2)
 Calculates the Euclidean distance between two points.
float hmap::distance_squared (const Point &p1, const Point &p2)
 Calculates the squared Euclidean distance between two points.
Point hmap::interp_bezier (const Point &p_start, const Point &p_ctrl_start, const Point &p_ctrl_end, const Point &p_end, float t)
 Performs a cubic Bezier interpolation.
Point hmap::interp_bspline (const Point &p0, const Point &p1, const Point &p2, const Point &p3, float t)
 Performs a cubic B-spline interpolation.
Point hmap::interp_catmullrom (const Point &p0, const Point &p1, const Point &p2, const Point &p3, float t)
 Performs a Catmull-Rom spline interpolation.
Point hmap::interp_decasteljau (const std::vector< Point > &points, float t)
 Performs a De Casteljau algorithm-based interpolation for Bezier curves.
BBox2D hmap::intersect_bounding_boxes (const BBox2D &bbox1, const BBox2D &bbox2)
 Determines the intersection of two bounding boxes.
bool hmap::is_point_within_bounding_box (const Point &p, const BBox2D &bbox)
 Checks if a point is within a specified bounding box.
bool hmap::is_point_within_bounding_box (float x, float y, const BBox2D &bbox)
 Checks if a point with coordinates (x, y) is within a specified bounding box.
Point hmap::lerp (const Point &p1, const Point &p2, float t)
 Linearly interpolates between two points.
Point hmap::midpoint (const Point &p1, const Point &p2, int orientation, float distance_ratio, float t=0.5f)
 Computes the midpoint displacement with a perpendicular offset.
Point hmap::scale (const Point &p, glm::vec2 scale, glm::vec2 center={0.5f, 0.5f})
 Scales a point relative to a center point.
Point hmap::scale (const Point &p, float scale, glm::vec2 center={0.5f, 0.5f})
 Scales a point uniformly relative to a center point.
std::optional< Point > hmap::segment_intersection (const Point &p1, const Point &p2, const Point &q1, const Point &q2)
 Computes the intersection point of two 2D segments, if it exists.
float hmap::side (const Point &p1, const Point &p2, const Point &p3, const Point &p_query)
 Determines the relative side of a query point with respect to a curve segment.
void hmap::sort_points (std::vector< Point > &points)
 Sorts a vector of points in ascending order (x, then y, then v).
float hmap::triangle_area (const Point &p1, const Point &p2, const Point &p3)
 Calculates the unsigned area of a triangle formed by three points.
float hmap::triangle_area_signed (const Point &p1, const Point &p2, const Point &p3)
 Calculates the signed area of a triangle formed by three points.
BBox2D hmap::unit_square_bbox ()
 Constructs a 4D bounding box for a unit square {0, 1, 0, 1}.

Detailed Description