--- /dev/null
+#ifndef SPHERE_H
+#define SPHERE_H
+
+#include "cudaTools.h"
+#include "cudaType_CPU.h"
+#include "mathTools.h"
+
+#endif
+class Sphere
+ {
+ public:
+ __host__
+ Sphere(float3 centre, float r, float hue) :
+ centre(centre),
+ hueInitial(hue)
+ {
+ this->setR(r);
+ }
+
+ __host__
+ Sphere()
+ {
+ }
+
+ __host__
+ void setCentre(float3 centre)
+ {
+ this->centre = centre;
+ }
+
+ __host__
+ void setR(float r)
+ {
+ this->r = r;
+ this->rCarre = r*r;
+ }
+
+ __host__
+ void setHueInitial(float hue)
+ {
+ this->hueInitial = hue;
+ }
+
+ __device__
+ float hCarre(float2 xySol)
+ {
+ float a = (centre.x - xySol.x);
+ float b = (centre.y - xySol.y);
+ return a * a + b * b;
+ }
+
+ __device__
+ bool isEnDessous(float hCarre)
+ {
+ return hCarre < rCarre;
+ }
+
+ __device__
+ float dz(float hCarre)
+ {
+ return sqrtf(rCarre - hCarre);
+ }
+
+ __device__
+ float brightness(float dz)
+ {
+ return dz / r;
+ }
+
+ __device__
+ float distance(float dz)
+ {
+ return centre.z - dz;
+ }
+
+ __device__
+ float getHueInitial()
+ {
+ return this->hueInitial;
+ }
+
+ __device__
+ float hue(float t) // usefull for animation
+ {
+ return 0.5 + 0.5 * sin(t + T + 3 * PI / 2);
+ }
+
+ private:
+ float r;
+ float3 centre;
+ float hueInitial;
+ float rCarre;
+
+ float T; // Utilisé pour l'animation.
+ };
+#endif