/*==================================================
shape, collection de point
par Thibaul Podevin
====================================================
preprocesseur*/
#pragma once
#ifndef SHAPE_H_INCLUDED
#define SHAPE_H_INCLUDED

#include "point.hpp"
#include <vector>
#include <math.h>
#include <assert.h>

using namespace std;

/*=================================================
classe
=================================================*/

class shape
{
protected:
    vector<point> _tab;
    float _radius;
    void _copyShape(const shape&);
public:
    shape();

    //constructeur par defaut
    shape(const shape& S);
    //destructeur par defaut
    ~shape();

    //setteurs
    void setX(int indice, float X);
    void setY(int indice, float Y);
    void setZ(int indice, float X);
    void setPoint(int indice, point P);
    void setCenter(point P);
    void setRadius(float);
    void addPoint(const point&);

    //getteurs
    float getX(int indice)const;
    float getY(int indice)const;
    float getZ(int indice)const;
    const point& getPoint(int indice)const;
    int numPoint()const;

    const point& getCenter()const;
    float getRadius()const;
    float getRadiusSQ()const;
    bool collide(const point& pos)const;
    bool collide(const shape& other)const;

    //operation avec des points
    void add(const point& p);
    void sous(const point& p);

    //operation avec scalaire
    void mulS(float scalaire);
    void divS(float scalaire);

    //rotation
    void rotX(float angle);
    void rotY(float angle);
    void rotZ(float angle);

    //cross-product
    void cross(const point& p);

    //surcharge des operateur interne
    point& operator[] (int i);
};


#endif // SHAPE_H_INCLUDED
