Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F95014648
assets.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Dec 12, 04:13
Size
939 B
Mime Type
text/x-c
Expires
Sat, Dec 14, 04:13 (2 d)
Engine
blob
Format
Raw Data
Handle
22915798
Attached To
rSYMKIT symkit
assets.cpp
View Options
#include "assets.h"
using namespace symkit;
#include <cmath>
//fonction qui gère la coloration d'un objet selon sa vitesse
color_s beta::colorGradientFunction(double energy, double limit)
{
/* Values in zero */
color_s color = {1.0f / 32, 1.0f / 16, 1.0f, 1.0f};
double ratio = energy / limit;
if (ratio < 1)
{
color.red = pow(2, -5 * pow(ratio - 1, 2));
double lambda = (ratio <= 1.0f / 3) ? -36 : - 45.0 / 4;
color.green = pow(2, lambda * pow(ratio - 1.0f / 3, 2));
if (ratio <= 0.5f)
color.blue = pow(2, -20 * pow(ratio, 2));
else
color.blue = 1.0f / 32;
} else {
color.red = 1;
color.green = 1.0f / 32;
color.blue = 1.0f / 32;
}
return color; //retourne la couleur selon le protocol rouge, vert, bleu, alpha
//où alpha represente le facteur de transparence de la couleur (de 0 à 1)
}
Event Timeline
Log In to Comment