61#include "DGtal/base/Common.h"
63#include "DGtal/geometry/tools/AffineGeometry.h"
65#include "ConfigExamples.h"
72template <
typename Po
int >
76 std::uniform_int_distribution<int> U(-10, 10);
77 std::vector< Point > P;
81 for (
auto i = 0; i < n; i++ )
84 for (
auto k = 0; k < nb; k++ )
87 for (
auto i = 0; i < m; i++ )
94 std::shuffle( P.begin(), P.end(),
g );
100operator<<( std::ostream& out,
const std::vector< T >&
object )
103 for (
auto t : object ) out <<
" " << t;
108template <
typename Po
int >
112 std::cout <<
"Dimension is " << Point::dimension <<
"\n";
113 std::cout <<
"X = " << X <<
"\n";
114 std::cout <<
"Expected dimension of affine set of points X is "
115 << (Point::dimension-1) <<
"\n";
118 std::cout <<
"AffineSubset(X) = " << I <<
"\n";
120 std::vector<Point>
B;
122 std::cout <<
"AffineBasis(X) =: p+B = " << o <<
" + " <<
B <<
"\n";
124 std::cout <<
"Independent(X) =: e = " << e <<
"\n";
126 std::cout <<
"Orthogonal(X) =: n = " << n <<
"\n";
128 std::cout <<
"Orthogonal(X)/gcd =: ns = " << ns <<
"\n";
129 for (
auto i = 0; i <
B.size(); i++ )
130 std::cout <<
"B[" << i <<
"] . ns = " <<
B[i] <<
" . " << ns
131 <<
" == " <<
B[i].dot(ns) <<
" (should be 0)\n";
136int main(
int argc,
char* argv[] )
138 int dim = argc > 1 ? atoi( argv[ 1 ] ) : 3;
141 int nb = argc > 2 ? atoi( argv[ 2 ] ) : 10;
145 std::vector< Point > X = {
Point{3,1} };
151 std::vector< Point > X = {
Point{3,1,-1},
Point{-1,4,2} };
157 std::vector< Point > X = {
Point{3,1,-1,2},
Point{-1,4,2,0},
Point{0,5,3,1} };
163 std::vector< Point > X = {
Point{3,1,-1,2,3},
Point{-1,4,2,0,-2},
Point{0,5,3,1,-1},
Point{-4,-3,2,1,0} };
Aim: Implements basic operations that will be used in Point and Vector classes.
std::vector< Point > makeRandomLatticePointsFromDirVectors(int nb, const std::vector< Point > &V)
bool checkAffineGeometry(int nb, const std::vector< Point > &V)
DGtal::int64_t computeAffineDimension(const std::vector< TPoint > &X, const double tolerance=1e-12)
void getAffineBasis(TInputPoint &o, std::vector< TPoint > &basis, const std::vector< TInputPoint > &X, const double tolerance=1e-12)
TPoint computeIndependentVector(const std::vector< TPoint > &basis, const double tolerance=1e-12)
static TPoint computeOrthogonalVectorToBasis(const std::vector< TPoint > &basis)
std::vector< std::size_t > computeAffineSubset(const std::vector< TPoint > &X, const double tolerance=1e-12)
TPoint computeSimplifiedVector(const TPoint &v)
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)