43             {   
struct {T 
x, 
y, 
z;};        
 
   53                                  const T Z=0)           {
x=X;    
y=Y;    
z=Z;}
 
   54            explicit SLVec3      (
const T v[3])          {
x=v[0]; 
y=v[1]; 
z=v[2];}
 
   61                                  const T Z)             {
x=X;    
y=Y;    
z=Z;}
 
   63                                  const T Y)             {
x=X;    
y=Y;    
z=0;}
 
   64             void    set         (
const T v[3])          {
x=v[0]; 
y=v[1]; 
z=v[2];}
 
  107                                   const SLVec3& v)      {output<<
"["<<v.
x<<
","<<v.
y<<
","<<v.
z<<
"]"; 
return output;}
 
  120                                                          y = a.
z*
b.x - a.
x*
b.z;
 
  121                                                          z = a.
x*
b.y - a.
y*
b.x;}
 
  125                                                          if (L>0) {
x/=L; 
y/=L; 
z/=L;}
 
  129                                                          if(L>0) { ret.
x /= L; ret.
y /= L; ret.
z /= L; }
 
  132                                  const T max)           {
x = (
x>max)?max : (
x<min)?min : 
x;
 
  133                                                          y = (
y>max)?max : (
y<min)?min : 
y;
 
  134                                                          z = (
z>max)?max : (
z<min)?min : 
z;}
 
  140                                  const T factor_b)      {T factor_a = 1-factor_b;
 
  141                                                          x = a.
x*factor_a + 
b.x*factor_b;
 
  142                                                          y = a.
y*factor_a + 
b.y*factor_b;
 
  143                                                          z = a.
z*factor_a + 
b.z*factor_b;}
 
  151                                                          else if (
y>=
z)    
return y;
 
  154                                                          else if (
y<=
z)    
return y;
 
  157                                                          else if (
y>=
z)   {
comp=1; 
return y;}
 
  158                                                          else             {
comp=2; 
return z;}}
 
  160                                                          else if (
y<=
z)   {
comp=1; 
return y;}
 
  161                                                          else             {
comp=2; 
return z;}}
 
  163                                                          else if (
y>=
z)    
return 1;
 
  176                                                          T distanceSquared = v.
dot(v);
 
  177                                                          return distanceSquared;}
 
  186                                                          x = 
r*sin_theta*cos(phi);
 
  187                                                          y = 
r*sin_theta*sin(phi);
 
  191                                                          y= pow(
y,oneOverGamma);
 
  192                                                          z= pow(
z,oneOverGamma);}
 
  209                 float f[3] = {0.0, 0.0f, 0.0f};
 
  210                 for (
SLulong i=0; i<components.size(); ++i)
 
  211                     f[i] = (
SLfloat)atof(components[i].c_str());
 
  212                 x = f[0]; 
y = f[1]; 
z = f[2];
 
  219                 T 
s = 
clamp(hsv.
y, 0.0f, 1.0f);
 
  220                 T v = 
clamp(hsv.
z, 0.0f, 1.0f);
 
  221                 T a = 
clamp(hsv.
x, 0.0f, 1.0f);
 
  224                 T 
