Hi Vladimir,
>Vladimir Olenin wrote:
>It is interesting that in the cource of discussion neither has said how
>to modify the code. I wonder why. I bet there is a number of people who
>want to know it.
The relative speed of the loop depends somewhat on the length of the
keys[] array, but roughly speaking commenting out the redundant lines as
you suggest should get the code running 40-80 times faster.
The following code avoids the loop and should run 300-800 times faster
(depends on platform as well as array length) which is no surprise since
System.arraycopy invariably uses native memory block copy operations:
keyFrames = new TCBKeyFrame[keysLength+2];
System.arraycopy(keys, 0, keyFrames, 1, keysLength);
keyFrames[0] = keys[0];
keyFrames[keysLength+1] = keys[keysLength];
>Vladimir Olenin wrote:
>To do the actual copy function the
>following should have been written instead:
>keysFrames[i] = (TCBKeyFrame)(keys[i-1].clone());
This won't work because TCBKeyFrame doesn't implement Cloneable (and
neither does its superclass java.lang.Object).
I think you'd have to use the TCBKeyFrame(TCBKeyFrame kf) constructor to
make each TCBKeyFrame copy.
Andrew Moulden
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".