Package javax.vecmath

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


            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

     */
    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

    }
   
    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

    }
   
    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

   
    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

        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

/*     */   {
/*  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

/* 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

/* 342 */           coneOk = Numerics.isInCone(triRef, i3, i1, i4, i2[0], convex);
/* 343 */           if (coneOk) {
/* 344 */             BBox bb = new BBox(triRef, i1, i2[0]);
/* 345 */             if (!NoHash.noHashEdgeIntersectionExists(triRef, bb, -1, -1, ind1, -1))
/*     */             {
/* 350 */               Point2f center = new Point2f();
/* 351 */               Basic.vectorAdd2D(triRef.points[i1], triRef.points[i2[0]], center);
/* 352 */               Basic.multScalar2D(0.5D, center);
/* 353 */               if (windingNumber(triRef, ind, center) == 1) return true;
/*     */             }
/*     */           }
View Full Code Here

TOP

Related Classes of javax.vecmath.Point2f

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.