.. | .. |
---|
2 | 2 | |
---|
3 | 3 | class Torus extends Biparam implements java.io.Serializable |
---|
4 | 4 | { |
---|
| 5 | + static final long serialVersionUID = -7637054329820073252L; // Old |
---|
| 6 | + |
---|
5 | 7 | Torus() |
---|
6 | 8 | { |
---|
7 | 9 | inPnt = new cVector(); |
---|
.. | .. |
---|
54 | 56 | buffer.append("}\n"); |
---|
55 | 57 | } |
---|
56 | 58 | |
---|
| 59 | + double uStretch() |
---|
| 60 | + { |
---|
| 61 | + return 6; // Actually 6.28 (I think) |
---|
| 62 | + } |
---|
| 63 | + |
---|
57 | 64 | Vertex biparamFunction(double u, double v) |
---|
58 | 65 | { |
---|
59 | 66 | if (u == 1) |
---|
.. | .. |
---|
62 | 69 | v = 0; |
---|
63 | 70 | |
---|
64 | 71 | double uAng = u * 2 * Math.PI; |
---|
65 | | - double vAng = v * 2 * Math.PI; |
---|
| 72 | + double vAng = -v * 2 * Math.PI; |
---|
66 | 73 | double cosua = Math.cos(uAng); |
---|
67 | 74 | double sinua = Math.sin(uAng); |
---|
68 | 75 | double cosva = Math.cos(vAng); |
---|
.. | .. |
---|
85 | 92 | //temp.pos = tPos; // useless new |
---|
86 | 93 | temp.norm = tNorm; |
---|
87 | 94 | LA.vecNormalize(temp.norm); |
---|
| 95 | + |
---|
| 96 | + temp.y += minor; |
---|
| 97 | + |
---|
88 | 98 | return temp; |
---|
89 | 99 | } |
---|
90 | 100 | |
---|
.. | .. |
---|
116 | 126 | return rad2 <= minor * minor; |
---|
117 | 127 | } |
---|
118 | 128 | |
---|
119 | | - void drawEditHandles(ClickInfo info, int level) |
---|
| 129 | + void drawEditHandles(//ClickInfo info, |
---|
| 130 | + int level) |
---|
120 | 131 | { |
---|
121 | 132 | if (level == 0) |
---|
122 | 133 | { |
---|
123 | 134 | return; |
---|
124 | 135 | } else |
---|
125 | 136 | { |
---|
126 | | - super.drawEditHandles(info, level); |
---|
| 137 | + super.drawEditHandles(//info, |
---|
| 138 | + level); |
---|
127 | 139 | cVector temp = LA.newVector(0, 0, minor); |
---|
128 | 140 | LA.xformPos(temp, toParent, temp); |
---|
129 | | - Rectangle majorSpot = calcHotSpot(temp, info); |
---|
| 141 | + Rectangle majorSpot = calcHotSpot(temp); //, info); |
---|
130 | 142 | majorSpot.translate(4, 4); |
---|
131 | 143 | temp.x = major; |
---|
132 | 144 | temp.y = temp.z = 0; |
---|
133 | 145 | LA.xformPos(temp, toParent, temp); |
---|
134 | | - Rectangle minorSpot = calcHotSpot(temp, info); |
---|
| 146 | + Rectangle minorSpot = calcHotSpot(temp); //, info); |
---|
135 | 147 | 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); |
---|
| 148 | + clickInfo.g.setColor(Color.green); |
---|
| 149 | + clickInfo.g.fillRect(majorSpot.x, majorSpot.y, majorSpot.width, majorSpot.height); |
---|
| 150 | + clickInfo.g.fillRect(minorSpot.x, minorSpot.y, minorSpot.width, minorSpot.height); |
---|
139 | 151 | return; |
---|
140 | 152 | } |
---|
141 | 153 | } |
---|
142 | 154 | |
---|
143 | | - boolean doEditClick(ClickInfo info, int level) |
---|
| 155 | + boolean doEditClick(//ClickInfo info, |
---|
| 156 | + int level) |
---|
144 | 157 | { |
---|
145 | 158 | if (level == 0) |
---|
146 | 159 | return false; |
---|
147 | 160 | hitSomething = 0; |
---|
148 | | - if (super.doEditClick(info, level)) |
---|
| 161 | + if (super.doEditClick(//info, |
---|
| 162 | + level)) |
---|
149 | 163 | { |
---|
150 | 164 | hitSomething = 1; |
---|
151 | 165 | return true; |
---|
152 | 166 | } |
---|
153 | 167 | cVector temp = LA.newVector(0, 0, minor); |
---|
154 | 168 | LA.xformPos(temp, toParent, temp); |
---|
155 | | - Rectangle majorSpot = calcHotSpot(temp, info); |
---|
| 169 | + Rectangle majorSpot = calcHotSpot(temp); //, info); |
---|
156 | 170 | majorSpot.translate(4, 4); |
---|
157 | 171 | temp.x = major; |
---|
158 | 172 | temp.y = temp.z = 0; |
---|
159 | 173 | LA.xformPos(temp, toParent, temp); |
---|
160 | | - Rectangle minorSpot = calcHotSpot(temp, info); |
---|
| 174 | + Rectangle minorSpot = calcHotSpot(temp); //, info); |
---|
161 | 175 | minorSpot.translate(4, 4); |
---|
162 | | - if (majorSpot.contains(info.x, info.y)) |
---|
| 176 | + if (majorSpot.contains(clickInfo.x, clickInfo.y)) |
---|
163 | 177 | { |
---|
164 | 178 | hitSomething = 2; |
---|
165 | 179 | startRad = major; |
---|
166 | 180 | } else |
---|
167 | | - if (minorSpot.contains(info.x, info.y)) |
---|
| 181 | + if (minorSpot.contains(clickInfo.x, clickInfo.y)) |
---|
168 | 182 | { |
---|
169 | 183 | hitSomething = 3; |
---|
170 | 184 | startRad = minor; |
---|
.. | .. |
---|
172 | 186 | { |
---|
173 | 187 | return false; |
---|
174 | 188 | } |
---|
175 | | - startX = info.x; |
---|
| 189 | + startX = clickInfo.x; |
---|
176 | 190 | return true; |
---|
177 | 191 | } |
---|
178 | 192 | |
---|
179 | | - void doEditDrag(ClickInfo info, boolean opposite) |
---|
| 193 | + void doEditDrag(//ClickInfo info, |
---|
| 194 | + boolean opposite) |
---|
180 | 195 | { |
---|
181 | 196 | if (hitSomething == 0) |
---|
182 | 197 | return; |
---|
183 | 198 | if (hitSomething == 1) |
---|
184 | 199 | { |
---|
185 | | - super.doEditDrag(info, opposite); |
---|
| 200 | + super.doEditDrag(//info, |
---|
| 201 | + opposite); |
---|
186 | 202 | return; |
---|
187 | 203 | } |
---|
188 | | - double deltaR = info.x - startX; |
---|
| 204 | + double deltaR = clickInfo.x - startX; |
---|
189 | 205 | //cVector delta = LA.newVector(info.x - startX, 0, 0); |
---|
190 | 206 | //LA.xformDir(delta, info.camera.fromScreen, delta); |
---|
191 | | - deltaR /= 100 * info.camera.SCALE / info.camera.Distance(); |
---|
| 207 | + deltaR /= 100 * clickInfo.camera.SCALE / clickInfo.camera.Distance(); |
---|
192 | 208 | double newRad = startRad + deltaR; |
---|
193 | 209 | if (newRad < 0) |
---|
194 | 210 | newRad = 0; |
---|
.. | .. |
---|
197 | 213 | else |
---|
198 | 214 | minor = newRad; |
---|
199 | 215 | recalculate(); |
---|
200 | | - info.pane.repaint(); |
---|
| 216 | + clickInfo.pane.repaint(); |
---|
201 | 217 | } |
---|
202 | 218 | |
---|
203 | 219 | double major; |
---|