/// Evolver Copyright 2000, Morgan McGuire
/// matrix@alum.mit.edu   http://graphics3d.com/matrix
public abstract class TrigonometricOperator extends OneArgumentOperator implements ELOperator
{
  public void apply(ELMatrix argument[], ELMatrix out, ELEnvironment environment)
  {
    checkArguments(argument);
    
    // For extra performance, pull the arrays into locals so we avoid
    // excess dereferences.
    float red[] = out.red;
    float grn[] = out.grn;
    float blu[] = out.blu;

    ELMatrix arg = argument[0];
    float ared[] = arg.red;
    float agrn[] = arg.grn;
    float ablu[] = arg.blu;
    
    float PI = (float)Math.PI;
    for(int i = out.numElements - 1; i >= 0; i--) {
      red[i] = function(ared[i] * PI);
      grn[i] = function(agrn[i] * PI);
      blu[i] = function(ablu[i] * PI);
    }
  }

  /**
   * Your element wise operator (input will be scaled by PI)
   */
  protected abstract float function(float f); 
}
