Package com.sun.j3d.internal

Examples of com.sun.j3d.internal.FastVector


/*  201 */       float[] tmpCoords = new float[6];
/*  202 */       float lastX = 0.0F; float lastY = 0.0F;
/*  203 */       float firstPntx = 3.4028235E+38F; float firstPnty = 3.4028235E+38F;
/*  204 */       GeometryInfo gi = null;
/*  205 */       NormalGenerator ng = new NormalGenerator();
/*  206 */       FastVector contours = new FastVector(10);
/*  207 */       float maxY = -3.402824E+038F;
/*  208 */       int maxYIndex = 0; int beginIdx = 0; int endIdx = 0; int start = 0;
/*      */
/*  210 */       boolean setMaxY = false;
/*      */
/*  213 */       while (!pIt.isDone()) {
/*  214 */         Point3f vertex = new Point3f();
/*  215 */         flag = pIt.currentSegment(tmpCoords);
/*  216 */         if (flag == 4) {
/*  217 */           if (num > 0) {
/*  218 */             if (setMaxY)
/*      */             {
/*  220 */               beginIdx = start;
/*  221 */               endIdx = numPoints - 1;
/*      */             }
/*  223 */             contours.addElement(num);
/*  224 */             num = 0;
/*  225 */             numContours++;
/*      */           }
/*      */         } else { if (flag == 0) {
/*  228 */             vertex.x = tmpCoords[0];
/*  229 */             vertex.y = tmpCoords[1];
/*  230 */             lastX = vertex.x;
/*  231 */             lastY = vertex.y;
/*      */
/*  233 */             if ((lastX == firstPntx) && (lastY == firstPnty)) {
/*  234 */               pIt.next();
/*  235 */               continue;
/*      */             }
/*  237 */             setMaxY = false;
/*  238 */             coords.add(vertex);
/*  239 */             firstPntx = lastX;
/*  240 */             firstPnty = lastY;
/*  241 */             if (num > 0) {
/*  242 */               contours.addElement(num);
/*  243 */               num = 0;
/*  244 */               numContours++;
/*      */             }
/*  246 */             num++;
/*  247 */             numPoints++;
/*      */
/*  250 */             start = numPoints; break label525;
/*  251 */           }if (flag == 1) {
/*  252 */             vertex.x = tmpCoords[0];
/*  253 */             vertex.y = tmpCoords[1];
/*      */
/*  258 */             if ((vertex.x == lastX) && (vertex.y == lastY)) {
/*  259 */               pIt.next();
/*  260 */               continue;
/*      */             }
/*  262 */             if (vertex.y > maxY) {
/*  263 */               maxY = vertex.y;
/*  264 */               maxYIndex = numPoints;
/*  265 */               setMaxY = true;
/*      */             }
/*  267 */             lastX = vertex.x;
/*  268 */             lastY = vertex.y;
/*  269 */             coords.add(vertex);
/*  270 */             num++;
/*  271 */             numPoints++;
/*      */           } }
/*  273 */         label525: pIt.next();
/*      */       }
/*      */
/*  278 */       if (numPoints == 0) {
/*  279 */         return null;
/*      */       }
/*      */
/*  285 */       Point3f p1 = new Point3f(); Point3f p2 = new Point3f(); Point3f p3 = new Point3f();
/*  286 */       boolean flip_side_orient = true;
/*  287 */       Point3f[] vertices = (Point3f[])coords.toArray(false);
/*      */
/*  289 */       if (endIdx - beginIdx > 0)
/*      */       {
/*  294 */         if (maxYIndex == beginIdx)
/*  295 */           p1.set(vertices[endIdx]);
/*      */         else {
/*  297 */           p1.set(vertices[(maxYIndex - 1)]);
/*      */         }
/*  299 */         p2.set(vertices[maxYIndex]);
/*  300 */         if (maxYIndex == endIdx)
/*  301 */           p3.set(vertices[beginIdx]);
/*      */         else {
/*  303 */           p3.set(vertices[(maxYIndex + 1)]);
/*      */         }
/*      */
/*  306 */         if (p3.x != p2.x) {
/*  307 */           if (p1.x != p2.x)
/*      */           {
/*  309 */             if (Math.abs((p2.y - p1.y) / (p2.x - p1.x)) > Math.abs((p3.y - p2.y) / (p3.x - p2.x)))
/*      */             {
/*  311 */               flip_side_orient = p3.x > p2.x;
/*      */             }
/*  313 */             else flip_side_orient = p2.x > p1.x;
/*      */           }
/*      */           else {
/*  316 */             flip_side_orient = p3.x > p2.x;
/*      */           }
/*      */
/*      */         }
/*      */         else
/*      */         {
/*  323 */           flip_side_orient = p2.x > p1.x;
/*      */         }
/*      */
/*      */       }
/*      */
/*  328 */       int startIdx = 0;
/*  329 */       IslandsNode islandsTree = new IslandsNode(-1, -1);
/*  330 */       int[] contourCounts = contours.getData();
/*      */
/*  333 */       for (int i = 0; i < contours.getSize(); i++) {
/*  334 */         endIdx = startIdx + contourCounts[i];
/*  335 */         islandsTree.insert(new IslandsNode(startIdx, endIdx), vertices);
/*  336 */         startIdx = endIdx;
/*      */       }
/*      */
View Full Code Here

TOP

Related Classes of com.sun.j3d.internal.FastVector

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.