Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
point.H File Reference

2D point and geometric utilities. More...

#include <cmath>
#include <cstddef>
#include <limits>
#include <iomanip>
#include <string>
#include <ahAssert.H>
#include <ahUtils.H>
#include <ah-errors.H>
#include <utility>
#include <gmpfrxx.h>
Include dependency graph for point.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Geom_Object
 
struct  Point
 Rectangular point in the plane. More...
 
class  Polar_Point
 Polar representation of a 2D point. More...
 
class  Segment
 Fundamental segment defined by two points. More...
 
class  Triangle
 
class  Rectangle
 
class  Ellipse
 
class  Text
 

Typedefs

typedef mpq_class Geom_Number
 Numeric type used by the geometry module.
 

Functions

double geom_number_to_double (const Geom_Number &n)
 
std::ostream & operator<< (std::ostream &o, const Geom_Number &n)
 
Geom_Number area_of_parallelogram (const Point &a, const Point &b, const Point &c)
 Compute the area of parallelogram defined by vectors a->b and b->c.
 
Geom_Number pitag (const Geom_Number &x, const Geom_Number &y)
 Return the Euclidean distance.
 
Geom_Number arctan (const Geom_Number &m)
 Arc tangent of m (wrapper over mpfr).
 
Geom_Number arctan2 (const Geom_Number &m, const Geom_Number &n)
 Two-argument arc tangent (wrapper over mpfr).
 
Geom_Number sinus (const Geom_Number &x)
 Sine of x (wrapper over mpfr).
 
Geom_Number cosinus (const Geom_Number &x)
 Cosine of x (wrapper over mpfr).
 
Geom_Number square_root (const Geom_Number &x)
 Square root of x (wrapper over mpfr).
 
size_t aproximate_string_size (const std::string &str)
 

Variables

constexpr double PI = 3.1415926535897932384626433832795028841971693993751
 
constexpr double PI_2 = PI / 2.0
 
constexpr double PI_4 = PI / 4.0
 
const Point NullPoint
 

Detailed Description

2D point and geometric utilities.

This file provides classes for 2D points and geometric operations including distance calculations, vector operations, and coordinate transformations. Used by graph visualization and geometric algorithms.

Author
Leandro Rabindranath León

Definition in file point.H.

Typedef Documentation

◆ Geom_Number

Numeric type used by the geometry module.

Currently, this is an arbitrary precision rational (mpq_class). All helper routines convert to/from mpfr_class internally when transcendentals are required.

Definition at line 68 of file point.H.

Function Documentation

◆ aproximate_string_size()

size_t aproximate_string_size ( const std::string &  str)
inline

Definition at line 1489 of file point.H.

References Aleph::maps().

Referenced by TEST(), TEST(), TEST(), and TEST().

◆ arctan()

Geom_Number arctan ( const Geom_Number m)
inline

Arc tangent of m (wrapper over mpfr).

Definition at line 110 of file point.H.

References atan().

Referenced by Segment::mid_perpendicular(), and TEST().

◆ arctan2()

Geom_Number arctan2 ( const Geom_Number m,
const Geom_Number n 
)
inline

Two-argument arc tangent (wrapper over mpfr).

Definition at line 116 of file point.H.

References atan2().

Referenced by Polar_Point::Polar_Point(), Segment::counterclockwise_angle_with(), and TEST().

◆ area_of_parallelogram()

Geom_Number area_of_parallelogram ( const Point a,
const Point b,
const Point c 
)
inline

Compute the area of parallelogram defined by vectors a->b and b->c.

Definition at line 1577 of file point.H.

References Point::get_x(), and Point::get_y().

Referenced by Triangle::Triangle(), Triangle::Triangle(), Triangle::Triangle(), Point::is_clockwise_with(), Point::is_colinear_with(), Point::is_to_left_from(), Point::is_to_right_from(), TEST(), and TEST().

◆ cosinus()

Geom_Number cosinus ( const Geom_Number x)
inline

Cosine of x (wrapper over mpfr).

Definition at line 128 of file point.H.

References cos().

Referenced by TEST().

◆ geom_number_to_double()

◆ operator<<()

std::ostream & operator<< ( std::ostream &  o,
const Geom_Number n 
)
inline

Definition at line 75 of file point.H.

References __gmp_expr< mpq_t, mpq_t >::get_d().

◆ pitag()

Geom_Number pitag ( const Geom_Number x,
const Geom_Number y 
)
inline

Return the Euclidean distance.

Euclidean distance of the vector (x, y).

Definition at line 104 of file point.H.

References hypot(), and y.

Referenced by Polar_Point::Polar_Point(), Segment::mid_perpendicular(), process_tag_node(), Segment::size(), TEST(), and TEST().

◆ sinus()

Geom_Number sinus ( const Geom_Number x)
inline

Sine of x (wrapper over mpfr).

Definition at line 122 of file point.H.

References sin().

Referenced by TEST().

◆ square_root()

Geom_Number square_root ( const Geom_Number x)
inline

Square root of x (wrapper over mpfr).

Definition at line 134 of file point.H.

References sqrt().

Referenced by Ellipse::compute_tangents(), Segment::compute_tgt_point(), Ellipse::intersection_with(), and TEST().

Variable Documentation

◆ NullPoint

const Point NullPoint
extern

Definition at line 41 of file point.C.

Referenced by K2Tree< T >::nearest(), TEST(), TEST(), TEST(), and TEST().

◆ PI

constexpr double PI = 3.1415926535897932384626433832795028841971693993751
constexpr

◆ PI_2

constexpr double PI_2 = PI / 2.0
constexpr

Definition at line 86 of file point.H.

Referenced by process_tag_node(), and TEST_F().

◆ PI_4

constexpr double PI_4 = PI / 4.0
constexpr

Definition at line 87 of file point.H.

Referenced by process_tag_node().