header_utils
Loading...
Searching...
No Matches
ghassanpl::geometry Namespace Reference

Angles. More...

Namespaces

namespace  squares
 

Classes

struct  basic_line_t
 TODO: This all needs to be tested. More...
 
struct  tpolyline
 Polyline. More...
 

Concepts

concept  shape
 Shape Concept.
 
concept  area_shape
 Area Shape Concept.
 

Typedefs

using direction_set = enum_flags< direction, uint8_t >
 TODO: names, compass name.
 
using ellipse = tellipse< float >
 
using rec2 = trec2< float >
 
using irec2 = trec2< int >
 
template<std::floating_point T>
using basic_radians_t = named< T, "radians", traits::displacement >
 
template<std::floating_point T>
using basic_degrees_t = named< T, "degrees", traits::displacement >
 
template<std::floating_point T>
using basic_heading_t = named< T, "heading", traits::location, traits::is_location_of< basic_degrees_t< T > > >
 
using degrees = basic_degrees_t< float >
 
using radians = basic_radians_t< float >
 
using heading = basic_heading_t< float >
 
template<typename T >
using basic_polar2d_t = named< glm::tvec2< T >, "polar", traits::location >
 
using polar2d = basic_polar2d_t< float >
 
using polygon = tpolygon< float >
 
using ray = tray< float >
 
using segment = tsegment< float >
 
using triangle = ttriangle< float >
 
using indexed_triangle = tindexed_triangle< size_t >
 

Enumerations

enum class  direction {
  none , right , right_down , down ,
  left_down , left , left_up , up ,
  right_up , east , south_east , south ,
  south_west , west , north_west , north ,
  north_east
}
 
enum class  winding_order { clockwise , counter_clockwise }
 

Functions

constexpr direction operator+ (direction dir, int d)
 
constexpr direction operator- (direction dir, int d)
 
constexpr direction & operator++ (direction &dir)
 
constexpr direction & operator-- (direction &dir)
 
constexpr direction operator++ (direction &dir, int)
 
constexpr direction operator-- (direction &dir, int)
 
constexpr direction opposite (direction dir)
 
constexpr direction next_cardinal (direction dir)
 
constexpr direction prev_cardinal (direction dir)
 
constexpr bool is_valid (direction dir)
 
constexpr bool is_cardinal (direction dir)
 
constexpr bool is_diagonal (direction dir)
 
constexpr int horizontal (direction dir)
 
constexpr int vertical (direction dir)
 
constexpr degrees to_angle (direction val)
 
constexpr glm::ivec2 to_ivec (direction val)
 
constexpr glm::vec2 to_vec (direction val)
 
constexpr ghassanpl::align to_alignment (direction val)
 
direction to_direction (degrees angle)
 
direction to_direction (glm::vec2 val)
 
direction to_direction (glm::ivec2 vec)
 
template<typename T >
constexprdot (glm::tvec2< T > const &a, glm::tvec2< T > const &b) noexcept
 
template<typename T >
constexpr glm::tvec2< T > length (glm::tvec2< T > const &a) noexcept
 
template<typename T >
constexpr std::pair< glm::tvec2< T >, T > dir_and_length (glm::tvec2< T > const &a) noexcept
 
template<typename T >
constexpr glm::tvec2< T > with_length (glm::tvec2< T > const &a, T length) noexcept
 
template<typename T >
constexpr glm::tvec2< T > clamp_length (glm::tvec2< T > const &a, T min, T max) noexcept
 
template<typename T >
constexpr glm::tvec2< T > max_length (glm::tvec2< T > const &a, T max) noexcept
 
template<typename TARGET , std::floating_point T>
requires std::same_as<TARGET, basic_degrees_t<T>>
constexpr TARGET named_cast (basic_radians_t< T > const &radians)
 
template<typename TARGET , std::floating_point T>
requires std::same_as<TARGET, basic_radians_t<T>>
constexpr TARGET named_cast (basic_degrees_t< T > const &degrees)
 
template<typename T >
auto rho (basic_polar2d_t< T > const &polar)
 
template<typename T >
auto phi (basic_polar2d_t< T > const &polar)
 
template<typename T >
auto theta (basic_polar2d_t< T > const &polar)
 
template<typename T >
basic_polar2d_t< T > polar (glm::tvec2< T > const &euclidean)
 
template<typename T >
glm::tvec2< T > euclidean (basic_polar2d_t< T > const &polar)
 
template<typename T >
basic_line_t< T > line_crossing_points (glm::tvec2< T > const &p1, glm::tvec2< T > const &p2)
 
template<typename T >
basic_line_t< T > line_from_dir (glm::tvec2< T > const &dir)
 
