Package ru.dubov.primitives

Examples of ru.dubov.primitives.Polygon


    /** Creates new form MainFrame */
    public MainFrame() {
        initComponents();
        setLocationRelativeTo(null);
        polygon = new Polygon();
        tempPolygon = new Polygon();
        state = 0;
    }
View Full Code Here


        triangulation = VanGoghAlgorithm.slow((Polygon)polygon.clone());
       
        if (triangulation != null) {
            state = 1;
        } else {
            polygon = new Polygon();           
            tempPolygon = new Polygon();
        }
       
        jPanel1.repaint();
    }//GEN-LAST:event_jButton1ActionPerformed
View Full Code Here

        triangulation = VanGoghAlgorithm.fast((Polygon)polygon.clone());
       
        if (triangulation != null) {
            state = 1;
        } else {
            polygon = new Polygon();
            tempPolygon = new Polygon();
        }
       
        jPanel1.repaint();
    }//GEN-LAST:event_jButton2ActionPerformed
View Full Code Here

       
        jPanel1.repaint();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        polygon = new Polygon();
        tempPolygon = new Polygon();
        state = 0;
       
        jPanel1.repaint();
    }//GEN-LAST:event_jButton4ActionPerformed
View Full Code Here

        triangulation = DivideAndConquerAlgorithm.triangulate((Polygon)polygon.clone());
       
        if (triangulation != null) {
            state = 1;
        } else {
            polygon = new Polygon();
            tempPolygon = new Polygon();
        }
       
        jPanel1.repaint();
    }//GEN-LAST:event_jButton6ActionPerformed
View Full Code Here

   
    private void checkConvexHull(ArrayList<Point> points) {
       
        // printPointsList(points); System.out.println();
       
        Polygon CH_Graham = ConvexHull.Graham(points);
        Polygon CH_Jarvis = ConvexHull.Jarvis(points);
       
         //printPointsList(CH_Graham); System.out.println();
         //printPointsList(CH_Jarvis); System.out.println();
         //System.out.println("---------------------");
       
        if (CH_Graham.size() != CH_Jarvis.size()) {
            fail("CH's are of different size!");
        }
       
        for (int i = 0; i < CH_Graham.size(); i++) {
            if(! (CH_Graham.get(i)).equals(CH_Jarvis.get(i))) {
                fail("Different points: " + (CH_Graham.get(i)) +
                        " in Graham and " + (CH_Jarvis.get(i)) +
                        " in Jarvis.");
            }
        }
       
        assertTrue(true);
View Full Code Here

        while(! result.empty()) {
            polygon.add(result.pop());
        }
        Collections.reverse(polygon);
       
        return new Polygon(polygon);
    }
View Full Code Here

        } while(next != pE);
       
        // Оболочка построена, возвращается список точек
        // в порядке обхода против часовой стрелки
       
        return new Polygon(result);
    }
View Full Code Here

import ru.dubov.primitives.Polygon;

public class VanGoghAlgorithmTest extends TestCase {

    public void testFast() {
        Polygon p = new Polygon();
        p.add(new Point(0,0));
        p.add(new Point(1,1));
        p.add(new Point(2,0));
        p.add(new Point(3,1));
        p.add(new Point(4,0));
        p.add(new Point(4,4));
        p.add(new Point(0,4));
       
        VanGoghAlgorithm.fast(p);
    }
View Full Code Here

TOP

Related Classes of ru.dubov.primitives.Polygon

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.