recti namespace
Classes
- class Recti
- A class for saying hello in multiple languages.
- class Vdcorput
- van der Corput sequence generator
- class halton
- Halton sequence generator.
-
template<typename T = int>class Interval
- Interval.
-
template<typename T1 = int, typename T2 = T1>class MergeObj
- Merging Object (for deferred-merge embedding (DME) algorithm)
-
template<typename T1 = int, typename T2 = T1>class Point
- Point.
-
template<typename T>class Polygon
- Polygon.
-
template<typename T>struct Rectangle
- Rectangle (Rectilinear)
-
template<typename T>struct HSegment
- Horizontal Line Segment.
-
template<typename T>struct VSegment
- Vertical Line Segment.
-
template<typename T>class RPolygon
- Rectilinear Polygon.
-
template<typename T1, typename T2 = T1>class Vector2
- vector2
Enums
- enum class LanguageCode { EN, DE, ES, FR }
Functions
-
template<typename U1, typename U2>auto overlap(const U1& lhs, const U2& rhs) -> bool -> auto constexpr
- Checks if two objects overlap.
-
template<typename U1, typename U2>auto contain(const U1& lhs, const U2& rhs) -> bool -> auto constexpr
- Check if one object contains another object.
-
template<typename U1, typename U2>auto intersection(const U1& lhs, const U2& rhs) -> auto constexpr
- Computes the intersection of two objects.
-
template<typename U1, typename U2>auto min_dist(const U1& lhs, const U2& rhs) -> auto constexpr
- Calculates the minimum distance between two objects
lhs
andrhs
. -
template<typename U1, typename U2>auto min_dist_change(U1& lhs, U2& rhs) -> auto constexpr
- Calculates the minimum distance between two objects
lhs
andrhs
, with the ability to handle a change in the objects. - auto vdc(unsigned num, unsigned base = 2, unsigned scale = 10) noexcept -> unsigned -> auto
- van der Corput sequence
-
template<typename U1, typename U2>auto enlarge(const U1& lhs, const U2& rhs) -> auto constexpr
- Enlarges an interval or scalar value by adding and subtracting a given value.
-
template<class Stream, typename T>auto operator<<(Stream& out, const Polygon<T>& poly) -> Stream & -> auto
- Writes the vertices of a polygon to an output stream in a format suitable for rendering.
-
template<typename FwIter, typename Compare>void create_mono_polygon(FwIter&& first, FwIter&& last, Compare&& dir)
- Create a monotone polygon from a range of points.
-
template<typename FwIter>auto create_xmono_polygon(FwIter&& first, FwIter&& last) -> void -> auto
- Create a xmono Polygon object.
-
template<typename FwIter>auto create_ymono_polygon(FwIter&& first, FwIter&& last) -> void -> auto
- Create a ymono Polygon object.
-
template<typename T>auto point_in_polygon(gsl::span<const Point<T>> pointset, const Point<T>& ptq) -> bool -> auto
- Determine if a point is within a polygon.
-
template<typename T>auto polygon_is_clockwise(gsl::span<const Point<T>> pointset) -> bool -> auto
- Determines if a polygon represented by a range of points is oriented clockwise.
-
template<typename FwIter, typename KeyFn>auto create_mono_rpolygon(FwIter&& first, FwIter&& last, KeyFn&& dir) -> bool -> auto
- Create a x-monotone rectilinear polygon (RPolygon) object.
-
template<typename FwIter>auto create_xmono_rpolygon(FwIter&& first, FwIter&& last) -> bool -> auto
- Create a x-monotone rectilinear polygon (RPolygon) object.
-
template<typename FwIter>auto create_ymono_rpolygon(FwIter&& first, FwIter&& last) -> bool -> auto
- Create a y-monotone rectilinear polygon (RPolygon) object.
-
template<typename FwIter>void create_test_rpolygon(FwIter&& first, FwIter&& last)
- Create a test rectilinear polygon (RPolygon) object.
-
template<typename T>auto point_in_rpolygon(gsl::span<const Point<T>> pointset, const Point<T>& ptq) -> bool -> auto
- Determine if a point is within a rectilinear polygon.
-
template<typename T>auto rpolygon_is_clockwise(gsl::span<const Point<T>> pointset) -> bool -> auto
- Determine if a rectilinear polygon is oriented clockwise.
Enum documentation
enum class recti:: LanguageCode
#include <recti/greeter.h>
Language codes to be used with the Recti class
Function documentation
#include <recti/generic.hpp>
template<typename U1, typename U2>
auto recti:: overlap(const U1& lhs,
const U2& rhs) -> bool constexpr
Checks if two objects overlap.
Template parameters | |
---|---|
U1 | The type of the first object. |
U2 | The type of the second object. |
Parameters | |
lhs | The first object to check for overlap. |
rhs | The second object to check for overlap. |
Returns | true if the two objects overlap, false otherwise. |
This function checks if the two input objects lhs
and rhs
overlap with each other. It first checks if the lhs
object has an overlaps
member function that can be called with rhs
as an argument. If so, it calls that function and returns the result. If not, it checks if the rhs
object has an overlaps
member function that can be called with lhs
as an argument, and returns the result of that call. If neither object has an overlaps
member function, the function simply checks if the two objects are equal and returns the result.
.---------------------. | | | .--------+-------. | | | | `------------+--------' | | | `----------------'
#include <recti/generic.hpp>
template<typename U1, typename U2>
auto recti:: contain(const U1& lhs,
const U2& rhs) -> bool constexpr
Check if one object contains another object.
Template parameters | |
---|---|
U1 | The type of the first object. |
U2 | The type of the second object. |
Parameters | |
lhs | The first object to check for containment. |
rhs | The second object to check for containment. |
Returns | true if the first object contains the second object, false otherwise. |
This function checks if the first object lhs
contains the second object rhs
. It first checks if lhs
has a contains
member function that can be called with rhs
as an argument, and returns the result of that call. If lhs
does not have a contains
member function, it checks if rhs
has a contains
member function that can be called with lhs
as an argument, and returns false
if that is the case (since rhs
contains lhs
implies that lhs
does not contain rhs
). If neither object has a contains
member function, the function simply checks if the two objects are equal and returns the result.
.---------------------. | .--. | | . | ---- | | | | `--' | `---------------------'
#include <recti/generic.hpp>
template<typename U1, typename U2>
auto recti:: intersection(const U1& lhs,
const U2& rhs) constexpr
Computes the intersection of two objects.
Template parameters | |
---|---|
U1 | The type of the first object. |
U2 | The type of the second object. |
Parameters | |
lhs in | The first object. |
rhs in | The second object. |
Returns | The intersection of lhs and rhs . |
This function computes the intersection of the two input objects lhs
and rhs
. It first checks if lhs
has an intersect_with
member function that can be called with rhs
as an argument, and returns the result of that call. If lhs
does not have an intersect_with
member function, it checks if rhs
has an intersect_with
member function that can be called with lhs
as an argument, and returns the result of that call. If neither object has an intersect_with
member function, the function asserts that lhs
and rhs
are equal and returns lhs
.
.---------------------. | | | .--------+-------. | | | | `------------+--------' | | | `----------------'
#include <recti/generic.hpp>
template<typename U1, typename U2>
auto recti:: min_dist(const U1& lhs,
const U2& rhs) constexpr
Calculates the minimum distance between two objects lhs
and rhs
.
Template parameters | |
---|---|
U1 | The type of the first object. |
U2 | The type of the second object. |
Parameters | |
lhs in | The first object. |
rhs in | The second object. |
Returns | The minimum distance between lhs and rhs . |
.-----------. | | | |~~~~~.-------------. | | | | `-----------' | | | | `-------------'
The function first checks if lhs
has a min_dist_with
member function that can be called with rhs
as an argument, and returns the result of that call. If lhs
does not have a min_dist_with
member function, it checks if rhs
has a min_dist_with
member function that can be called with lhs
as an argument, and returns the result of that call. If neither object has a min_dist_with
member function, the function returns the absolute difference between lhs
and rhs
.
#include <recti/generic.hpp>
template<typename U1, typename U2>
auto recti:: min_dist_change(U1& lhs,
U2& rhs) constexpr
Calculates the minimum distance between two objects lhs
and rhs
, with the ability to handle a change in the objects.
Template parameters | |
---|---|
U1 | The type of the first object. |
U2 | The type of the second object. |
Parameters | |
lhs in | The first object. |
rhs in | The second object. |
Returns | The minimum distance between lhs and rhs , with the ability to handle a change in the objects. |
The function first checks if lhs
has a min_dist_change_with
member function that can be called with rhs
as an argument, and returns the result of that call. If lhs
does not have a min_dist_change_with
member function, it checks if rhs
has a min_dist_change_with
member function that can be called with lhs
as an argument, and returns the result of that call. If neither object has a min_dist_change_with
member function, the function returns the absolute difference between lhs
and rhs
.
auto recti:: vdc(unsigned num,
unsigned base = 2,
unsigned scale = 10) noexcept -> unsigned
#include <recti/halton_int.hpp>
van der Corput sequence
Parameters | |
---|---|
num | |
base in | |
scale in | |
Returns | unsigned |
#include <recti/interval.hpp>
template<typename U1, typename U2>
auto recti:: enlarge(const U1& lhs,
const U2& rhs) constexpr
Enlarges an interval or scalar value by adding and subtracting a given value.
Template parameters | |
---|---|
U1 | The type of the first parameter lhs . |
U2 | The type of the second parameter rhs . |
Parameters | |
lhs | The interval or scalar value to be enlarged. |
rhs | The value to enlarge the interval or scalar value by. |
Returns | The enlarged interval or scalar value. |
This function takes two parameters, lhs
and rhs
, and returns a new interval that is enlarged by the value of rhs
. If lhs
has an enlarge_with
member function, it is used to enlarge the interval. Otherwise, a new interval is created with the lower bound as lhs - rhs
and the upper bound as lhs + rhs
.
#include <recti/polygon.hpp>
template<class Stream, typename T>
auto recti:: operator<<(Stream& out,
const Polygon<T>& poly) -> Stream &
Writes the vertices of a polygon to an output stream in a format suitable for rendering.
Template parameters | |
---|---|
Stream | The type of the output stream to write to. |
T | The numeric type used to represent the coordinates of the polygon vertices. |
Parameters | |
out | The output stream to write the polygon vertices to. |
poly | The polygon to write to the output stream. |
Returns | The output stream, for method chaining. |
This function writes the vertices of the given polygon to the provided output stream in a format that can be used to render the polygon, such as in a vector graphics format like SVG or LaTeX. Each vertex is written on a new line, prefixed with "\\draw " to indicate that it should be rendered as a drawing command.
#include <recti/polygon.hpp>
template<typename FwIter, typename Compare>
void recti:: create_mono_polygon(FwIter&& first,
FwIter&& last,
Compare&& dir)
Create a monotone polygon from a range of points.
Template parameters | |
---|---|
FwIter | The type of the forward iterator over the points. |
Compare | The type of the comparison function for the points. |
Parameters | |
first | The beginning of the range of points. |
last | The end of the range of points. |
dir | The comparison function for the points. |
This function takes a range of points represented by the iterators first
and last
, and a comparison function dir
that defines the order of the points. It then creates a monotone polygon from the points by partitioning them into two halves based on their position relative to the line connecting the minimum and maximum points in the range. The two halves are then sorted in ascending order using the provided comparison function, and the second half is reversed.
#include <recti/polygon.hpp>
template<typename FwIter>
auto recti:: create_xmono_polygon(FwIter&& first,
FwIter&& last) -> void
Create a xmono Polygon object.
Template parameters | |
---|---|
FwIter | The type of the forward iterator over the points. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
This function creates a monotone polygon from a range of points represented by the iterators first
and last
. It uses a comparison function that compares the points based on their x and y coordinates.
#include <recti/polygon.hpp>
template<typename FwIter>
auto recti:: create_ymono_polygon(FwIter&& first,
FwIter&& last) -> void
Create a ymono Polygon object.
Template parameters | |
---|---|
FwIter | The type of the forward iterator over the points. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
This function creates a monotone polygon from a range of points represented by the iterators first
and last
. It uses a comparison function that compares the points based on their y and x coordinates.
#include <recti/polygon.hpp>
template<typename T>
auto recti:: point_in_polygon(gsl::span<const Point<T>> pointset,
const Point<T>& ptq) -> bool
Determine if a point is within a polygon.
Template parameters | |
---|---|
T | The type of the coordinates of the points in the polygon |
Parameters | |
pointset | The range of points representing the polygon |
ptq | The point to test |
Returns | true if the point is strictly inside the polygon, false if the point is strictly outside the polygon |
This function determines whether a given point is strictly inside, strictly outside, or on the boundary of a polygon represented by a range of points. It uses the Winding Number algorithm to make this determination.
The code below is from Wm. Randolph Franklin wrf@ecse.rpi.edu (see URL below) with some minor modifications for integer. It returns true for strictly interior points, false for strictly exterior, and ub for points on the boundary. The boundary behavior is complex but determined; in particular, for a partition of a region into polygons, each Point is "in" exactly one Polygon. (See p.243 of [O'Rourke (C)] for a discussion of boundary behavior.)
See http:/
#include <recti/polygon.hpp>
template<typename T>
auto recti:: polygon_is_clockwise(gsl::span<const Point<T>> pointset) -> bool
Determines if a polygon represented by a range of points is oriented clockwise.
Template parameters | |
---|---|
T | The type of the coordinates of the points in the polygon. |
Parameters | |
pointset | The range of points representing the polygon. |
Returns | true if the polygon is oriented clockwise, false otherwise. |
#include <recti/rpolygon.hpp>
template<typename FwIter, typename KeyFn>
auto recti:: create_mono_rpolygon(FwIter&& first,
FwIter&& last,
KeyFn&& dir) -> bool
Create a x-monotone rectilinear polygon (RPolygon) object.
Template parameters | |
---|---|
FwIter | The iterator type for the range of points. |
KeyFn | The type of the key function that extracts the x and y coordinates of each point. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
dir in | The key function that extracts the x and y coordinates of each point. |
Returns | true if the resulting RPolygon is anti-clockwise, false otherwise. |
This function takes a range of points represented by iterators first
and last
, and a key function dir
that extracts the x and y coordinates of each point. It then creates an monotone RPolygon object from the given points.
#include <recti/rpolygon.hpp>
template<typename FwIter>
auto recti:: create_xmono_rpolygon(FwIter&& first,
FwIter&& last) -> bool
Create a x-monotone rectilinear polygon (RPolygon) object.
Template parameters | |
---|---|
FwIter | The iterator type for the range of points. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
Returns | true if the resulting RPolygon is anti-clockwise, false otherwise. |
This function takes a range of points represented by iterators first
and last
, and creates an x-monotone RPolygon object from the given points.
#include <recti/rpolygon.hpp>
template<typename FwIter>
auto recti:: create_ymono_rpolygon(FwIter&& first,
FwIter&& last) -> bool
Create a y-monotone rectilinear polygon (RPolygon) object.
Template parameters | |
---|---|
FwIter | The iterator type for the range of points. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
Returns | true if the resulting RPolygon is clockwise, false otherwise. |
This function takes a range of points represented by iterators first
and last
, and creates an y-monotone RPolygon object from the given points.
#include <recti/rpolygon.hpp>
template<typename FwIter>
void recti:: create_test_rpolygon(FwIter&& first,
FwIter&& last)
Create a test rectilinear polygon (RPolygon) object.
Template parameters | |
---|---|
FwIter | The iterator type for the range of points. |
Parameters | |
first in | The beginning of the range of points. |
last in | The end of the range of points. |
This function takes a range of points represented by iterators first
and last
, and creates a test RPolygon object from the given points. The resulting RPolygon is either clockwise or anti-clockwise depending on the relative positions of the points.
#include <recti/rpolygon.hpp>
template<typename T>
auto recti:: point_in_rpolygon(gsl::span<const Point<T>> pointset,
const Point<T>& ptq) -> bool
Determine if a point is within a rectilinear polygon.
Template parameters | |
---|---|
T | The numeric type of the point coordinates. |
Parameters | |
pointset | The set of points defining the rectilinear polygon. |
ptq | The point to test for inclusion in the polygon. |
Returns | true if the point is strictly inside the polygon, false if the point is strictly outside the polygon, and an unspecified boolean value if the point is on the boundary of the polygon. |
This function implements the Wm. Randolph Franklin algorithm to determine if a given point is strictly inside, strictly outside, or on the boundary of a rectilinear polygon defined by the provided set of points.
See http:/
#include <recti/rpolygon.hpp>
template<typename T>
auto recti:: rpolygon_is_clockwise(gsl::span<const Point<T>> pointset) -> bool
Determine if a rectilinear polygon is oriented clockwise.
Template parameters | |
---|---|
T | The numeric type of the point coordinates. |
Parameters | |
pointset | The set of points defining the rectilinear polygon. |
Returns | true if the polygon is oriented clockwise, false otherwise. |
This function takes a span of points defining a rectilinear polygon and determines if the polygon is oriented in a clockwise direction.