17 void setCentre(const float3
& centre
)
19 this->centre
= centre
;
30 void setHueInitial(float hue
)
32 this->T
= asinf(2 * hue
- 1) - 3 * PI
/ 2;
39 float hSquare(float2 xySol
) const
41 const float a
= (this->centre
.x
- xySol
.x
);
42 const float b
= (this->centre
.y
- xySol
.y
);
47 * Est-ce que la sphre se trouve en dessous d'un point (x, y) en fonction de h².
48 * Voir la méthode 'hCarre(..)'.
51 bool isBelow(float hCarre
) const
53 return hCarre
< this->rCarre
;
57 * Hauteur du point de collision du rayon par rapport au centre de la sphère.
60 float dz(float hCarre
) const
62 return sqrtf(rCarre
- hCarre
);
66 float distance(float dz
) const
68 return this->centre
.z
- dz
;
72 * Renvoie la le B de HSB compris entre 0 et 1 dépendant du paramètre 'dz'
73 * lui même compris entre 0 et le rayon 'r'.
76 float brightness(float dz
) const
85 float hue(float t
) const
87 return 0.5 + 0.5 * sinf(t
+ this->T
+ 3 * PI
/ 2);
92 float3 centre
; // Position.
93 float rCarre
; // Précalul de r².
94 float T
; // Utilisé pour l'animation.