Examples of Point2f


Examples of javax.vecmath.Point2f

     * @param pos relative position on the edge (0 <= pos <= 1)
     * @return the Point at relative position 'pos' on the given edge
     */
    private static Point2f getPointOnEdge(Edge edge, float pos){
        // start point vector
        Point2f s = edge.getNode(0).getPoint2f();
        // end point vector
        Point2f e = edge.getNode(1).getPoint2f();
       
        s.interpolate(e, pos);
        return s;
    }
View Full Code Here

Examples of javax.vecmath.Point2f

        if(lines.isEmpty())
            return p;
       
        Point2f[] points = lines.getFirst();
       
        Point2f point;
        Point2f firstPoint = points[0];
        Point2f prevPoint = points[1];
       
        p.moveTo(firstPoint.x, firstPoint.y);
        p.lineTo(prevPoint.x, prevPoint.y);
        lines.remove(points);
       
View Full Code Here

Examples of javax.vecmath.Point2f

            Node2D[] n = edge.getNodes();
            float f1 = scalar[n[0].getIndex()];
            float f2 = scalar[n[1].getIndex()];

            if ((f1 >= thrsh && f2 < thrsh) || (f2 >= thrsh && f1 < thrsh)) {
                Point2f p1 = n[0].getPoint2f();
                Point2f p2 = n[1].getPoint2f();
                intPoints.put(edge, interpolate(p1, f1, p2, f2, thrsh));
            }
        }
       
        List<TriElement> elements = m.getElements();
View Full Code Here

Examples of javax.vecmath.Point2f

     */
    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);
           
            p = n.getPoint2f();
            b = scalar[n.getIndex()] >= thrsh;
           
            if(b != prevB){ // edge crosses threshold -> interpolate point
                Edge edge = new Edge(prevN, n);
                Point2f pInt = intPoints.get(edge);
                path.lineTo(pInt.x, pInt.y);
            }
            if(b){
                path.lineTo(p.x, p.y);
            }
View Full Code Here

Examples of javax.vecmath.Point2f

    }
   
    public TriElement getElement(Point2D p){
        for (TriElement el : elements) {
            GeneralPath path = new GeneralPath();
            Point2f n0 = el.getNode(0).getPoint2f();
            Point2f n1 = el.getNode(1).getPoint2f();
            Point2f n2 = el.getNode(2).getPoint2f();
           
            path.moveTo(n0.x, n0.y);
            path.lineTo(n1.x, n1.y);
            path.lineTo(n2.x, n2.y);
            path.closePath();
View Full Code Here

Examples of javax.vecmath.Point2f

    }
   
    private void reorientElements(){
        for(TriElement el : elements){
           
            Point2f v0 = el.getNode(0).getPoint2f();
            Point2f v1 = el.getNode(1).getPoint2f();
            Point2f v2 = el.getNode(2).getPoint2f();
           
            v1.sub(v0); // from node 0 to 1
            v2.sub(v0); // from node 0 to 2
           
            float cross = v1.x*v2.y - v1.y*v2.x;
           
            if(cross < 0){
                el.reorient();
View Full Code Here

Examples of javax.vecmath.Point2f

   
    public GeneralPath createOutlinePath() {
        GeneralPath p = new GeneralPath();
        p.moveTo(0f, 0f);
       
        Point2f v;
        boolean first = true;
        for (Node2D node : getOuterNodes()) {
            if(node == null){
                p.closePath();
                first = true;
View Full Code Here

Examples of javax.vecmath.Point2f

        return p;
    }
   
    public GeneralPath createWireframePath(){
        GeneralPath wireframe = new GeneralPath();
        Point2f start, end;
       
        for (Edge e : getEdges()) {
           
            // skip border edges
            if (e.isOuter()) {
View Full Code Here

Examples of javax.vecmath.Point2f

/*     */   {
/*  23 */     if (number > triRef.maxNumPUnsorted) {
/*  24 */       triRef.maxNumPUnsorted = number;
/*  25 */       triRef.pUnsorted = new Point2f[triRef.maxNumPUnsorted];
/*  26 */       for (int i = 0; i < triRef.maxNumPUnsorted; i++)
/*  27 */         triRef.pUnsorted[i] = new Point2f();
/*     */     }
/*     */   }
View Full Code Here

Examples of javax.vecmath.Point2f

/* 102 */     return removed;
/*     */   }
/*     */
/*     */   static void sort(Point2f[] points, int numPts)
/*     */   {
/* 109 */     Point2f swap = new Point2f();
/*     */
/* 111 */     for (int i = 0; i < numPts; i++)
/* 112 */       for (int j = i + 1; j < numPts; j++)
/* 113 */         if (pComp(points[i], points[j]) > 0) {
/* 114 */           swap.set(points[i]);
/* 115 */           points[i].set(points[j]);
/* 116 */           points[j].set(swap);
/*     */         }
/*     */   }
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.