18 #include <initializer_list>
22 template<std::
size_t N>
32 std::array<double, N> coordinates;
59 Point(
double val, ...);
69 Point(std::initializer_list<double> l);
110 void setCoord(
unsigned int index,
double val);
130 double getCoord(
unsigned int index)
const;
226 template<std::
size_t P>
227 friend std::ostream& operator<<(std::ostream& os, const Point<P>& point);
231 template<std::
size_t N>
234 for(
unsigned i=0; i<N; i++){
235 coordinates[i] = 0.0;
239 template<std::
size_t N>
241 std::cout <<
"Point::Constructeur par copie" << std::endl;
242 for(
unsigned i = 0; i<N; i++){
243 coordinates[i] = other.coordinates[i];
245 this->boundry=other.boundry;
248 template<std::
size_t N>
251 coordinates = std::move(other.coordinates);
252 this->boundry=other.boundry;
253 other.coordinates.empty();
256 template<std::
size_t N>
259 this->setCoord(0, val);
263 for (
unsigned i = 1; i<N; i++){
264 this->setCoord(i, va_arg(ap,
double));
270 template<std::
size_t N>
273 for(
unsigned i=0; i<N; i++){
274 coordinates[i] = 0.0;
280 coordinates[pos] = v;
285 template<std::
size_t N>
288 for(
unsigned i = 0; i<N; i++){
289 coordinates[i] = other.coordinates[i];
291 this->boundry=other.boundry;
295 template<std::
size_t N>
299 coordinates = std::move(other.coordinates);
300 other.coordinates.empty();
301 delete other.coordinates;
303 this->boundry=other.boundry;
307 template<std::
size_t P>
308 std::ostream& operator<<(std::ostream& os, const Point<P>& point){
310 for(
unsigned i=0; i<P; i++){
311 os << point.getCoord(i);
319 template<std::
size_t N>
322 std::cerr <<
"Depassement !" << std::endl;
325 coordinates[index] = val;
328 template<std::
size_t N>
330 this->setCoord(0, val);
334 for (
unsigned i = 1; i<N; i++){
335 this->setCoord(i, va_arg(ap,
double));
340 template<std::
size_t N>
342 return coordinates[index];
345 template<std::
size_t N>
347 double MIN_VALUE = -250.0;
348 double MAX_VALUE = 250.0;
350 for (
unsigned int i =0; i<N; i++){
351 if (this->getCoord(i) < MIN_VALUE || this->getCoord(i) > MAX_VALUE){
359 template<std::
size_t N>
361 for (
unsigned i=0; i<N; i++){
362 if (other.
getCoord(i) != this->getCoord(i))
368 template<std::
size_t N>
370 for (
unsigned i=0; i<N; i++){
371 if (other.
getCoord(i) > this->getCoord(i))
377 template<std::
size_t N>
379 return !(*
this<other || *
this==other);
382 template<std::
size_t N>
384 return !(*
this>other);
387 template<std::
size_t N>
389 return !(*
this<other);
392 template<std::
size_t N>
396 for (
unsigned int i=0; i<N; i++){
397 dist += (this->getCoord(i)-other.
getCoord(i))*(this->getCoord(i)-other.
getCoord(i));
399 return std::sqrt(dist);
402 template<std::
size_t N>
407 template<std::
size_t N>
const Point & operator=(Point &&other)
Opérateur d’affectation par déplacement.
bool operator>=(const Point &other) const
Opérateur de supériorité
bool operator<(const Point &other) const
Opérateur d'infériorité stricte.
bool operator==(Point const &other)
Opérateur d'égalité
bool isBoundry()
Détermine si le point est une borne.
bool outOfBoundries()
Determine si le point est dans une zone statique.
bool operator<=(const Point &other) const
Opérateur d'infériorité
double getCoord(unsigned int index) const
Getter d'une coordonnée.
void setCoords(double val,...)
Setter d'un nombre variable de coordonnées.
void setCoord(unsigned int index, double val)
setter d'une coordonnée du point e la coordonnée d'index index du point
void toBoundry()
Identificateur d'un point comme borne.
double distance(const Point< N > &other) const
Calcul de distance entre deux points.
bool operator>(const Point &other) const
Opérateur de supériorité strict.
classe representant un point dans un espace de dimension N