Examples of Node2D


Examples of bs.bs2d.fea.Node2D

               
                int ni = Integer.parseInt(vals[0]);
                float x = Float.parseFloat(vals[1]);
                float y = Float.parseFloat(vals[2]);
               
                mesh.addNode(new Node2D(ni, x, y));
            }
            index += nodes;
           
            // read elements
            for(int i=0; i < elems; i++){
View Full Code Here

Examples of bs.bs2d.fea.Node2D

               
                int ni = Integer.parseInt(vals[0]);
                float x = Float.parseFloat(vals[1]);
                float y = Float.parseFloat(vals[2]);
               
                mesh.addNode(new Node2D(ni, x, y));
            }
            index += nodes;
            // done
           
           
View Full Code Here

Examples of bs.bs2d.fea.Node2D

                vals = lines.get(iNodes + i).split(WHITESPACE_DELIMITER);
               
                float x = Float.parseFloat(vals[1]);
                float y = Float.parseFloat(vals[2]);
               
                mesh.addNode(new Node2D(i+1, x, y));
            }
           
            // read elements
            for(int i=0; i < nElems; i++){
                vals = lines.get(iElems + i).split(WHITESPACE_DELIMITER);
View Full Code Here

Examples of bs.bs2d.fea.Node2D

            throw new Exception("Empty mesh!");
       
        List<Node2D> nodes = mesh.getNodes();
        for (int i = 0; i < nodes.size(); i++) {
            // test manifold
            Node2D n = nodes.get(i);
            int d = 0;
            if(n.isOuter())
                d = 1;
           
            if(n.getEdgeCount()-n.getElementCount() > d){
                throw new Exception("Mesh is non-manifold!");
            }
           
            if(n.getElementCount() == 0){
                System.err.println("Mesh contains unused nodes");
            }
           
           
        }
View Full Code Here

Examples of bs.bs2d.fea.Node2D

    private void selectionChanged() {
        String info;
        if (selection.isEmpty()) {
            info = " - nothing selected - ";
        } else if (selection.size() == 1) {
            Node2D n = selection.iterator().next();
            info = String.format("Node %5d: [ %6.3f | %6.3f ]",
                                    n.getIndex(), n.getX(), n.getY());
        } else {
            info = selection.size() + " Nodes";
        }
       
        update(info);
View Full Code Here

Examples of bs.bs2d.fea.Node2D

                       
                        line[i] = getRelPointOnEdge(edge, scalar, thrsh);

                        if (edge.isOuter()) {// add line segments along outer edge
                            //find node above threshold
                            Node2D n = edge.getNode(0);
                            if (scalar[edge.getNode(1).getIndex()] >= thrsh) {
                                n = edge.getNode(1);
                            }

                            // add line from intersection to node
                            lines.add(new Point2f[]{line[i], n.getPoint2f()});
                        }

                        i++;
                    } else if(edge.isOuter()){ // min is also >= thrsh
                        lines.add(edge.getNodesAsPoints());
View Full Code Here

Examples of bs.bs2d.fea.Node2D

    private static Shape getElementSubShape(TriElement e, float[] scalar, float thrsh, Map<Edge, Point2f> intPoints){
        GeneralPath path = new GeneralPath();
       
        // find first node above threshold
        Point2f p = null;
        Node2D n = null;
        int i;
        for (i = 0; i < 3; i++) {
            n = e.getNode(i);
            if(scalar[n.getIndex()] >= thrsh){
                p = n.getPoint2f();
                break;
            }
        }
       
        // no node found --> return empty path
        if(p == null)
            return path;
       
        path.moveTo(p.x, p.y);
               
        boolean b, prevB = true; // was previous node above thrsh?
        Node2D prevN = n;
       
        int end = i + 3;
        for (i++; i <= end; i++) {
            n = e.getNode(i % 3);
           
View Full Code Here

Examples of org.geotools.geometry.iso.util.elem2D.Node2D

   
    public void testContains() {
        Circle2D circle = new Circle2D(100.0, 50.0, 25.0);
        assertNotNull(circle);
       
        assertFalse(circle.contains(new Node2D(0.0, 0.0)));
        assertFalse(circle.contains(new Node2D(-10.0, 90.0)));
        assertTrue(circle.contains(new Node2D(100.0, 50.0)));
        assertTrue(circle.contains(new Node2D(124.9, 49.9)));
        assertTrue(circle.contains(new Node2D(90.0, 60.0)));
        assertFalse(circle.contains(new Node2D(-1000.0, -900.0)));
    }
View Full Code Here

Examples of org.geotools.geometry.iso.util.elem2D.Node2D

        assertTrue(circle.contains(new Node2D(90.0, 60.0)));
        assertFalse(circle.contains(new Node2D(-1000.0, -900.0)));
    }
   
    public void test3PointConstructor() {
        Point2D pt1 = new Node2D(0.0, 0.0);
        Point2D pt2 = new Node2D(5.0, 0.0);
        Point2D pt3 = new Node2D(2.5, -2.0);
        Circle2D circle = new Circle2D(pt1, pt2, pt3);
        assertNotNull(circle);
       
        assertEquals("Circle2D: X:2.5 Y:0.5625 r:2.5625", circle.toString());
        assertEquals(5.125, circle.getRectangle().getWidth());
        assertEquals(5.125, circle.getRectangle().getHeight());
        assertEquals(2.5, circle.getCenter().getX());
       
        //3 vertical points (bad!)
        pt1 = new Node2D(0.0, 5.0);
        pt2 = new Node2D(0.0, 10.0);
        pt3 = new Node2D(0.0, 15.0);
       
        try {
            circle = new Circle2D(pt1, pt2, pt3);
            fail("should have thrown illegal argument exception");
        } catch (IllegalArgumentException e) {
        }
       
        pt1 = new Node2D(0.0, 5.0);
        pt2 = new Node2D(0.0, 10.0);
        pt3 = new Node2D(1.0, 15.0);

        circle = new Circle2D(pt1, pt2, pt3);
        assertNotNull(circle);
        assertEquals("Circle2D: X:25.5 Y:7.5 r:25.622255950637914", circle.toString());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.