template<std::ranges::range RANGE, typename T = std::ranges::range_value_t<RANGE>>
constexpr bool are_colinear (RANGE const &range, T tolerance=precision_limits< T >::point_on_line_max_distance)
 
template<typename POLY >
auto calculate_indexed_triangle_area (POLY const &poly, indexed_triangle const &triangle)
 
template<typename TR >
auto calculate_total_area (TR const &trpoly)
 
template<typename T >
polygon_triangulation< T > triangulate (tpolygon< T > const &poly)
 
template<typename T >
tpolygon< T > polygon_from (const trec2< T > &r)
 
template<typename T >
std::array< tsegment< T >, 4 > edges_of (const trec2< T > &r)
 
template<typename T , shape< T > S>
auto distance (S const &sh, glm::tvec2< T > pt)
 
template<typename T , shape< T > S>
auto distance (glm::tvec2< T > pt, S const &sh)
 
template<typename T , shape< T > S>
auto distance_squared (S const &sh, glm::tvec2< T > pt)
 
template<typename T , shape< T > S>
auto distance_squared (glm::tvec2< T > pt, S const &sh)
 

Variables

static constexpr auto direction_count
 
static constexpr direction_set all_cardinal_directions
 
static constexpr direction_set all_diagonal_directions
 
static constexpr direction_set all_directions
 

Detailed Description

Angles.

Lines.


Class Documentation

◆ ghassanpl::geometry::tpolyline

struct ghassanpl::geometry::tpolyline
template<std::floating_point T>
struct ghassanpl::geometry::tpolyline< T >

Polyline.

Definition at line 344 of file polygon.h.

Typedef Documentation

◆ basic_degrees_t

template<std::floating_point T>
using ghassanpl::geometry::basic_degrees_t = typedef named<T, "degrees", traits::displacement>

Definition at line 149 of file geometry_common.h.

◆ basic_heading_t

template<std::floating_point T>
using ghassanpl::geometry::basic_heading_t = typedef named<T, "heading", traits::location, traits::is_location_of<basic_degrees_t<T> >>

Definition at line 151 of file geometry_common.h.

◆ basic_polar2d_t

template<typename T >
using ghassanpl::geometry::basic_polar2d_t = typedef named<glm::tvec2<T>, "polar", traits::location>

Definition at line 203 of file geometry_common.h.

◆ basic_radians_t

template<std::floating_point T>
using ghassanpl::geometry::basic_radians_t = typedef named<T, "radians", traits::displacement>

Definition at line 148 of file geometry_common.h.

◆ degrees

using ghassanpl::geometry::degrees = typedef basic_degrees_t<float>

Definition at line 153 of file geometry_common.h.

◆ direction_set

TODO: names, compass name.

Definition at line 40 of file direction.h.

◆ ellipse

using ghassanpl::geometry::ellipse = typedef tellipse<float>

Definition at line 57 of file ellipse.h.

◆ heading

using ghassanpl::geometry::heading = typedef basic_heading_t<float>

Definition at line 155 of file geometry_common.h.

◆ indexed_triangle

using ghassanpl::geometry::indexed_triangle = typedef tindexed_triangle<size_t>

Definition at line 106 of file triangles.h.

◆ irec2

using ghassanpl::geometry::irec2 = typedef trec2<int>

Definition at line 56 of file geometry_common.h.

◆ polar2d

using ghassanpl::geometry::polar2d = typedef basic_polar2d_t<float>

Definition at line 205 of file geometry_common.h.

◆ polygon

using ghassanpl::geometry::polygon = typedef tpolygon<float>

Definition at line 150 of file polygon.h.

◆ radians

using ghassanpl::geometry::radians = typedef basic_radians_t<float>

Definition at line 154 of file geometry_common.h.

◆ ray

using ghassanpl::geometry::ray = typedef tray<float>

Definition at line 45 of file ray.h.

◆ rec2

using ghassanpl::geometry::rec2 = typedef trec2<float>

Definition at line 55 of file geometry_common.h.

◆ segment

using ghassanpl::geometry::segment = typedef tsegment<float>

Definition at line 95 of file segment.h.

◆ triangle

using ghassanpl::geometry::triangle = typedef ttriangle<float>

Definition at line 78 of file triangles.h.

Enumeration Type Documentation

◆ direction

enum class ghassanpl::geometry::direction
strong

Definition at line 13 of file direction.h.

◆ winding_order

enum class ghassanpl::geometry::winding_order
strong

Definition at line 58 of file geometry_common.h.

Function Documentation

◆ are_colinear()

