Normand Briere
2019-08-06 b3ae4e889872ca0b9ca76f1d17b2f0b961226729
Torus.java
....@@ -2,7 +2,7 @@
22
33 class Torus extends Biparam implements java.io.Serializable
44 {
5
- //static final long serialVersionUID = -7637054329820073252L;
5
+ static final long serialVersionUID = -7637054329820073252L; // Old
66
77 Torus()
88 {
....@@ -64,7 +64,7 @@
6464 v = 0;
6565
6666 double uAng = u * 2 * Math.PI;
67
- double vAng = v * 2 * Math.PI;
67
+ double vAng = -v * 2 * Math.PI;
6868 double cosua = Math.cos(uAng);
6969 double sinua = Math.sin(uAng);
7070 double cosva = Math.cos(vAng);
....@@ -118,55 +118,59 @@
118118 return rad2 <= minor * minor;
119119 }
120120
121
- void drawEditHandles(ClickInfo info, int level)
121
+ void drawEditHandles(//ClickInfo info,
122
+ int level)
122123 {
123124 if (level == 0)
124125 {
125126 return;
126127 } else
127128 {
128
- super.drawEditHandles(info, level);
129
+ super.drawEditHandles(//info,
130
+ level);
129131 cVector temp = LA.newVector(0, 0, minor);
130132 LA.xformPos(temp, toParent, temp);
131
- Rectangle majorSpot = calcHotSpot(temp, info);
133
+ Rectangle majorSpot = calcHotSpot(temp); //, info);
132134 majorSpot.translate(4, 4);
133135 temp.x = major;
134136 temp.y = temp.z = 0;
135137 LA.xformPos(temp, toParent, temp);
136
- Rectangle minorSpot = calcHotSpot(temp, info);
138
+ Rectangle minorSpot = calcHotSpot(temp); //, info);
137139 minorSpot.translate(4, 4);
138
- info.g.setColor(Color.green);
139
- info.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height);
140
- 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);
141143 return;
142144 }
143145 }
144146
145
- boolean doEditClick(ClickInfo info, int level)
147
+ boolean doEditClick(//ClickInfo info,
148
+ int level)
146149 {
147150 if (level == 0)
148151 return false;
149152 hitSomething = 0;
150
- if (super.doEditClick(info, level))
153
+ if (super.doEditClick(//info,
154
+ level))
151155 {
152156 hitSomething = 1;
153157 return true;
154158 }
155159 cVector temp = LA.newVector(0, 0, minor);
156160 LA.xformPos(temp, toParent, temp);
157
- Rectangle majorSpot = calcHotSpot(temp, info);
161
+ Rectangle majorSpot = calcHotSpot(temp); //, info);
158162 majorSpot.translate(4, 4);
159163 temp.x = major;
160164 temp.y = temp.z = 0;
161165 LA.xformPos(temp, toParent, temp);
162
- Rectangle minorSpot = calcHotSpot(temp, info);
166
+ Rectangle minorSpot = calcHotSpot(temp); //, info);
163167 minorSpot.translate(4, 4);
164
- if (majorSpot.contains(info.x, info.y))
168
+ if (majorSpot.contains(clickInfo.x, clickInfo.y))
165169 {
166170 hitSomething = 2;
167171 startRad = major;
168172 } else
169
- if (minorSpot.contains(info.x, info.y))
173
+ if (minorSpot.contains(clickInfo.x, clickInfo.y))
170174 {
171175 hitSomething = 3;
172176 startRad = minor;
....@@ -174,23 +178,25 @@
174178 {
175179 return false;
176180 }
177
- startX = info.x;
181
+ startX = clickInfo.x;
178182 return true;
179183 }
180184
181
- void doEditDrag(ClickInfo info, boolean opposite)
185
+ void doEditDrag(//ClickInfo info,
186
+ boolean opposite)
182187 {
183188 if (hitSomething == 0)
184189 return;
185190 if (hitSomething == 1)
186191 {
187
- super.doEditDrag(info, opposite);
192
+ super.doEditDrag(//info,
193
+ opposite);
188194 return;
189195 }
190
- double deltaR = info.x - startX;
196
+ double deltaR = clickInfo.x - startX;
191197 //cVector delta = LA.newVector(info.x - startX, 0, 0);
192198 //LA.xformDir(delta, info.camera.fromScreen, delta);
193
- deltaR /= 100 * info.camera.SCALE / info.camera.Distance();
199
+ deltaR /= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance();
194200 double newRad = startRad + deltaR;
195201 if (newRad < 0)
196202 newRad = 0;
....@@ -199,7 +205,7 @@
199205 else
200206 minor = newRad;
201207 recalculate();
202
- info.pane.repaint();
208
+ clickInfo.pane.repaint();
203209 }
204210
205211 double major;