com.perisic.function
Class NiceFunction

java.lang.Object
  extended by com.perisic.function.AnyFunction
      extended by com.perisic.function.NiceFunction
Direct Known Subclasses:
NiceFunction

public class NiceFunction
extends AnyFunction

A "nice" function that is used as a basis for defining the pitch, instrument selection or velocity of a voice.

Nice means here roughly mostly continuous (only a small number of jumps) where the pieces are either constants or defined by cubic polynomials.

Copyright:(c) Marc Conrad, Tim French 2006; Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument. DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

Author:
Marc Conrad

Constructor Summary
NiceFunction(java.util.Random g)
          Initialization by a random number generator.
 
Method Summary
 double eval(double x)
          Evaluation of the function for a value x.
static void main(java.lang.String[] args)
          Used for testing purpose only.
 
Methods inherited from class com.perisic.function.AnyFunction
addToImage, addToImage, getImage, getImage, normalizeResult
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NiceFunction

public NiceFunction(java.util.Random g)
Initialization by a random number generator. The function is fully determined by this random object.

Parameters:
g - A random number generator.
Method Detail

eval

public double eval(double x)
Evaluation of the function for a value x.

Specified by:
eval in class AnyFunction
Parameters:
x - The value against which the function is evaluated.
Returns:
f(x) where f is this object.

main

public static void main(java.lang.String[] args)
Used for testing purpose only. Evaluates 100 nice functions.

Parameters:
args - no parameters.