template<std::ranges::range RANGE, typename T = std::ranges::range_value_t<RANGE>>
constexpr bool ghassanpl::geometry::are_colinear ( RANGE const range,
tolerance = precision_limits<T>::point_on_line_max_distance 
)
constexpr

Definition at line 12 of file points.h.

◆ calculate_indexed_triangle_area()

template<typename POLY >
auto ghassanpl::geometry::calculate_indexed_triangle_area ( POLY const poly,
indexed_triangle const triangle 
)

Definition at line 206 of file polygon.h.

◆ calculate_total_area()

template<typename TR >
auto ghassanpl::geometry::calculate_total_area ( TR const trpoly)

Definition at line 216 of file polygon.h.

◆ clamp_length()

template<typename T >
constexpr glm::tvec2< T > ghassanpl::geometry::clamp_length ( glm::tvec2< T > const a,
min,
max 
)
constexprnoexcept

Definition at line 96 of file geometry_common.h.

◆ dir_and_length()

template<typename T >
constexpr std::pair< glm::tvec2< T >, T > ghassanpl::geometry::dir_and_length ( glm::tvec2< T > const a)
constexprnoexcept

Definition at line 80 of file geometry_common.h.

◆ distance() [1/2]

template<typename T , shape< T > S>
auto ghassanpl::geometry::distance ( glm::tvec2< T >  pt,
S const sh 
)

Definition at line 38 of file shape_concepts.h.

◆ distance() [2/2]

template<typename T , shape< T > S>
auto ghassanpl::geometry::distance ( S const sh,
glm::tvec2< T >  pt 
)

Definition at line 37 of file shape_concepts.h.

◆ distance_squared() [1/2]

template<typename T , shape< T > S>
auto ghassanpl::geometry::distance_squared ( glm::tvec2< T >  pt,
S const sh 
)

Definition at line 41 of file shape_concepts.h.

◆ distance_squared() [2/2]

template<typename T , shape< T > S>
auto ghassanpl::geometry::distance_squared ( S const sh,
glm::tvec2< T >  pt 
)

Definition at line 40 of file shape_concepts.h.

◆ dot()

template<typename T >
constexpr T ghassanpl::geometry::dot ( glm::tvec2< T > const a,
glm::tvec2< T > const b 
)
constexprnoexcept

Definition at line 65 of file geometry_common.h.

◆ edges_of()

template<typename T >
std::array< tsegment< T >, 4 > ghassanpl::geometry::edges_of ( const trec2< T > &  r)

Definition at line 26 of file rectangles.h.

◆ euclidean()

template<typename T >
glm::tvec2< T > ghassanpl::geometry::euclidean ( basic_polar2d_t< T > const polar)

Definition at line 220 of file geometry_common.h.

◆ horizontal()

constexpr int ghassanpl::geometry::horizontal ( direction  dir)
constexpr

Definition at line 68 of file direction.h.

◆ is_cardinal()

constexpr bool ghassanpl::geometry::is_cardinal ( direction  dir)
constexpr

Definition at line 65 of file direction.h.

◆ is_diagonal()

constexpr bool ghassanpl::geometry::is_diagonal ( direction  dir)
constexpr

Definition at line 66 of file direction.h.

◆ is_valid()

constexpr bool ghassanpl::geometry::is_valid ( direction  dir)
constexpr

Definition at line 64 of file direction.h.

◆ length()

template<typename T >
constexpr glm::tvec2< T > ghassanpl::geometry::length ( glm::tvec2< T > const a)
constexprnoexcept

Definition at line 74 of file geometry_common.h.

◆ line_crossing_points()

template<typename T >
basic_line_t< T > ghassanpl::geometry::line_crossing_points ( glm::tvec2< T > const p1,
glm::tvec2< T > const p2 
)

Definition at line 255 of file geometry_common.h.

◆ line_from_dir()

template<typename T >
basic_line_t< T > ghassanpl::geometry::line_from_dir ( glm::tvec2< T > const dir)

Definition at line 261 of file geometry_common.h.

◆ max_length()

template<typename T >
constexpr glm::tvec2< T > ghassanpl::geometry::max_length ( glm::tvec2< T > const a,
max 
)
constexprnoexcept

Definition at line 110 of file geometry_common.h.

◆ named_cast() [1/2]

template<typename TARGET , std::floating_point T>
requires std::same_as<TARGET, basic_radians_t<T>>
constexpr TARGET ghassanpl::geometry::named_cast ( basic_degrees_t< T > const degrees)
constexpr

Definition at line 166 of file geometry_common.h.

◆ named_cast() [2/2]

