Revision d586fda6
Added by Leszek Koltunski over 4 years ago
src/main/java/org/distorted/examples/dynamic/DynamicSurfaceView.java | ||
---|---|---|
34 | 34 |
import org.distorted.library.type.Dynamic1D; |
35 | 35 |
import org.distorted.library.type.Dynamic2D; |
36 | 36 |
import org.distorted.library.type.Dynamic3D; |
37 |
import org.distorted.library.type.Dynamic4D; |
|
37 | 38 |
import org.distorted.library.type.Static1D; |
38 | 39 |
import org.distorted.library.type.Static2D; |
39 | 40 |
import org.distorted.library.type.Static3D; |
41 |
import org.distorted.library.type.Static4D; |
|
40 | 42 |
|
41 | 43 |
import java.lang.ref.WeakReference; |
42 | 44 |
|
... | ... | |
48 | 50 |
public static final int DIM_2D = 1; |
49 | 51 |
public static final int DIM_3DXY = 2; |
50 | 52 |
public static final int DIM_3DXZ = 3; |
53 |
public static final int DIM_4DXY = 4; |
|
54 |
public static final int DIM_4DZW = 5; |
|
55 |
|
|
56 |
private static final int MAX_DIM = 4; |
|
51 | 57 |
|
52 | 58 |
static final int NUM_POINTS = 250; |
53 | 59 |
private static final Object lock = new Object(); |
... | ... | |
60 | 66 |
private Dynamic1D di1D; |
61 | 67 |
private Dynamic2D di2D; |
62 | 68 |
private Dynamic3D di3D; |
69 |
private Dynamic4D di4D; |
|
63 | 70 |
|
64 | 71 |
private Paint mPaint; |
65 | 72 |
private int mMoving; |
66 | 73 |
private int mDuration; |
67 | 74 |
private int mPosition; |
68 | 75 |
private long mDiffTime, mLastTime, mStartTime; |
69 |
private float mNoise0, mNoise1, mNoise2;
|
|
76 |
private float[] mNoise = new float[MAX_DIM];
|
|
70 | 77 |
private float mCount; |
71 | 78 |
|
72 | 79 |
private int mSize1, mSize2, mSizeT, mAvg; |
... | ... | |
77 | 84 |
private Static1D p1D; |
78 | 85 |
private Static2D p2D; |
79 | 86 |
private Static3D p3D; |
87 |
private Static4D p4D; |
|
80 | 88 |
|
81 | 89 |
private Static1D p1N; |
82 | 90 |
private Static2D p2N; |
83 | 91 |
private Static3D p3N; |
92 |
private Static4D p4N; |
|
84 | 93 |
|
85 |
private float[] mPoints = new float[3*NUM_POINTS];
|
|
94 |
private float[] mPoints = new float[MAX_DIM*NUM_POINTS];
|
|
86 | 95 |
private boolean mRunning; |
87 | 96 |
|
88 | 97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
98 | 107 |
mPaint.setStyle(Style.FILL); |
99 | 108 |
mPaint.setAntiAlias(true); |
100 | 109 |
|
101 |
mMoving = -1; |
|
102 | 110 |
mDuration = 10000; |
103 | 111 |
mCount = 0.0f; |
104 | 112 |
mPosition = 0; |
105 |
mNoise0 = 0.0f; |
|
106 |
mNoise1 = 0.0f; |
|
107 |
mNoise2 = 0.0f; |
|
108 | 113 |
mDiffTime = -1; |
109 | 114 |
mLastTime = -1; |
110 | 115 |
mStartTime= -1; |
116 |
mMoving = -1; |
|
117 |
mRunning = false; |
|
111 | 118 |
|
112 |
mRunning = false;
|
|
119 |
for(int i=0; i<MAX_DIM; i++) mNoise[i] = 0.0f;
|
|
113 | 120 |
|
114 | 121 |
clearPoints(); |
115 | 122 |
|
116 | 123 |
di1D = new Dynamic1D(mDuration,mCount); |
117 |
p1N = new Static1D(mNoise0);
|
|
124 |
p1N = new Static1D(mNoise[0]);
|
|
118 | 125 |
di2D = new Dynamic2D(mDuration,mCount); |
119 |
p2N = new Static2D(mNoise0,mNoise1);
|
|
126 |
p2N = new Static2D(mNoise[0],mNoise[1]);
|
|
120 | 127 |
di3D = new Dynamic3D(mDuration,mCount); |
121 |
p3N = new Static3D(mNoise0,mNoise1,mNoise2); |
|
128 |
p3N = new Static3D(mNoise[0],mNoise[1],mNoise[2]); |
|
129 |
di4D = new Dynamic4D(mDuration,mCount); |
|
130 |
p4N = new Static4D(mNoise[0],mNoise[1],mNoise[2],mNoise[3]); |
|
122 | 131 |
|
123 | 132 |
di1D.setAccessType(Dynamic.ACCESS_TYPE_SEQUENTIAL); |
124 | 133 |
di2D.setAccessType(Dynamic.ACCESS_TYPE_SEQUENTIAL); |
125 | 134 |
di3D.setAccessType(Dynamic.ACCESS_TYPE_SEQUENTIAL); |
135 |
di4D.setAccessType(Dynamic.ACCESS_TYPE_SEQUENTIAL); |
|
126 | 136 |
|
127 | 137 |
if(!isInEditMode()) |
128 | 138 |
{ |
... | ... | |
178 | 188 |
di1D.setMode(mode); |
179 | 189 |
di2D.setMode(mode); |
180 | 190 |
di3D.setMode(mode); |
191 |
di4D.setMode(mode); |
|
181 | 192 |
} |
182 | 193 |
|
183 | 194 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
189 | 200 |
di1D.setDuration(duration); |
190 | 201 |
di2D.setDuration(duration); |
191 | 202 |
di3D.setDuration(duration); |
203 |
di4D.setDuration(duration); |
|
192 | 204 |
} |
193 | 205 |
|
194 | 206 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
200 | 212 |
di1D.setCount(count); |
201 | 213 |
di2D.setCount(count); |
202 | 214 |
di3D.setCount(count); |
215 |
di4D.setCount(count); |
|
203 | 216 |
} |
204 | 217 |
|
205 | 218 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
209 | 222 |
di1D.setConvexity(convexity); |
210 | 223 |
di2D.setConvexity(convexity); |
211 | 224 |
di3D.setConvexity(convexity); |
225 |
di4D.setConvexity(convexity); |
|
212 | 226 |
} |
213 | 227 |
|
214 | 228 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
215 | 229 |
|
216 |
public void setNoise(float noise0, float noise1, float noise2) |
|
230 |
public void setNoise(float noise0, float noise1, float noise2, float noise3)
|
|
217 | 231 |
{ |
218 |
mNoise0 = noise0; |
|
219 |
mNoise1 = noise1; |
|
220 |
mNoise2 = noise2; |
|
232 |
mNoise[0] = noise0; |
|
233 |
mNoise[1] = noise1; |
|
234 |
mNoise[2] = noise2; |
|
235 |
mNoise[3] = noise3; |
|
221 | 236 |
|
222 |
p1N.set(mNoise0); |
|
223 |
p2N.set(mNoise0,mNoise1); |
|
224 |
p3N.set(mNoise0,mNoise1,mNoise2); |
|
237 |
p1N.set(mNoise[0]); |
|
238 |
p2N.set(mNoise[0],mNoise[1]); |
|
239 |
p3N.set(mNoise[0],mNoise[1],mNoise[2]); |
|
240 |
p4N.set(mNoise[0],mNoise[1],mNoise[2], mNoise[3]); |
|
225 | 241 |
|
226 | 242 |
di1D.setNoise(p1N); |
227 | 243 |
di2D.setNoise(p2N); |
228 | 244 |
di3D.setNoise(p3N); |
245 |
di4D.setNoise(p4N); |
|
229 | 246 |
} |
230 | 247 |
|
231 | 248 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
234 | 251 |
{ |
235 | 252 |
if( currentDim != dim ) |
236 | 253 |
{ |
237 |
if( !(currentDim==DIM_3DXY && dim==DIM_3DXZ) && !(currentDim==DIM_3DXZ && dim==DIM_3DXY) ) |
|
254 |
if( !(currentDim==DIM_3DXY && dim==DIM_3DXZ) && !(currentDim==DIM_3DXZ && dim==DIM_3DXY) && |
|
255 |
!(currentDim==DIM_4DXY && dim==DIM_4DZW) && !(currentDim==DIM_4DZW && dim==DIM_4DXY) ) |
|
238 | 256 |
{ |
239 | 257 |
resetPoints(); |
240 | 258 |
} |
... | ... | |
260 | 278 |
{ |
261 | 279 |
switch(currentDim) |
262 | 280 |
{ |
263 |
case DIM_1D: drawHorizontalAxis(c,"x"); |
|
264 |
drawPath(c,di1D,1,time); |
|
265 |
drawRedPoints1D(c); |
|
266 |
break; |
|
267 |
case DIM_2D: drawHorizontalAxis(c,"x"); |
|
268 |
drawVerticalAxis (c,"y"); |
|
269 |
drawPath(c,di2D,1,time); |
|
270 |
drawRedPoints2D(c); |
|
271 |
break; |
|
272 |
default : drawHorizontalAxis(c,"x"); |
|
273 |
drawVerticalAxis (c, currentDim==DIM_3DXY ? "y" : "z" ); |
|
274 |
drawPath(c,di3D,(currentDim==DIM_3DXY ? 1:2),time); |
|
275 |
drawRedPoints3D(c); |
|
276 |
break; |
|
281 |
case DIM_1D : drawHorizontalAxis(c,"x"); |
|
282 |
drawPath(c,di1D,0,1,time); |
|
283 |
drawRedPoints1D(c); |
|
284 |
break; |
|
285 |
case DIM_2D : drawHorizontalAxis(c,"x"); |
|
286 |
drawVerticalAxis (c,"y"); |
|
287 |
drawPath(c,di2D,0,1,time); |
|
288 |
drawRedPoints2D(c); |
|
289 |
break; |
|
290 |
case DIM_3DXY: drawHorizontalAxis(c,"x"); |
|
291 |
drawVerticalAxis (c,"y"); |
|
292 |
drawPath(c,di3D,0,1,time); |
|
293 |
drawRedPoints3D(c); |
|
294 |
break; |
|
295 |
case DIM_3DXZ: drawHorizontalAxis(c,"x"); |
|
296 |
drawVerticalAxis (c,"z"); |
|
297 |
drawPath(c,di3D,0,2,time); |
|
298 |
drawRedPoints3D(c); |
|
299 |
break; |
|
300 |
case DIM_4DXY: drawHorizontalAxis(c,"x"); |
|
301 |
drawVerticalAxis (c,"y"); |
|
302 |
drawPath(c,di4D,0,1,time); |
|
303 |
drawRedPoints4D(c); |
|
304 |
break; |
|
305 |
case DIM_4DZW: drawHorizontalAxis(c,"z"); |
|
306 |
drawVerticalAxis (c,"w"); |
|
307 |
drawPath(c,di4D,2,3,time); |
|
308 |
drawRedPoints4D(c); |
|
309 |
break; |
|
277 | 310 |
} |
278 | 311 |
} |
279 | 312 |
|
... | ... | |
284 | 317 |
|
285 | 318 |
private void clearPoints() |
286 | 319 |
{ |
287 |
for(int i=0; i<3*NUM_POINTS; i++)
|
|
320 |
for(int i=0; i<MAX_DIM*NUM_POINTS; i++)
|
|
288 | 321 |
{ |
289 | 322 |
mPoints[i] = -100000.0f; |
290 | 323 |
} |
... | ... | |
304 | 337 |
case DIM_2D : di2D.removeAll(); break; |
305 | 338 |
case DIM_3DXY: |
306 | 339 |
case DIM_3DXZ: di3D.removeAll(); break; |
340 |
case DIM_4DXY: |
|
341 |
case DIM_4DZW: di4D.removeAll(); break; |
|
307 | 342 |
} |
308 | 343 |
|
309 | 344 |
DynamicActivity act = mAct.get(); |
... | ... | |
324 | 359 |
di1D.resetToBeginning(); |
325 | 360 |
di2D.resetToBeginning(); |
326 | 361 |
di3D.resetToBeginning(); |
362 |
di4D.resetToBeginning(); |
|
327 | 363 |
} |
328 | 364 |
|
329 | 365 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
356 | 392 |
|
357 | 393 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
358 | 394 |
|
359 |
private void drawPath(Canvas c, Dynamic dyn, int index, long time) |
|
395 |
private void drawPath(Canvas c, Dynamic dyn, int indexH, int indexW, long time)
|
|
360 | 396 |
{ |
361 | 397 |
int len = dyn.getNumPoints(); |
362 | 398 |
|
... | ... | |
368 | 404 |
|
369 | 405 |
if( dyn.getDimension()==1 ) |
370 | 406 |
{ |
371 |
mPoints[3*mPosition+index] = halfScreenHeight;
|
|
407 |
mPoints[MAX_DIM*mPosition+indexW] = halfScreenHeight;
|
|
372 | 408 |
} |
373 | 409 |
|
374 |
if( dyn.get(mPoints,3*mPosition, time-mStartTime, mDiffTime) )
|
|
410 |
if( dyn.get(mPoints,MAX_DIM*mPosition, time-mStartTime, mDiffTime) )
|
|
375 | 411 |
{ |
376 | 412 |
stopDynamic(); |
377 | 413 |
} |
... | ... | |
385 | 421 |
: 0xff - (mPosition+NUM_POINTS-i)*0xff/(NUM_POINTS-1); |
386 | 422 |
|
387 | 423 |
mPaint.setColor( 0xffffff + ((color&0xff)<<24) ); |
388 |
c.drawCircle(mPoints[3*i], mPoints[3*i+index] , mSize1, mPaint );
|
|
424 |
c.drawCircle(mPoints[MAX_DIM*i+indexH], mPoints[MAX_DIM*i+indexW] , mSize1, mPaint );
|
|
389 | 425 |
} |
390 | 426 |
} |
391 | 427 |
} |
... | ... | |
429 | 465 |
} |
430 | 466 |
} |
431 | 467 |
|
468 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
469 |
|
|
470 |
private void drawRedPoints4D(Canvas c) |
|
471 |
{ |
|
472 |
int len = di4D.getNumPoints(); |
|
473 |
|
|
474 |
for(int curr=0; curr<len; curr++) |
|
475 |
{ |
|
476 |
p4D = di4D.getPoint(curr); |
|
477 |
|
|
478 |
if( currentDim==DIM_4DXY ) drawRedPoint(c,curr+"", p4D.get1(), p4D.get2()); |
|
479 |
else drawRedPoint(c,curr+"", p4D.get3(), p4D.get4()); |
|
480 |
} |
|
481 |
} |
|
482 |
|
|
432 | 483 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
433 | 484 |
|
434 | 485 |
private void drawRedPoint(Canvas c, String label, float width, float height) |
... | ... | |
443 | 494 |
|
444 | 495 |
private void addNewPoint(int x, int y) |
445 | 496 |
{ |
446 |
float gx,gy,gz; |
|
497 |
float gx,gy,gz,gw;
|
|
447 | 498 |
int len; |
499 |
int minDist = (mAvg*mAvg)/100; |
|
448 | 500 |
|
449 | 501 |
switch(currentDim) |
450 | 502 |
{ |
451 |
case DIM_1D: len = di1D.getNumPoints(); |
|
503 |
case DIM_1D : len = di1D.getNumPoints();
|
|
452 | 504 |
|
453 |
for(int g=0; g<len; g++) |
|
454 |
{ |
|
455 |
p1D = di1D.getPoint(g);
|
|
456 |
gx = p1D.get1(); |
|
505 |
for(int g=0; g<len; g++)
|
|
506 |
{
|
|
507 |
p1D = di1D.getPoint(g);
|
|
508 |
gx = p1D.get1();
|
|
457 | 509 |
|
458 |
if( (x-gx)*(x-gx) < (mAvg*mAvg/100) )
|
|
459 |
{ |
|
460 |
mMoving = g; |
|
461 |
break; |
|
462 |
} |
|
463 |
} |
|
464 |
if( mMoving <0 ) |
|
465 |
{ |
|
466 |
synchronized(lock) |
|
467 |
{ |
|
468 |
di1D.add(new Static1D(x)); |
|
469 |
mAct.get().setNumRedPoints(len+1); |
|
470 |
} |
|
471 |
} |
|
472 |
break; |
|
473 |
case DIM_2D: len = di2D.getNumPoints(); |
|
510 |
if( (x-gx)*(x-gx) < minDist )
|
|
511 |
{
|
|
512 |
mMoving = g;
|
|
513 |
break;
|
|
514 |
}
|
|
515 |
}
|
|
516 |
if( mMoving <0 )
|
|
517 |
{
|
|
518 |
synchronized(lock)
|
|
519 |
{
|
|
520 |
di1D.add(new Static1D(x));
|
|
521 |
mAct.get().setNumRedPoints(len+1);
|
|
522 |
}
|
|
523 |
}
|
|
524 |
break;
|
|
525 |
case DIM_2D : len = di2D.getNumPoints();
|
|
474 | 526 |
|
475 |
for(int g=0; g<len; g++) |
|
476 |
{ |
|
477 |
p2D = di2D.getPoint(g);
|
|
478 |
gx = p2D.get1(); |
|
479 |
gy = p2D.get2(); |
|
527 |
for(int g=0; g<len; g++)
|
|
528 |
{
|
|
529 |
p2D = di2D.getPoint(g);
|
|
530 |
gx = p2D.get1();
|
|
531 |
gy = p2D.get2();
|
|
480 | 532 |
|
481 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < (mAvg*mAvg/100) ) |
|
482 |
{ |
|
483 |
mMoving = g; |
|
484 |
break; |
|
485 |
} |
|
486 |
} |
|
487 |
if( mMoving <0 ) |
|
488 |
{ |
|
489 |
synchronized(lock) |
|
490 |
{ |
|
491 |
di2D.add(new Static2D(x,y)); |
|
492 |
mAct.get().setNumRedPoints(len+1); |
|
493 |
} |
|
494 |
} |
|
495 |
break; |
|
496 |
default : len = di3D.getNumPoints(); |
|
533 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < minDist ) |
|
534 |
{ |
|
535 |
mMoving = g; |
|
536 |
break; |
|
537 |
} |
|
538 |
} |
|
539 |
if( mMoving <0 ) |
|
540 |
{ |
|
541 |
synchronized(lock) |
|
542 |
{ |
|
543 |
di2D.add(new Static2D(x,y)); |
|
544 |
mAct.get().setNumRedPoints(len+1); |
|
545 |
} |
|
546 |
} |
|
547 |
break; |
|
548 |
case DIM_3DXY: |
|
549 |
case DIM_3DXZ:len = di3D.getNumPoints(); |
|
497 | 550 |
|
498 |
for(int g=0; g<len; g++) |
|
499 |
{ |
|
500 |
p3D = di3D.getPoint(g);
|
|
501 |
gx = p3D.get1(); |
|
502 |
gy = p3D.get2(); |
|
503 |
gz = p3D.get3(); |
|
551 |
for(int g=0; g<len; g++)
|
|
552 |
{
|
|
553 |
p3D = di3D.getPoint(g);
|
|
554 |
gx = p3D.get1();
|
|
555 |
gy = p3D.get2();
|
|
556 |
gz = p3D.get3();
|
|
504 | 557 |
|
505 |
if( currentDim==DIM_3DXY ) |
|
506 |
{ |
|
507 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < (mAvg*mAvg/100) ) |
|
508 |
{ |
|
509 |
mMoving = g; |
|
510 |
break; |
|
511 |
} |
|
512 |
} |
|
513 |
if( currentDim==DIM_3DXZ ) |
|
514 |
{ |
|
515 |
if( (x-gx)*(x-gx) + (y-gz)*(y-gz) < (mAvg*mAvg/100) ) |
|
516 |
{ |
|
517 |
mMoving = g; |
|
518 |
break; |
|
519 |
} |
|
520 |
} |
|
521 |
} |
|
522 |
if( mMoving <0 ) |
|
523 |
{ |
|
524 |
synchronized(lock) |
|
525 |
{ |
|
526 |
if( currentDim==DIM_3DXY ) di3D.add(new Static3D(x,y, halfScreenHeight)); |
|
527 |
if( currentDim==DIM_3DXZ ) di3D.add(new Static3D(x, halfScreenHeight,y)); |
|
528 |
mAct.get().setNumRedPoints(len+1); |
|
529 |
} |
|
530 |
} |
|
531 |
break; |
|
558 |
if( currentDim==DIM_3DXY ) |
|
559 |
{ |
|
560 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < minDist ) |
|
561 |
{ |
|
562 |
mMoving = g; |
|
563 |
break; |
|
564 |
} |
|
565 |
} |
|
566 |
if( currentDim==DIM_3DXZ ) |
|
567 |
{ |
|
568 |
if( (x-gx)*(x-gx) + (y-gz)*(y-gz) < minDist ) |
|
569 |
{ |
|
570 |
mMoving = g; |
|
571 |
break; |
|
572 |
} |
|
573 |
} |
|
574 |
} |
|
575 |
|
|
576 |
if( mMoving <0 ) |
|
577 |
{ |
|
578 |
synchronized(lock) |
|
579 |
{ |
|
580 |
if( currentDim==DIM_3DXY ) di3D.add(new Static3D(x,y, halfScreenHeight)); |
|
581 |
if( currentDim==DIM_3DXZ ) di3D.add(new Static3D(x, halfScreenHeight,y)); |
|
582 |
mAct.get().setNumRedPoints(len+1); |
|
583 |
} |
|
584 |
} |
|
585 |
break; |
|
586 |
case DIM_4DXY: |
|
587 |
case DIM_4DZW:len = di4D.getNumPoints(); |
|
588 |
|
|
589 |
for(int g=0; g<len; g++) |
|
590 |
{ |
|
591 |
p4D = di4D.getPoint(g); |
|
592 |
gx = p4D.get1(); |
|
593 |
gy = p4D.get2(); |
|
594 |
gz = p4D.get3(); |
|
595 |
gw = p4D.get4(); |
|
596 |
|
|
597 |
if( currentDim==DIM_4DXY ) |
|
598 |
{ |
|
599 |
if( (x-gx)*(x-gx) + (y-gy)*(y-gy) < minDist ) |
|
600 |
{ |
|
601 |
mMoving = g; |
|
602 |
break; |
|
603 |
} |
|
604 |
} |
|
605 |
if( currentDim==DIM_4DZW ) |
|
606 |
{ |
|
607 |
if( (x-gz)*(x-gz) + (y-gw)*(y-gw) < minDist ) |
|
608 |
{ |
|
609 |
mMoving = g; |
|
610 |
break; |
|
611 |
} |
|
612 |
} |
|
613 |
} |
|
614 |
|
|
615 |
if( mMoving <0 ) |
|
616 |
{ |
|
617 |
synchronized(lock) |
|
618 |
{ |
|
619 |
if( currentDim==DIM_4DXY ) di4D.add(new Static4D(x,y, halfScreenWidth, halfScreenHeight)); |
|
620 |
if( currentDim==DIM_4DZW ) di4D.add(new Static4D( halfScreenWidth, halfScreenHeight,x,y)); |
|
621 |
mAct.get().setNumRedPoints(len+1); |
|
622 |
} |
|
623 |
} |
|
624 |
break; |
|
532 | 625 |
} |
533 | 626 |
} |
534 | 627 |
|
... | ... | |
539 | 632 |
int prev = mPosition-1; |
540 | 633 |
if( prev<0 ) prev = NUM_POINTS-1; |
541 | 634 |
|
542 |
float xdiff = mPoints[3*prev ]-mPoints[3*mPosition ]; |
|
543 |
float ydiff = mPoints[3*prev+1]-mPoints[3*mPosition+1]; |
|
544 |
float zdiff = mPoints[3*prev+2]-mPoints[3*mPosition+2]; |
|
635 |
float xdiff = mPoints[MAX_DIM*prev ]-mPoints[MAX_DIM*mPosition ]; |
|
636 |
float ydiff = mPoints[MAX_DIM*prev+1]-mPoints[MAX_DIM*mPosition+1]; |
|
637 |
float zdiff = mPoints[MAX_DIM*prev+2]-mPoints[MAX_DIM*mPosition+2]; |
|
638 |
float wdiff = mPoints[MAX_DIM*prev+3]-mPoints[MAX_DIM*mPosition+3]; |
|
545 | 639 |
|
546 |
float dist = (float)Math.sqrt( xdiff*xdiff + ydiff*ydiff + zdiff*zdiff ); |
|
640 |
float dist = (float)Math.sqrt( xdiff*xdiff + ydiff*ydiff + zdiff*zdiff + wdiff*wdiff);
|
|
547 | 641 |
float speed= mDiffTime<=0 ? 0: dist / mDiffTime; |
548 | 642 |
float timepoint = ((float)(time-mStartTime))/mDuration; |
549 | 643 |
|
... | ... | |
584 | 678 |
break; |
585 | 679 |
case DIM_3DXZ: di3D.setPoint(mMoving, xDown, (int)di3D.getPoint(mMoving).get2(), yDown); |
586 | 680 |
break; |
681 |
case DIM_4DXY: di4D.setPoint(mMoving, xDown, yDown, (int)di4D.getPoint(mMoving).get3(), (int)di4D.getPoint(mMoving).get4()); |
|
682 |
break; |
|
683 |
case DIM_4DZW: di4D.setPoint(mMoving, (int)di4D.getPoint(mMoving).get1(), (int)di4D.getPoint(mMoving).get2(), xDown, yDown); |
|
684 |
break; |
|
587 | 685 |
} |
588 | 686 |
} |
589 | 687 |
break; |
Also available in: Unified diff
Dynamics App: add checking a Dynamic4D.