• Geotools的delaunry三角剖分


    Geotools三角剖分,用到了图的数据结构,蛮强大的,坑爹的是源码里面居然有System.out.println()代码,不过总体功能是有的。

    /**
     * delary三角网
     */
    static public void delaury(){
        List<DelaunayNode> nodes = new ArrayList<DelaunayNode>();
        for(int i=0;i<200;i++){
            Coordinate coord = new Coordinate(Math.random()*100,Math.random()*100);
            DelaunayNode xyNode = new DelaunayNode();
            xyNode.setCoordinate(coord);
            nodes.add(xyNode);
        }
        List<Edge> edges = new ArrayList<Edge>();
        DelaunayEdge edge = new DelaunayEdge(nodes.get(0),nodes.get(1));
        edges.add(edge);
        BasicGraph basicGraph = new BasicGraph();
        basicGraph.setNodes(nodes);
        basicGraph.setEdges(edges);



        DelaunayTriangulator delaunayTriangulator = new DelaunayTriangulator();
        DelaunayNode[] delaunayNodes = new DelaunayNode[nodes.size()];
        System.out.println(nodes.toArray(delaunayNodes));
        delaunayTriangulator.setNodeArray(nodes.toArray(delaunayNodes));
        //构建三角网
        //delaunayTriangulator.getTriangulation();
        GraphViewer gpViewer = new GraphViewer();

        gpViewer.setGraph(delaunayTriangulator.getTriangulation());
        gpViewer.setSize(500,500);
        gpViewer.setVisible(true);
        JFrame jFrame = new JFrame();
        jFrame.add(gpViewer);
        //jFrame.add(new JButton("dd"));
        //jFrame.setSize(500,500);
        jFrame.setVisible(true);
    }

     

     

  • 相关阅读:
    AC自动机算法与AC自动机专辑
    hdu 2757 DNA repair AC自动机dp完全不懂
    hdu 3695 AC自动机模板题
    Magic Tree 水dp 错题!
    AC自动机模板
    UVa 10003 Cutting Sticks 区间dp
    hdu 3695 Computer Virus on Planet Pandora AC自动机
    [置顶] AC自动机算法与AC自动机专辑
    Trip 图dp
    利用数据库创建webservice
  • 原文地址:https://www.cnblogs.com/yinchuanqi/p/5607671.html
Copyright © 2020-2023  润新知