Mocap data is recorded in three dimensions. This means that an x, y, and z co-ordinate is recorded for each control point.
1. Begin with this program:
public class mocap { public static void main (String args[]) { new mocap (); }public mocap () {int x[] = {234, 345, 348, 456, 567, 765, 654, 544, 587, 578}; int y[] = {456, 456, 345, 347, 346, 467, 562, 562, 532, 576}; int z[] = {345, 324, 312, 317, 304, 305, 307, 308, 309, 298}; } }
2. Print out the data so that it appears like this:
(234, 456, 345) (345, 456, 324) (348, 345, 312) (456, 347, 317) (567, 346, 304) (765, 467, 305) (654, 562, 307) (544, 562, 308) (587, 532, 309) (578, 576, 298)
3. To find the minimum x co-ordinate, you would use this code:
int min = x [0];
for (int i = 0 ; i < x.length ; i++)
{
if (min > x [i])
min = x [i];
}
System.out.println ("\nThe minimum x is: " + min);
Add it to your code.
4. Find the minimun y co-ordinate and also the minimum z co-ordinate.
5. Find the maximum x, y, and z co-ordinate.
6. Find the average x, y, and z co-ordinate.
7. If x is over 550, the control point is too far away and will not be seen on the screen. Print out the co-ordinates again, but omit the ones with x over 550.
Control points close (234, 456, 345) (345, 456, 324) (348, 345, 312) (456, 347, 317) (544, 562, 308)
8. If z is between 315 and 304, the point will be in focus. Print out the co-ordinates again, but omit the points that won't be in focus.
In focus points (348, 345, 312) (567, 346, 304) (765, 467, 305) (654, 562, 307) (544, 562, 308) (587, 532, 309)