int main()
{
	CubicSpline cubicSpline(DEFAULT_PATH);
	std::cout << "f(2.5) = " << cubicSpline.interpolate(2.5) << std::endl;

    return 0;
}
Пример #2
0
Vector PerlinGenerator::at( const Vector& pos )
{
  //return sky( pos.x,pos.y,pos.z, SKY_BLUE, CLOUD_WHITE ) ;
  Vector n = pos/worldNormalizer ;

  switch( noiseType )
  {
    case PerlinNoiseType::Sky:
      return sky( n.x, n.y, n.z, SKY_BLUE, CLOUD_WHITE ) ;
      
    case PerlinNoiseType::Wood:
      return wood( n.x, n.y, n.z ) ;
      
    case PerlinNoiseType::Marble:
    default:
      return marble( n.x,n.y,n.z, n.x ) ;

    case PerlinNoiseType::CustomLinear:
      return linearSpline( PerlinNoise3D( n.x,n.y,n.z, persistence, lacunarity, octaves ) ) ;
      
    case PerlinNoiseType::CustomQuadratic:
      return quadraticSpline( PerlinNoise3D( n.x,n.y,n.z, persistence, lacunarity, octaves ) ) ;

    case PerlinNoiseType::CustomCubic:
      return cubicSpline( PerlinNoise3D( n.x,n.y,n.z, persistence, lacunarity, octaves ) ) ;

    case PerlinNoiseType::CustomQuartic:
      return quarticSpline( PerlinNoise3D( n.x,n.y,n.z, persistence, lacunarity, octaves ) ) ;

    case PerlinNoiseType::CustomQuintic:
      return quinticSpline( PerlinNoise3D( n.x,n.y,n.z, persistence, lacunarity, octaves ) ) ;

  }
}
Пример #3
0
Vector PerlinGenerator::marble( double x, double y, double z, double grainVariable,
  int freckling, double freqBoost,
  const Vector& c1, const Vector& c2, const Vector& c3, const Vector& c4 )
{
  // sin( x + |noise(p)| + .5*|noise(2p)| + ... )
  real n = PerlinNoise3D( x,y,z, 2, 2, freckling ) ;
  real val = sin( freqBoost*(grainVariable + n) ) ;
  
  // You can also blend using a bezier type spline,
  real t = ( 1 + val ) / 2.0 ;

  return cubicSpline( t,c1,c2,c3,c4 ) ;
}
bool IPLGradientOperator::processInputData(IPLImage* image , int, bool)
{
    // delete previous result
    delete _result;
    _result = new IPLOrientedImage(image->width(), image->height());

    // get properties
    int algorithm = getProcessPropertyInt("algorithm");

    switch (algorithm){
       case 0:
       default:
          return fastGradient(image);
       case 1:
          return roberts(image);
       case 2:
          return sobel(image);
       case 3:
          return cubicSpline(image);
    }

    //make compiler happy...
    return false;
}
Пример #5
0
Vector PerlinGenerator::cubicSpline( real t )
{
  return cubicSpline( t, color1, color2, color3, color4 ) ;
}