Revision: 20766
          http://sourceforge.net/p/jmol/code/20766
Author:   hansonr
Date:     2015-09-09 11:50:30 +0000 (Wed, 09 Sep 2015)
Log Message:
-----------
reconciling javajs.util with swingjs project; correcting exponential digits in 
%8.3e or %8.-3f

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-09-09 11:49:01 UTC 
(rev 20765)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-09-09 11:50:30 UTC 
(rev 20766)
@@ -700,8 +700,8 @@
           boolean isThroughCenter = bsThroughCenter.get(pt);
           P3 rpt = (isThroughCenter ? randomPoint : ptAve);
           V3 normal = new V3();
-          boolean isWindingOK = getNormalFromCenter(rpt, points[i], points[j],
-              points[k], !isThroughCenter, normal);
+          boolean isWindingOK = Measure.getNormalFromCenter(rpt, points[i], 
points[j],
+              points[k], !isThroughCenter, normal, vTemp);
           // the standard face:
           normals[planeCount] = normal;
           faces[planeCount] = new int[] { isWindingOK ? i : j, isWindingOK ? j 
: i,
@@ -715,11 +715,11 @@
             ptRef.setT(points[nPoints] = new P3());
             points[nPoints].scaleAdd2(offset, normal, centralAtom);
             addFacet(i, j, k, ptRef, points, normals, faces, planeCount++, 
nPoints,
-                isWindingOK);
+                isWindingOK, vTemp);
             addFacet(k, i, j, ptRef, points, normals, faces, planeCount++, 
nPoints,
-                isWindingOK);
+                isWindingOK, vTemp);
             addFacet(j, k, i, ptRef, points, normals, faces, planeCount++, 
nPoints,
-                isWindingOK);
+                isWindingOK, vTemp);
             nPoints++;
           } else {
             planeCount++;
@@ -751,12 +751,13 @@
    * @param planeCount
    * @param nRef
    * @param isWindingOK
+   * @param vTemp 
    */
   private void addFacet(int i, int j, int k, P3 ptRef, P3[] points,
                         V3[] normals, int[][] faces, int planeCount, int nRef,
-                        boolean isWindingOK) {
+                        boolean isWindingOK, V3 vTemp) {
     V3 normal = new V3();
-    getNormalFromCenter(points[k], ptRef, points[i], points[j], false, normal);
+    Measure.getNormalFromCenter(points[k], ptRef, points[i], points[j], false, 
normal, vTemp);
     normals[planeCount] = normal;
     faces[planeCount] = new int[] { nRef, isWindingOK ? i : j, isWindingOK ? j 
: i,
         -2 };
@@ -766,27 +767,6 @@
   }
 
   /**
-   * 
-   * @param ptCenter
-   * @param ptA
-   * @param ptB
-   * @param ptC
-   * @param isOutward
-   * @param normal
-   * @return true if winding is proper; false if not
-   */
-  private boolean getNormalFromCenter(P3 ptCenter, P3 ptA, P3 ptB, P3 ptC,
-                                      boolean isOutward, V3 normal) {
-    V3 vAB = new V3();
-    float d = Measure.getNormalThroughPoints(ptA, ptB, ptC, normal, vAB);
-    boolean isReversed = (Measure.distanceToPlaneV(normal, d, ptCenter) > 0);
-    if (isReversed == isOutward)
-      normal.scale(-1f);
-    //System.out.println("Draw v vector scale 2.0 " + Escape.escape(ptCenter) 
+ Escape.escape(normal));
-    return !isReversed;
-  }
-
-  /**
    * Clean out overlapping triangles based on normals and cross products. For
    * now, we use normixes, which are approximations of normals. It is not 100%
    * guaranteed that this will work.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to