YODAU 1.0
YEAR OF THE DEPEND ADULT UNDERGARMENT
Loading...
Searching...
No Matches
yodau::backend::point Struct Reference

Point in percentage-based image coordinates. More...

#include <backend/include/geometry.hpp>

Public Member Functions

float distance_to (const point &other) const
 Compute Euclidean distance to another point.
bool compare (const point &other) const
 Compare two points with tolerance epsilon.

Public Attributes

float x {}
 Horizontal coordinate (percentage of width).
float y {}
 Vertical coordinate (percentage of height).

Static Public Attributes

static constexpr float epsilon { 0.001f }
 Tolerance used for fuzzy point comparisons.

Detailed Description

Point in percentage-based image coordinates.

Coordinates are expressed in the range [0.0; 100.0], where:

  • x = 0 is the left edge, x = 100 is the right edge
  • y = 0 is the top edge, y = 100 is the bottom edge

Definition at line 19 of file geometry.hpp.

Member Function Documentation

◆ compare()

bool yodau::backend::point::compare ( const point & other) const

Compare two points with tolerance epsilon.

The comparison is component-wise:

abs(x - other.x) < epsilon && abs(y - other.y) < epsilon
float x
Horizontal coordinate (percentage of width).
Definition geometry.hpp:23
float y
Vertical coordinate (percentage of height).
Definition geometry.hpp:28
static constexpr float epsilon
Tolerance used for fuzzy point comparisons.
Definition geometry.hpp:33
Parameters
otherPoint to compare to.
Returns
true if points are equal within tolerance.

Definition at line 13 of file geometry.cpp.

13 {
14 return std::fabs(x - other.x) < epsilon && std::fabs(y - other.y) < epsilon;
15}

References epsilon, x, and y.

◆ distance_to()

float yodau::backend::point::distance_to ( const point & other) const

Compute Euclidean distance to another point.

Distance is computed in percentage units.

Parameters
otherTarget point.
Returns
Euclidean distance between this and other.

Definition at line 7 of file geometry.cpp.

7 {
8 const float dx = x - other.x;
9 const float dy = y - other.y;
10 return std::sqrt(dx * dx + dy * dy);
11}

References x, and y.

Member Data Documentation

◆ epsilon

float yodau::backend::point::epsilon { 0.001f }
staticconstexpr

Tolerance used for fuzzy point comparisons.

Definition at line 33 of file geometry.hpp.

33{ 0.001f };

Referenced by compare().

◆ x

float yodau::backend::point::x {}

Horizontal coordinate (percentage of width).

Definition at line 23 of file geometry.hpp.

23{}; // percentage [0.0; 100.0]

Referenced by compare(), and distance_to().

◆ y

float yodau::backend::point::y {}

Vertical coordinate (percentage of height).

Definition at line 28 of file geometry.hpp.

28{}; // percentage [0.0; 100.0]

Referenced by compare(), and distance_to().


The documentation for this struct was generated from the following files: