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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	WMNut.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	Feb 99
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:     Mechanical engineering drawing recognition
//
// HISTORY:     Feb 99  archon  created
//
////////////////////////////////////////////////////////////////////////////////

package rec.meche;

import rec.geo.*;

public class WMNut extends WPart
{
  public WMNut( GPoint center, double angle, double size, Cloneable data )
  {
    super( center, angle, size, data );
  }

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

  public Object clone()
  {
    return( new WMNut( getCenter(), getAngle(), size(), getData() ) );
  }

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

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

    double unit = size / 2.75;
    double littleUnit = unit / 32.0;

    // Create the rectangle.

    shapes[0] = new GSegment( GPoint.ORIGIN,
                              new GPoint( 3.0 * unit, 0.0 ) );
    shapes[1] = new GSegment( new GPoint( 3.0 * unit, 0.0 ),
                              new GPoint( 3.0 * unit, 2.0 * unit ) );
    shapes[2] = new GSegment( GPoint.ORIGIN,
                              new GPoint( 0.0, 2.0 * unit ) );
    shapes[3] = new GSegment( new GPoint( 0.0, 2.0 * unit ),
                              new GPoint( 3.0 * unit, 2.0 * unit ) );

    // Draw the bars in the middle.

    shapes[4] = new GSegment( new GPoint( unit - littleUnit, 0.0 ),
                              new GPoint( unit - littleUnit, 2.0 * unit ) );
    shapes[5] = new GSegment( new GPoint( unit + littleUnit, 0.0 ),
                              new GPoint( unit + littleUnit, 2.0 * unit ) );

    shapes[6] = new GSegment( new GPoint( 2.0 * unit - littleUnit, 0.0 ),
                              new GPoint( 2.0 * unit - littleUnit,
                                          2.0 * unit ) );
    shapes[7] = new GSegment( new GPoint( 2.0 * unit + littleUnit, 0.0 ),
                              new GPoint( 2.0 * unit + littleUnit,
                                          2.0 * unit ) );

    return( shapes );
  }
}

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