point(2rheolef)
π point β bestie, let me put you ON π
okay so this is a page from the rheolef manual (section 2rheolef, so it's a library/system-call-ish page), and it's all about the point class. grab a snack, we're doing geometry πΈ
β¨ NAME β¨
point β it's a d-dimensional physical point, or a vector, whichever vibe you need today (this is from rheolef-7.2) π
πΈ DESCRIPTION πΈ
So basically point is the class that defines a vertex or a vector living in physical d-dimensional space, where d = 1, 2, 3. It's represented as an array of coordinates, and the coordinate index starts at zero and finishes at d-1 β so like x[0], x[1], and x[2]. periodt. π
The default constructor sets all the components to zero, like:
point x;
and bestie, that default can absolutely be overridden:
point x (1, 2, 3.14);
or alternatively:
point x = {1, 2, 3.14};
and the standard linear algebra for vectors?? yeah, the point class has you covered, no cap. π₯
π₯ IMPLEMENTATION π₯
Just so you know where this all came from: this documentation was generated from the file fem/geo_element/point.h β icon behavior honestly.
The point class is simply an alias to the point_basic class:
typedef point_basic<Float> point;
and point_basic itself is a template class with the floating type as its parameter π
template <class T>
class point_basic {
public:
// typedefs:
typedef size_t size_type;
typedef T element_type;
typedef T scalar_type;
typedef T float_type;
// allocators:
explicit point_basic();
explicit point_basic (const T& x0, const T& x1 = 0, const T& x2 = 0);
template <class T1>
point_basic<T>(const point_basic<T1>& p);
template <class T1>
point_basic<T>& operator= (const point_basic<T1>& p);
point_basic (const std::initializer_list<T>& il);
// accessors:
T& operator[](int i_coord) { return _x[i_coord%3]; }
T& operator()(int i_coord) { return _x[i_coord%3]; }
const T& operator[](int i_coord) const { return _x[i_coord%3]; }
const T& operator()(int i_coord) const { return _x[i_coord%3]; }
// algebra:
bool operator== (const point_basic<T>& v) const;
bool operator!= (const point_basic<T>& v) const;
point_basic<T> operator+ (const point_basic<T>& v) const;
point_basic<T> operator- (const point_basic<T>& v) const;
point_basic<T> operator- () const;
point_basic<T>& operator+= (const point_basic<T>& v);
point_basic<T>& operator-= (const point_basic<T>& v);
point_basic<T>& operator*= (const T& a);
point_basic<T>& operator/= (const T& a);
template <class U>
typename
std::enable_if<
details::is_rheolef_arithmetic<U>::value
,point_basic<T>
>::type
operator* (const U& a) const;
point_basic<T> operator/ (const T& a) const;
point_basic<T> operator/ (point_basic<T> v) const;
// i/o:
std::istream& get (std::istream& s, int d = 3);
std::ostream& put (std::ostream& s, int d = 3) const;
};
and all those linear + nonlinear functions? they get completed by some usual functions, as follows π
template<class T>
std::istream& operator >> (std::istream& s, point_basic<T>& p);
template<class T>
std::ostream& operator << (std::ostream& s, const point_basic<T>& p);
template <class T, class U>
typename
std::enable_if<
details::is_rheolef_arithmetic<U>::value
,point_basic<T>
>::type
operator* (const U& a, const point_basic<T>& u);
template<class T>
point_basic<T>
vect (const point_basic<T>& v, const point_basic<T>& w);
// metrics:
template<class T>
T dot (const point_basic<T>& x, const point_basic<T>& y);
template<class T>
T norm2 (const point_basic<T>& x);
template<class T>
T norm (const point_basic<T>& x);
template<class T>
T dist2 (const point_basic<T>& x, const point_basic<T>& y);
template<class T>
T dist (const point_basic<T>& x, const point_basic<T>& y);
template<class T>
T dist_infty (const point_basic<T>& x, const point_basic<T>& y);
template <class T>
T vect2d (const point_basic<T>& v, const point_basic<T>& w);
template <class T>
T mixt (const point_basic<T>& u, const point_basic<T>& v, const point_basic<T>& w);
then we get to the robust (exact) floating point predicates β these return the sign of the value as (0, > 0, < 0), and formally orient2d(a,b,x) = vect2d(a-x,b-x) π§
template <class T>
int sign_orient2d (
const point_basic<T>& a,
const point_basic<T>& b,
const point_basic<T>& c);
template <class T>
int sign_orient3d (
const point_basic<T>& a,
const point_basic<T>& b,
const point_basic<T>& c,
const point_basic<T>& d);
there are also versions that compute the actual value β¨
// compute also the value:
template <class T>
T orient2d(
const point_basic<T>& a,
const point_basic<T>& b,
const point_basic<T>& c);
and formally orient3d(a,b,c,x) = mixt3d(a-x,b-x,c-x):
template <class T>
T orient3d(
const point_basic<T>& a,
const point_basic<T>& b,
const point_basic<T>& c,
const point_basic<T>& d);
template <class T>
std::string ptos (const point_basic<T>& x, int d = 3);
// ccomparators: lexicographic order
template<class T, size_t d>
bool lexicographically_less (const point_basic<T>& a, const point_basic<T>& b);
(and yes, the original literally spells it ccomparators β we're keeping that typo exactly as-is, it's part of the lore π)
π AUTHOR π
Pierre Saramito <Pierre.Saramito@imag.fr> β we love a credited author π«Ά
π COPYRIGHT π
Copyright (C) 2000-2018 Pierre Saramito <Pierre.Saramito@imag.fr>
GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
and that's the whole page, bestie π this was rheolef, Version 7.2, and the page itself is point(2rheolef) β slay, go build something geometric with it, you've got this π
β¨π¦
π¦ where this page comes from
- debian trixie: librheolef-dev 7.2-4 Β· GPL-3.0-or-later
- ubuntu noble: librheolef-dev 7.2-3build5 Β· GPL-3.0-or-later
- ubuntu questing: librheolef-dev 7.2-4build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms