|
HighMap library (C++)
|
A class to represent and manipulate 2D points that can carry a value. More...
#include <point.hpp>
Public Member Functions | |
| constexpr | Point () noexcept |
| Default constructor initializing the point to (0, 0, 0). | |
| constexpr | Point (float x, float y, float v=0.f) noexcept |
| Parameterized constructor initializing the point to given values. | |
| constexpr | Point (const glm::vec2 &xy, float v=0.f) noexcept |
| Constructs a Point from a glm::vec2 and an optional value. | |
| constexpr | Point (const glm::vec3 &xyv) noexcept |
| Constructs a Point from a glm::vec3 (x, y, v). | |
| constexpr glm::vec2 | to_vec2 () const noexcept |
| Converts the point's coordinates to glm::vec2. | |
| constexpr glm::vec3 | to_vec3 () const noexcept |
| Converts the point's coordinates and value to glm::vec3. | |
| constexpr bool | operator== (const Point &other) const noexcept |
| Equality operator to check if two points are the same. | |
| constexpr bool | operator!= (const Point &other) const noexcept |
| Inequality operator to check if two points are different. | |
| constexpr Point | operator+ (const Point &other) const noexcept |
| Adds two points. | |
| constexpr Point | operator- (const Point &other) const noexcept |
| Subtracts two points. | |
| constexpr Point | operator* (float scalar) const noexcept |
| Multiplies the point by a scalar. | |
| constexpr Point | operator/ (float scalar) const noexcept |
| Divides the point by a scalar. | |
| constexpr Point & | operator+= (const Point &other) noexcept |
| Adds another point to this point in-place. | |
| constexpr Point & | operator-= (const Point &other) noexcept |
| Subtracts another point from this point in-place. | |
| constexpr Point & | operator*= (float scalar) noexcept |
| Multiplies this point by a scalar in-place. | |
| constexpr Point & | operator/= (float scalar) noexcept |
| Divides this point by a scalar in-place. | |
| void | print () const |
| Prints the coordinates and value of the Point object. | |
| void | set_value_from_array (const Array &array, const BBox2D &bbox) |
| Updates the point's value based on bilinear interpolation from an array. | |
Public Attributes | |
| float | x |
| The x-coordinate of the point. | |
| float | y |
| The y-coordinate of the point. | |
| float | v |
| The value at the point. | |
Friends | |
| constexpr Point | operator* (float scalar, const Point &point) noexcept |
| Scalar multiplication (scalar * Point). | |
A class to represent and manipulate 2D points that can carry a value.
See unit tests: test_point.cpp
|
inlineconstexprnoexcept |
Default constructor initializing the point to (0, 0, 0).
|
inlineconstexprnoexcept |
Parameterized constructor initializing the point to given values.
| x | The x-coordinate of the point. |
| y | The y-coordinate of the point. |
| v | The value at the point. |
|
inlineexplicitconstexprnoexcept |
Constructs a Point from a glm::vec2 and an optional value.
| xy | 2D coordinate vector. |
| v | The value at the point. |
|
inlineexplicitconstexprnoexcept |
Constructs a Point from a glm::vec3 (x, y, v).
| xyv | 3D vector containing (x, y, v). |
|
inlineconstexprnoexcept |
Converts the point's coordinates to glm::vec2.
|
inlineconstexprnoexcept |
Converts the point's coordinates and value to glm::vec3.
|
inlineconstexprnoexcept |
Equality operator to check if two points are the same.
| other | The point to compare with. |
|
inlineconstexprnoexcept |
Inequality operator to check if two points are different.
| other | The point to compare with. |
Adds two points.
| other | The point to add. |
Subtracts two points.
| other | The point to subtract. |
|
inlineconstexprnoexcept |
Multiplies the point by a scalar.
| scalar | The scalar to multiply by. |
|
inlineconstexprnoexcept |
Divides the point by a scalar.
| scalar | The scalar to divide by. |
Adds another point to this point in-place.
| other | The point to add. |
Subtracts another point from this point in-place.
| other | The point to subtract. |
|
inlineconstexprnoexcept |
Multiplies this point by a scalar in-place.
| scalar | The scalar multiplier. |
|
inlineconstexprnoexcept |
Divides this point by a scalar in-place.
| scalar | The scalar divisor. |
| void hmap::Point::print | ( | ) | const |
Updates the point's value based on bilinear interpolation from an array.
| array | The input Array from which the value is interpolated. |
| bbox | Bounding box used for normalizing coordinates {xmin, xmax, ymin, ymax}. |
| float hmap::Point::x |
The x-coordinate of the point.
| float hmap::Point::y |
The y-coordinate of the point.
| float hmap::Point::v |
The value at the point.