/*
 * Author: Håvard Rast Blok
 * E-mail: hblok@usa.net
 * Web   : www.hblok.net
 * Created: Thursday, March 01, 2001 9:12:26 PM
 */

package net.hblok.opengl.util;

import java.util.Vector;
import com.hermetica.vecmath.Vec3d;

/**
 * The GuidePoint class enables an unlimted number of Vec3f points
 * to perform the same operation simultaneously.
 * The implemented methods pass on the operation to the super class and all
 * the added connted points.
 * A GuidePoint may itself be added as a connted point, thus enabeling
 * nested GuidePoints.
*/
public class GuidePoint extends Vec3f
{

  private Vector connectedPoints = new Vector();

//------ OVERRIDED CONSTRUCTORS

  public GuidePoint()
  {
    
  }

  public GuidePoint(float x, float y, float z)
  {
    super( x, y, z );
  }
  
  public GuidePoint(float[] ary)
  {
    super( ary );
  }
 
  public GuidePoint(Vec3f vec)
  {
    super(vec);
  }
  
//----- GuidePoint methods

  public void addConnectedPoint( Vec3f v )
  {
    connectedPoints.add( v );
  }
  
  public void removeConnectedPoint( Vec3f v )
  {
    connectedPoints.remove( v );
  }

//----- OVERRIDED METHODS  ------

  public void add(Vec3f arg0) 
  {
    super.add( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).add( arg0 );
    }
  }
  
  public void add(Vec3f arg0, Vec3f arg1) 
  {
    super.add( arg0, arg1 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).add( arg0, arg1 );
    }
  }
  
  public void cross(Vec3f arg0, Vec3f arg1) 
  {
    super.cross( arg0, arg1 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).cross( arg0, arg1 );
    }
  }
  
  public void negate() 
  {
    super.negate();
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).negate();
    }
  }
  
  public void negate(Vec3f arg0) 
  {
    super.negate( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).negate( arg0 );
    }
  }
  
  public void normalize() 
  {
    super.normalize();
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).normalize();
    }
  }
  
  public void scale(float arg0) 
  {
    super.scale( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).scale( arg0 );
    }
  }
  
  public void scale(float arg0, Vec3f arg1) 
  {
    super.scale( arg0, arg1 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).scale( arg0, arg1 );
    }
  }
  
  public void scaleAdd(float arg0, Vec3f arg1, Vec3f arg2) 
  {
    super.scaleAdd( arg0, arg1, arg2 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).scaleAdd( arg0, arg1, arg2 );
    }
  }
  
  public void set(float arg0, float arg1, float arg2) 
  {
    super.set( arg0, arg1, arg2 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).set( arg0, arg1, arg2 );
    }
  }
  
  public void set(float[] arg0) 
  {
    super.set( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).set( arg0 );
    }
  }
  
  public void set(Vec3f arg0) 
  {
    super.set( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).set( arg0 );
    }
  }
  
  public void set(Vec3d arg0) 
  {
    super.set( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).set( arg0 );
    }
  }
  
  public void sub(Vec3f arg0) 
  {
    super.sub( arg0 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).sub( arg0 );
    }
  }
  
  public void sub(Vec3f arg0, Vec3f arg1) 
  {
    super.sub( arg0, arg1 );
    
    for(int i = 0; i < connectedPoints.size(); i++)
    {
      ((Vec3f)connectedPoints.elementAt(i)).sub( arg0, arg1 );
    }
  }
 


}