x = c * (1.0f - fabs(fmod(h*3.0f / 
Utils::PI, 2.0f) - 1.0f));
 
  228                 {   
case 0: 
return set(m + c, m + 
x, m    ); 
 
  229                     case 1: 
return set(m + 
x, m + c, m    ); 
 
  230                     case 2: 
return set(m    , m + c, m + 
x); 
 
  231                     case 3: 
return set(m    , m + 
x, m + c); 
 
  232                     case 4: 
return set(m + 
x, m    , m + c); 
 
  233                     case 5: 
return set(m + c, m    , m + 
x); 
 
  250                 double p   = sqrt(ecef.
x * ecef.
x + ecef.
y*ecef.
y);
 
  251                 double th  = atan2(a*ecef.
z, 
b*p);
 
  253                 double longitude = atan2(ecef.
y, ecef.
x);
 
  254                 double latitude = atan2((ecef.
z + epsq*
b*pow(sin(th),3.0)), (p - esq*a*pow(cos(th),3.0)) );
 
  255                 double N   = a/(sqrt(1-esq*pow(sin(latitude),2)));
 
  256                 double altitude = p/cos(latitude) - N;
 
  273                 double altitude = latDegLonDegAltM.
alt;
 
  276                 double cosLat = cos(latitude);
 
  278                 double N = a / sqrt(1 - esq * pow(sin(latitude),2));
 
  280                 x = (N+altitude) * cosLat * cos(longitude);
 
  281                 y = (N+altitude) * cosLat * sin(longitude);
 
  282                 z = ((1-esq) * N + altitude) * sin(latitude);
 
vector< SLstring > SLVstring
 
static const double EARTH_RADIUS_B
 
vector< SLVec3f > SLVVec3f
 
vector< SLVec3d > SLVVec3d
 
SLVec3< SLfloat > SLVec3f
 
static const double EARTH_ECCENTRICTIY_SQR
 
SLVec3< SLfloat > SLCol3f
 
vector< SLCol3f > SLVCol3f
 
static const double EARTH_RADIUS_A_SQR
 
static const double EARTH_RADIUS_A
 
static const double EARTH_ECCENTRICTIY2
 
vector< SLfloat > SLVfloat
 
SLVec3< SLshort > SLVec3s
 
static const double EARTH_ECCENTRICTIY
 
static const double EARTH_ECCENTRICTIY2_SQR
 
static const double EARTH_RADIUS_B_SQR
 
SLVec3< SLuint > SLVec3ui
 
The SLScene class represents the top level instance holding the scene structure.
 
2D vector template class for standard 2D vector algebra.
 
3D vector template class for standard 3D vector algebra.
 
SLVec3 operator^(const SLVec3 &v) const
 
void add(const SLVec3 &a)
 
friend std::ostream & operator<<(std::ostream &output, const SLVec3 &v)
 
SLVec3 & operator&=(const SLVec3 &v)
 
SLVec3 operator&(const SLVec3 &v) const
 
SLbool operator==(const SLVec3 &v) const
 
void latlonAlt2ecef(const SLVec3 &latDegLonDegAltM)
Latitude Longitude Altitude (LatLonAlt) to Earth Centered Earth Fixed (ecef) using the WGS84 model.
 
SLstring toString(SLstring delimiter=", ", int decimals=2)
Conversion to string.
 
void fromString(const SLstring &threeFloatsWithDelimiter, SLchar delimiter=',')
Conversion from string.
 
void setMax(const SLVec3 &v)
 
void add(const SLVec3 &a, const SLVec3 &b)
 
void set(const SLVec3< T > &v)
 
SLbool operator>=(const SLVec3 &v) const
 
void clampMinMax(const T min, const T max)
 
SLVec3 operator+(const SLVec3 &v) const
 
SLVec3 & operator*=(const T s)
 
void mix(const SLVec3 &a, const SLVec3 &b, const T factor_b)
 
SLVec3 normalized() const
 
SLbool operator<=(const SLVec3 &v) const
 
void cross(const SLVec3 &a, const SLVec3 &b)
 
SLbool operator<(const SLVec3 &v) const
 
SLbool operator!=(const SLVec3 &v) const
 
SLbool operator>(const SLVec3 &v) const
 
SLVec3(const SLVec2< T > &v)
 
void set(const T X, const T Y, const T Z)
 
T operator*(const SLVec3 &v) const
 
T dot(const SLVec3 &v) const
 
void sub(const SLVec3 &a, const SLVec3 &b)
 
SLVec3 & operator-=(const SLVec3 &v)
 
void toSpherical(T &r, T &theta, T &phi)
Calculates the spherical coords into r, theta & phi in radians.
 
void set(const T X, const T Y)
 
T distance(const SLVec3 &p) const
Calculate the distance to point p.
 
T distSquared(const SLVec3 &q)
Calculate the squared distance from the vector to point q.
 
void setMin(const SLVec3 &v)
 
SLVec3(const SLstring &threeFloatsWithDelimiter)
 
SLVec3 & operator/=(const T s)
 
void set(const SLVec2< T > &v)
 
SLVec3(const T X, const T Y, const T Z=0)
 
SLVec3(const SLVec3< T > &v)
 
SLVec3 operator/(const T s) const
 
void fromSpherical(T r, T theta, T phi)
Calculates the vector from spherical coords r, theta & phi in radians.
 
void print(const SLchar *str=nullptr)
Prints the vector to std out.
 
void sub(const SLVec3 &a)
 
void ecef2LatLonAlt(const SLVec3 &ecef)
Earth Centered Earth Fixed (ecef) to Latitude Longitude Altitude (LatLonAlt) using the WGS84 model.
 
SLVec3 & operator+=(const SLVec3 &v)
 
SLVec3 & operator=(const SLVec2< T > &v)
 
void hsv2rgb(const SLVec3 &hsv)
HSV (0-1) to RGB (0-1) color conversion (http://www.rapidtables.com/convert/color/hsv-to-rgb....
 
void gammaCorrect(T oneOverGamma)
Gamma correction.
 
static const float DEG2RAD
 
T clamp(T a, T min, T max)
 
void splitString(const string &s, char delimiter, vector< string > &splits)
Splits an input string at a delimiter character into a string vector.
 
static const float ONEOVERPI
 
static const float RAD2DEG
 
string toString(float f, int roundedDecimals)
Returns a string from a float with max. one trailing zero.