public class Polygon2d extends java.lang.Object implements Renderable
TRANSPARENT, TWO_DIMENSIONAL| Constructor and Description | 
|---|
| Polygon2d() | 
| Polygon2d(double[] coords) | 
| Polygon2d(Point2d[] pnts) | 
| Modifier and Type | Method and Description | 
|---|---|
| Vertex2d | addVertex(double x,
         double y) | 
| void | appendVertex(Vertex2d vtx) | 
| void | clear() | 
| RenderProps | createRenderProps()Factory method to create render properties appropriate to this object. | 
| boolean | epsilonEquals(Polygon2d poly,
             double eps)Returns true if this polygon is equal to another polygon within a
 prescribed tolerance eps. | 
| boolean | equals(Polygon2d poly)Returns true if this polygon is equal to another polygon. | 
| void | getBounds(Point2d minValues,
         Point2d maxValues) | 
| void | getCentroid(Point2d pnt) | 
| Vertex2d | getFirstVertex() | 
| Vertex2d | getLastVertex() | 
| double | getMaxCoordinate() | 
| int | getRenderHints()Returns a bit code giving rendering hints about this renderable. | 
| RenderProps | getRenderProps()Returns the render properities for this object. | 
| void | getSelection(java.util.LinkedList<java.lang.Object> list,
            int qid)Append to  listthe component (or components) associated with
 theqid-th selection query issued by this component's render
 method. | 
| java.util.ListIterator | getVertices() | 
| void | inverseTransform(AffineTransform2dBase X)Applies an inverse affine transformation to the vertices of this polygon. | 
| boolean | isConsistent() | 
| boolean | isEmpty() | 
| boolean | isSelectable()Returns true if this object is in fact selectable. | 
| int | numSelectionQueriesNeeded()If this selectable manages its own selection (by issuing selection
 queries within its  rendermethod), then this method should
 return the maximum number of selection queries that will be
 required. | 
| int | numVertices() | 
| void | prependVertex(Vertex2d vtx) | 
| void | prerender(RenderList list)Called prior to rendering to allow this object to update the internal
 state required for rendering (such as by caching rendering coordinates). | 
| void | render(Renderer renderer,
      int flags)Render this object using the functionality of the supplied
  Renderer. | 
| void | render(Renderer renderer,
      RenderProps props,
      int flags) | 
| void | scan(ReaderTokenizer rtok) | 
| void | set(double[] coords,
   int numVertices) | 
| void | set(Point2d[] pnts,
   int numVertices) | 
| void | set(Polygon2d poly) | 
| void | setRenderProps(RenderProps props)Assigns a new set of render properties to this object. | 
| void | shiftVertices(int n) | 
| java.lang.String | toString() | 
| java.lang.String | toString(NumberFormat fmt) | 
| java.lang.String | toString(java.lang.String fmtStr) | 
| void | transform(AffineTransform2dBase X)Applies a affine transformation to the vertices of this polygon. | 
| void | updateBounds(Point2d minValues,
            Point2d maxValues) | 
| void | updateBounds(Vector3d pmin,
            Vector3d pmax)Update the minimum and maximum points for this object. | 
public Polygon2d()
public Polygon2d(double[] coords)
public Polygon2d(Point2d[] pnts)
public java.util.ListIterator getVertices()
public int numVertices()
public double getMaxCoordinate()
public Vertex2d addVertex(double x, double y)
public void appendVertex(Vertex2d vtx)
public void prependVertex(Vertex2d vtx)
public boolean isEmpty()
public Vertex2d getLastVertex()
public Vertex2d getFirstVertex()
public void clear()
public void getCentroid(Point2d pnt)
public void set(Polygon2d poly)
public void set(double[] coords,
                int numVertices)
public void set(Point2d[] pnts, int numVertices)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String fmtStr)
public java.lang.String toString(NumberFormat fmt)
public void scan(ReaderTokenizer rtok) throws java.io.IOException
java.io.IOExceptionpublic boolean epsilonEquals(Polygon2d poly, double eps)
poly - polygon to be compared witheps - tolerance valueepsilonEquals(maspack.geometry.Polygon2d, double)public boolean equals(Polygon2d poly)
poly - polygon to be compared withepsilonEquals(maspack.geometry.Polygon2d, double)public void shiftVertices(int n)
public boolean isConsistent()
public void transform(AffineTransform2dBase X)
X - affine transformationpublic void inverseTransform(AffineTransform2dBase X)
X - affine transformationpublic void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.prerender in interface IsRenderablelist - list of objects to be renderedpublic void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderableupdateBounds in interface IsRenderablepmin - minimum pointpmax - maximum pointpublic void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerenderer - provides the functionality used to perform the rendering.flags - flags that may be used to control different 
 aspects of the rendering. Flags are defined in Renderer
 and currently include
 Renderer.HIGHLIGHT and
 Renderer.SORT_FACES.public void render(Renderer renderer, RenderProps props, int flags)
public int getRenderHints()
IsRenderableTRANSPARENT and
 TWO_DIMENSIONAL.getRenderHints in interface IsRenderablepublic RenderProps createRenderProps()
HasRenderPropscreateRenderProps in interface HasRenderPropspublic void setRenderProps(RenderProps props)
HasRenderPropsnull will remove render properties from this object.setRenderProps in interface HasRenderPropsprops - new render properties for this objectpublic RenderProps getRenderProps()
HasRenderPropsgetRenderProps in interface HasRenderPropspublic boolean isSelectable()
IsSelectableisSelectable in interface IsSelectablepublic int numSelectionQueriesNeeded()
IsSelectablerender method), then this method should
 return the maximum number of selection queries that will be
 required. Otherwise, this method should return -1.numSelectionQueriesNeeded in interface IsSelectablepublic void getSelection(java.util.LinkedList<java.lang.Object> list,
                         int qid)
IsSelectablelist the component (or components) associated with
 the qid-th selection query issued by this component's render
 method. This will only be called if this component manages its own
 selection (i.e., the number nums returned by IsSelectable.numSelectionQueriesNeeded() is positive), and qid will in
 turn be a number between 0 and nums-1.getSelection in interface IsSelectablelist - selected objects are appended to the end of this listqid - index of the selection query