Skip to content

Commit

Permalink
Remove DeepSkyObject::hsv2rgb()
Browse files Browse the repository at this point in the history
  • Loading branch information
375gnu committed May 15, 2023
1 parent b7ae735 commit 2f8f3b0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 59 deletions.
58 changes: 1 addition & 57 deletions src/celengine/deepskyobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,66 +79,10 @@ bool DeepSkyObject::pick(const Eigen::ParametrizedLine<double, 3>& ray,
cosAngleToBoundCenter);
else
return false;
}


void DeepSkyObject::hsv2rgb( float *r, float *g, float *b, float h, float s, float v )
{
// r,g,b values are from 0 to 1
// h = [0,360], s = [0,1], v = [0,1]

int i;
float f, p, q, t;

if( s == 0 )
{
// achromatic (grey)
*r = *g = *b = v;
return;
}

h /= 60; // sector 0 to 5
i = static_cast<int>(std::floor( h ));
f = h - static_cast<float>(i); // factorial part of h
p = v * ( 1 - s );
q = v * ( 1 - s * f );
t = v * ( 1 - s * ( 1 - f ) );

switch( i )
{
case 0:
*r = v;
*g = t;
*b = p;
break;
case 1:
*r = q;
*g = v;
*b = p;
break;
case 2:
*r = p;
*g = v;
*b = t;
break;
case 3:
*r = p;
*g = q;
*b = v;
break;
case 4:
*r = t;
*g = p;
*b = v;
break;
default:
*r = v;
*g = p;
*b = q;
break;
}
}


bool DeepSkyObject::load(const AssociativeArray* params, const fs::path& resPath)
{
// Get position
Expand Down
2 changes: 0 additions & 2 deletions src/celengine/deepskyobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ class DeepSkyObject
Eigen::Vector3d getPosition() const;
void setPosition(const Eigen::Vector3d&);

static void hsv2rgb( float*, float*, float*, float, float, float);

virtual const char* getType() const = 0;
virtual void setType(const std::string&) = 0;
virtual std::string getDescription() const;
Expand Down

0 comments on commit 2f8f3b0

Please sign in to comment.