Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
Torus.java
....@@ -2,6 +2,8 @@
22
33 class Torus extends Biparam implements java.io.Serializable
44 {
5
+ static final long serialVersionUID = -7637054329820073252L; // Old
6
+
57 Torus()
68 {
79 inPnt = new cVector();
....@@ -62,7 +64,7 @@
6264 v = 0;
6365
6466 double uAng = u * 2 * Math.PI;
65
- double vAng = v * 2 * Math.PI;
67
+ double vAng = -v * 2 * Math.PI;
6668 double cosua = Math.cos(uAng);
6769 double sinua = Math.sin(uAng);
6870 double cosva = Math.cos(vAng);
....@@ -116,55 +118,59 @@
116118 return rad2 <= minor * minor;
117119 }
118120
119
- void drawEditHandles(ClickInfo info, int level)
121
+ void drawEditHandles(//ClickInfo info,
122
+ int level)
120123 {
121124 if (level == 0)
122125 {
123126 return;
124127 } else
125128 {
126
- super.drawEditHandles(info, level);
129
+ super.drawEditHandles(//info,
130
+ level);
127131 cVector temp = LA.newVector(0, 0, minor);
128132 LA.xformPos(temp, toParent, temp);
129
- Rectangle majorSpot = calcHotSpot(temp, info);
133
+ Rectangle majorSpot = calcHotSpot(temp); //, info);
130134 majorSpot.translate(4, 4);
131135 temp.x = major;
132136 temp.y = temp.z = 0;
133137 LA.xformPos(temp, toParent, temp);
134
- Rectangle minorSpot = calcHotSpot(temp, info);
138
+ Rectangle minorSpot = calcHotSpot(temp); //, info);
135139 minorSpot.translate(4, 4);
136
- info.g.setColor(Color.green);
137
- info.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height);
138
- info.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height);
140
+ clickInfo.g.setColor(Color.green);
141
+ clickInfo.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height);
142
+ clickInfo.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height);
139143 return;
140144 }
141145 }
142146
143
- boolean doEditClick(ClickInfo info, int level)
147
+ boolean doEditClick(//ClickInfo info,
148
+ int level)
144149 {
145150 if (level == 0)
146151 return false;
147152 hitSomething = 0;
148
- if (super.doEditClick(info, level))
153
+ if (super.doEditClick(//info,
154
+ level))
149155 {
150156 hitSomething = 1;
151157 return true;
152158 }
153159 cVector temp = LA.newVector(0, 0, minor);
154160 LA.xformPos(temp, toParent, temp);
155
- Rectangle majorSpot = calcHotSpot(temp, info);
161
+ Rectangle majorSpot = calcHotSpot(temp); //, info);
156162 majorSpot.translate(4, 4);
157163 temp.x = major;
158164 temp.y = temp.z = 0;
159165 LA.xformPos(temp, toParent, temp);
160
- Rectangle minorSpot = calcHotSpot(temp, info);
166
+ Rectangle minorSpot = calcHotSpot(temp); //, info);
161167 minorSpot.translate(4, 4);
162
- if (majorSpot.contains(info.x, info.y))
168
+ if (majorSpot.contains(clickInfo.x, clickInfo.y))
163169 {
164170 hitSomething = 2;
165171 startRad = major;
166172 } else
167
- if (minorSpot.contains(info.x, info.y))
173
+ if (minorSpot.contains(clickInfo.x, clickInfo.y))
168174 {
169175 hitSomething = 3;
170176 startRad = minor;
....@@ -172,23 +178,25 @@
172178 {
173179 return false;
174180 }
175
- startX = info.x;
181
+ startX = clickInfo.x;
176182 return true;
177183 }
178184
179
- void doEditDrag(ClickInfo info, boolean opposite)
185
+ void doEditDrag(//ClickInfo info,
186
+ boolean opposite)
180187 {
181188 if (hitSomething == 0)
182189 return;
183190 if (hitSomething == 1)
184191 {
185
- super.doEditDrag(info, opposite);
192
+ super.doEditDrag(//info,
193
+ opposite);
186194 return;
187195 }
188
- double deltaR = info.x - startX;
196
+ double deltaR = clickInfo.x - startX;
189197 //cVector delta = LA.newVector(info.x - startX, 0, 0);
190198 //LA.xformDir(delta, info.camera.fromScreen, delta);
191
- deltaR /= 100 * info.camera.SCALE / info.camera.Distance();
199
+ deltaR /= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
192200 double newRad = startRad + deltaR;
193201 if (newRad < 0)
194202 newRad = 0;
....@@ -197,7 +205,7 @@
197205 else
198206 minor = newRad;
199207 recalculate();
200
- info.pane.repaint();
208
+ clickInfo.pane.repaint();
201209 }
202210
203211 double major;