// (c) MIT 2003.  All rights reserved.

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	WMFixedPivot.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	April 99
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:     Fixed pivot widget
//
// HISTORY:     April 99  archon  created
//
////////////////////////////////////////////////////////////////////////////////

package rec.meche;

import rec.geo.*;
import rec.core.widgets.*;

public class WMFixedPivot extends WPart
{
  public WMFixedPivot( WCircle c )
  {
    super( c.getCenter(),0.0 , c.size(), c );
  }

  //////////////////////////////////////////////////////////////////////////////

  public Object clone()
  {
    return( new WMFixedPivot( (WCircle)getData() ) );
  }

  //////////////////////////////////////////////////////////////////////////////

  protected GShape[] create( double size, Cloneable data )
  {
    GShape[] shapes = new GShape[3];

    WCircle c = (WCircle)data;

    GPoint cen = c.getCenter();
    double rad = c.getRadius();

    // Create the outside circle.

    shapes[0] = new GCircle( cen, rad );

    // Create the internal segments.

    shapes[1] = new GSegment( cen.locatePoint( rad, 0.0 ),
			      cen.locatePoint( rad, Math.PI ) );
    shapes[2] = new GSegment( cen.locatePoint( rad, Math.PI / 2.0 ),
			      cen.locatePoint( rad, Math.PI * 3.0 / 2.0 ) );
    return( shapes );
  }
}

////////////////////////////////////////////////////////////////////////////////
