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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	GDottedSegment.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:	Mar 99
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:	Geometric modeling
//
// HISTORY:     Mar 99  archon  created
//
////////////////////////////////////////////////////////////////////////////////

package rec.geo;

import java.awt.*;

public class GDottedSegment extends GSegment
{
  public GDottedSegment( GPoint head, GPoint tail )
  {
    super( head, tail );
  }

  public GDottedSegment( GPoint gp, double intercept )
  {
    super( gp, intercept );
  }

  public GDottedSegment( GDottedSegment gs )
  {
    super( gs );
  }

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

  public GShape copy()
  {
    return( new GDottedSegment( this ) );
  }

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

  public void display( Graphics g )
  {
    double incr = getLength() / 7.0;

    GPoint head = getHeadPoint();
    GPoint tail = getTailPoint();

    double angle = Geometry.angle( head, tail );

    GPoint mid1 = Geometry.locatePoint( head, incr, angle );
    GPoint mid2 = Geometry.locatePoint( head, incr * 2.0, angle );
    GPoint mid3 = Geometry.locatePoint( head, incr * 3.0, angle );
    GPoint mid4 = Geometry.locatePoint( head, incr * 4.0, angle );
    GPoint mid5 = Geometry.locatePoint( head, incr * 5.0, angle );
    GPoint mid6 = Geometry.locatePoint( head, incr * 6.0, angle );

    g.drawLine( head.getIntX(), head.getIntY(),
		mid1.getIntX(), mid1.getIntY() );
    g.drawLine( mid2.getIntX(), mid2.getIntY(),
		mid3.getIntX(), mid3.getIntY() );
    g.drawLine( mid4.getIntX(), mid4.getIntY(),
		mid5.getIntX(), mid5.getIntY() );
    g.drawLine( mid6.getIntX(), mid6.getIntY(),
		tail.getIntX(), tail.getIntY() );
  }
}

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