template<typename TARGET , std::floating_point T>
requires std::same_as<TARGET, basic_degrees_t<T>>
constexpr TARGET ghassanpl::geometry::named_cast ( basic_radians_t< T > const radians)
constexpr

Definition at line 159 of file geometry_common.h.

◆ next_cardinal()

constexpr direction ghassanpl::geometry::next_cardinal ( direction  dir)
constexpr

Definition at line 57 of file direction.h.

◆ operator+()

constexpr direction ghassanpl::geometry::operator+ ( direction  dir,
int  d 
)
constexpr

Definition at line 47 of file direction.h.

◆ operator++() [1/2]

constexpr direction & ghassanpl::geometry::operator++ ( direction &  dir)
constexpr

Definition at line 50 of file direction.h.

◆ operator++() [2/2]

constexpr direction ghassanpl::geometry::operator++ ( direction &  dir,
int   
)
constexpr

Definition at line 53 of file direction.h.

◆ operator-()

constexpr direction ghassanpl::geometry::operator- ( direction  dir,
int  d 
)
constexpr

Definition at line 48 of file direction.h.

◆ operator--() [1/2]

constexpr direction & ghassanpl::geometry::operator-- ( direction &  dir)
constexpr

Definition at line 51 of file direction.h.

◆ operator--() [2/2]

constexpr direction ghassanpl::geometry::operator-- ( direction &  dir,
int   
)
constexpr

Definition at line 54 of file direction.h.

◆ opposite()

constexpr direction ghassanpl::geometry::opposite ( direction  dir)
constexpr

Definition at line 56 of file direction.h.

◆ phi()

template<typename T >
auto ghassanpl::geometry::phi ( basic_polar2d_t< T > const polar)
inline

Definition at line 208 of file geometry_common.h.

◆ polar()

template<typename T >
basic_polar2d_t< T > ghassanpl::geometry::polar ( glm::tvec2< T > const euclidean)

Definition at line 212 of file geometry_common.h.

◆ polygon_from()

template<typename T >
tpolygon< T > ghassanpl::geometry::polygon_from ( const trec2< T > &  r)

Definition at line 15 of file rectangles.h.

◆ prev_cardinal()

constexpr direction ghassanpl::geometry::prev_cardinal ( direction  dir)
constexpr

Definition at line 58 of file direction.h.

◆ rho()

template<typename T >
auto ghassanpl::geometry::rho ( basic_polar2d_t< T > const polar)
inline

Definition at line 207 of file geometry_common.h.

◆ theta()

template<typename T >
auto ghassanpl::geometry::theta ( basic_polar2d_t< T > const polar)
inline

Definition at line 209 of file geometry_common.h.

◆ to_angle()

constexpr degrees ghassanpl::geometry::to_angle ( direction  val)
constexpr

Definition at line 71 of file direction.h.

◆ to_direction() [1/2]

direction ghassanpl::geometry::to_direction ( degrees  angle)
inline

Definition at line 89 of file direction.h.

◆ to_direction() [2/2]

direction ghassanpl::geometry::to_direction ( glm::ivec2  vec)
inline

Definition at line 95 of file direction.h.

◆ to_ivec()

constexpr glm::ivec2 ghassanpl::geometry::to_ivec ( direction  val)
constexpr

Definition at line 80 of file direction.h.

◆ to_vec()

constexpr glm::vec2 ghassanpl::geometry::to_vec ( direction  val)
constexpr

Definition at line 81 of file direction.h.

◆ triangulate()

template<typename T >
polygon_triangulation< T > ghassanpl::geometry::triangulate ( tpolygon< T > const poly)

Definition at line 226 of file polygon.h.

◆ vertical()

constexpr int ghassanpl::geometry::vertical ( direction  dir)
constexpr

Definition at line 69 of file direction.h.

◆ with_length()

template<typename T >
constexpr glm::tvec2< T > ghassanpl::geometry::with_length ( glm::tvec2< T > const a,
length 
)
constexprnoexcept

Definition at line 89 of file geometry_common.h.

Variable Documentation

◆ all_cardinal_directions

constexpr direction_set ghassanpl::geometry::all_cardinal_directions
inlinestaticconstexpr

Definition at line 60 of file direction.h.

◆ all_diagonal_directions

constexpr direction_set ghassanpl::geometry::all_diagonal_directions
inlinestaticconstexpr

Definition at line 61 of file direction.h.

◆ all_directions

constexpr direction_set ghassanpl::geometry::all_directions
inlinestaticconstexpr

Definition at line 62 of file direction.h.

◆ direction_count

constexpr auto ghassanpl::geometry::direction_count
staticconstexpr

Definition at line 36 of file direction.h.