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

////////////////////////////////////////////////////////////////////////////////
//
// FILE:	PolygonInfo.java
//
// AUTHOR:	Manoj D. Muzumdar
//		archon@ai.mit.edu
//
// DATE:        07-XX-98
//
// COPYRIGHT:	Massachusetts Institute of Technology
//		All rights reserved.
//
// PURPOSE:     Polygon representation
//
// HISTORY:     11-15-98 archon
//              Now aware of new rec.geo package
//
////////////////////////////////////////////////////////////////////////////////

package rec.core.widgets;

import java.awt.*;
import rec.util.*;
import rec.geo.*;


public class PolygonInfo
{
  public PolygonInfo( GPoint[] points, WLine[] lines )
  {
    Assert.check( points.length >= 3 && lines.length >= 3
		  && points.length == lines.length, "not a valid polygon" );

    m_Size = 0;
    while( (m_Size < points.length) && (points[m_Size] != null) )
       m_Size++;

    m_Points = points;
    m_Lines = lines;
  }

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

  public int getNumberOfSides()
  {
    return m_Size;
  }

  public GPoint getPointAt( int index )
  {
    return( m_Points[index] );
  }

  public WLine getLineAt( int index )
  {
    return( m_Lines[index] );
  }

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

  private GPoint[] m_Points;
  private WLine[] m_Lines;

  private int m_Size;

}

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