Class Polygon2DJUnitTest


  • public class Polygon2DJUnitTest
    extends java.lang.Object
    Test out diva.util.java2d.Polygon2D class.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Christopher Brooks
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Red (cxh)
    • Field Detail

      • unitDiamond

        public Polygon2D.Double unitDiamond
        A 1.0 x 1.0 diamond centered on 0.0, 0.0.
      • unitSquare

        public Polygon2D.Double unitSquare
        A 1.0 x 1.0 square with a corner at 0.0, 0.0.
      • unitSquareCentered

        public Polygon2D.Double unitSquareCentered
        A 1.0 x 1.0 square centered at 0.0, 0.0.
    • Constructor Detail

      • Polygon2DJUnitTest

        public Polygon2DJUnitTest()
    • Method Detail

      • before

        public void before()
      • unitDiamond

        public void unitDiamond()
        Instantiate a 1x1 diamond with a centered on 0.0, 0.0.
      • unitSquare

        public void unitSquare()
        Instantiate a 1x1 square with a corner at 0.0, 0.0.
      • unitSquareCentered

        public void unitSquareCentered()
        Instantiate a 1x1 square centered at 0.0, 0.0.
      • unitDiamondContains

        public void unitDiamondContains()
                                 throws java.lang.Exception
        Test Polygon2D.contains() on a unit diamond centered on 0.0.
        Throws:
        java.lang.Exception
      • unitDiamondContains2

        public void unitDiamondContains2()
        Corner case that fails in old implementation of contains().
      • unitSquareContains

        public void unitSquareContains()
                                throws java.lang.Exception
        Test Polygon2D.contains() on a unit square with a corner at 0.0, 0.0.
        Throws:
        java.lang.Exception
      • unitSquareContains2

        public void unitSquareContains2()
        Corner case that fails in old implementation of contains().
      • unitSquareContains3

        public void unitSquareContains3()
        Corner case that fails in old implementation of contains().
      • unitSquareContains4

        public void unitSquareContains4()
        Corner case that fails in old implementation of contains().
      • unitSquareContains5

        public void unitSquareContains5()
        Corner case that fails in old implementation of contains().
      • unitSquareCenteredContains

        public void unitSquareCenteredContains()
                                        throws java.lang.Exception
        Test Polygon2D.contains() on a unit square centered at 0.0, 0.0.
        Throws:
        java.lang.Exception
      • unitSquareCenteredContains1

        public void unitSquareCenteredContains1()
        Corner case that fails in old implementation of contains().
      • unitSquareCenteredContains2

        public void unitSquareCenteredContains2()
        Corner case that fails in old implementation of contains().
      • main

        public static void main​(java.lang.String[] args)
        Test the diva.util.java2d.Polygon2D class

        To run, use:

           $PTII/bin/ptinvoke diva.util.java2d.Polygon2DJUnitTest
          
        or
           java -classpath $PTII:${PTII}/lib/junit-4.8.2.jar diva.util.java2d.test.junit.Polygon2DJUnitTest
          
        We use ptinvoke so that the classpath is set to include all the packages used by Ptolemy II.
        Parameters:
        args - Ignored.