From b3ae4e889872ca0b9ca76f1d17b2f0b961226729 Mon Sep 17 00:00:00 2001
From: Normand Briere <nbriere@noware.ca>
Date: Mon, 05 Aug 2019 21:48:55 -0400
Subject: [PATCH] Fix physics UI

---
 Torus.java |   48 +++++++++++++++++++++++++++---------------------
 1 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/Torus.java b/Torus.java
index d9a7b44..4573395 100644
--- a/Torus.java
+++ b/Torus.java
@@ -2,7 +2,7 @@
 
 class Torus extends Biparam implements java.io.Serializable
 {
-        //static final long serialVersionUID = -7637054329820073252L;
+        static final long serialVersionUID = -7637054329820073252L; // Old
 
     Torus()
     {
@@ -64,7 +64,7 @@
             v = 0;
         
         double uAng = u * 2 * Math.PI;
-        double vAng = v * 2 * Math.PI;
+        double vAng = -v * 2 * Math.PI;
         double cosua = Math.cos(uAng);
         double sinua = Math.sin(uAng);
         double cosva = Math.cos(vAng);
@@ -118,55 +118,59 @@
         return rad2 <= minor * minor;
     }
 
-    void drawEditHandles(ClickInfo info, int level)
+    void drawEditHandles(//ClickInfo info,
+            int level)
     {
         if (level == 0)
         {
             return;
         } else
         {
-            super.drawEditHandles(info, level);
+            super.drawEditHandles(//info,
+                    level);
             cVector temp = LA.newVector(0, 0, minor);
             LA.xformPos(temp, toParent, temp);
-            Rectangle majorSpot = calcHotSpot(temp, info);
+            Rectangle majorSpot = calcHotSpot(temp); //, info);
             majorSpot.translate(4, 4);
             temp.x = major;
             temp.y = temp.z = 0;
             LA.xformPos(temp, toParent, temp);
-            Rectangle minorSpot = calcHotSpot(temp, info);
+            Rectangle minorSpot = calcHotSpot(temp); //, info);
             minorSpot.translate(4, 4);
-            info.g.setColor(Color.green);
-            info.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height);
-            info.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height);
+            clickInfo.g.setColor(Color.green);
+            clickInfo.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height);
+            clickInfo.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height);
             return;
         }
     }
 
-    boolean doEditClick(ClickInfo info, int level)
+    boolean doEditClick(//ClickInfo info,
+            int level)
     {
         if (level == 0)
             return false;
         hitSomething = 0;
-        if (super.doEditClick(info, level))
+        if (super.doEditClick(//info,
+                level))
         {
             hitSomething = 1;
             return true;
         }
         cVector temp = LA.newVector(0, 0, minor);
         LA.xformPos(temp, toParent, temp);
-        Rectangle majorSpot = calcHotSpot(temp, info);
+        Rectangle majorSpot = calcHotSpot(temp); //, info);
         majorSpot.translate(4, 4);
         temp.x = major;
         temp.y = temp.z = 0;
         LA.xformPos(temp, toParent, temp);
-        Rectangle minorSpot = calcHotSpot(temp, info);
+        Rectangle minorSpot = calcHotSpot(temp); //, info);
         minorSpot.translate(4, 4);
-        if (majorSpot.contains(info.x, info.y))
+        if (majorSpot.contains(clickInfo.x, clickInfo.y))
         {
             hitSomething = 2;
             startRad = major;
         } else
-        if (minorSpot.contains(info.x, info.y))
+        if (minorSpot.contains(clickInfo.x, clickInfo.y))
         {
             hitSomething = 3;
             startRad = minor;
@@ -174,23 +178,25 @@
         {
             return false;
         }
-        startX = info.x;
+        startX = clickInfo.x;
         return true;
     }
 
-    void doEditDrag(ClickInfo info, boolean opposite)
+    void doEditDrag(//ClickInfo info,
+            boolean opposite)
     {
         if (hitSomething == 0)
             return;
         if (hitSomething == 1)
         {
-            super.doEditDrag(info, opposite);
+            super.doEditDrag(//info,
+                    opposite);
             return;
         }
-        double deltaR = info.x - startX;
+        double deltaR = clickInfo.x - startX;
         //cVector delta = LA.newVector(info.x - startX, 0, 0);
         //LA.xformDir(delta, info.camera.fromScreen, delta);
-		deltaR /= 100 * info.camera.SCALE / info.camera.Distance();
+		deltaR /= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
         double newRad = startRad + deltaR;
         if (newRad < 0)
             newRad = 0;
@@ -199,7 +205,7 @@
         else
             minor = newRad;
         recalculate();
-        info.pane.repaint();
+        clickInfo.pane.repaint();
     }
 
     double major;

--
Gitblit v1.6.2