//
// time: Wed Apr  9 15:22:50 1997
//
// version: 3.1.1 (format), 3.1.4 (DX Beta)
//
//
//
// macro reference (direct): Matte MatteMacro.net
include "MatteMacro.net"
//
// MODULE main
//
// comment: This visual program uses the macro "MatteMacro" found in samples/macros. You can either load it before loading this visual program, or it will be loaded automatically for you. To run, simply Execute Once.
// comment: 
// comment: This rather complex visual program uses GetLocal and SetLocal to track the position of a falling ball. One pair of GetLocal and SetLocal modules are used to store and retrieve the last vertical position of the ball. Another pair are used to store and retrieve the last vertical velocity of the ball. A third pair are used to store and retrieve the last matted image of the falling ball. A fourth pair is used to store and retrieve the current time.
// comment: 
// comment: Compute is used to check the computed vertical position to compare it against the value 0 (the table top). If it is less than zero, it is inverted after being multiplied by a "bounciness" factor. In addition, the vertical velocity is inverted and reduced in magnitude.
// comment: 
// comment: A loop is created by including the Done module in the visual program. Done will cause the loop to end when the ball falls out of the "bottom of the picture".
// comment: 
// comment: To run this visual program, choose "Execute Once" from the Execute menu. 
// comment: 
// comment: NOTE: for best performance of this visual program, the outputs of all modules (as well as module inside the Matte macro) have been set to "cache none". The reason for this is that there is no advantage to saving intermediate results for this program, since no iteration (user-driven rotation for example) is to take place. In addition,  the Options module has been used to set a "cache" attribute with a value of 0 for the Image passed to the Display tool. This turns off internal caching within the Display module. The same result could have been achieved by specifying "-cache off" on the command line to dx.
// page assignment: ball	order=10, windowed=0, showing=0
// page assignment: curr_image	order=12, windowed=0, showing=0
// page assignment: done	order=14, windowed=0, showing=0
// page assignment: h_pos	order=9, windowed=0, showing=0
// page assignment: initial_cond	order=2, windowed=0, showing=1
// page assignment: matte	order=13, windowed=0, showing=0
// page assignment: table	order=11, windowed=0, showing=0
// page assignment: time	order=3, windowed=0, showing=0
// page assignment: vpos	order=7, windowed=0, showing=0
// page assignment: vpos_state	order=8, windowed=0, showing=0
// page assignment: vvel	order=4, windowed=0, showing=0
// page assignment: vvel_state	order=5, windowed=0, showing=0
// page assignment: vvel_table	order=6, windowed=0, showing=0
// workspace: width = 596, height = 295
// layout: snap = 0, width = 50, height = 50, align = UL
//
macro main(
) -> (
) {
    // 
    // node Camera[1]: x = 223, y = 207, inputs = 9, label = Camera
    // input[1]: defaulting = 0, visible = 0, type = 8, value = [0 12.5 0]
    // input[2]: defaulting = 0, visible = 0, type = 8, value = [0 12.5 1]
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 50.0
    // input[4]: defaulting = 0, visible = 0, type = 1, value = 300
    // input[5]: visible = 0
    // input[6]: visible = 0
    // input[7]: defaulting = 0, visible = 0, type = 3, value = NULL
    // input[8]: defaulting = 0, visible = 0, type = 5, value = 60.0
    // input[9]: defaulting = 0, visible = 0, type = 32, value = "black"
    // page group: curr_image
    //
main_Camera_1_out_1[cache: 0] = 
    Camera(
    main_Camera_1_in_1,
    main_Camera_1_in_2,
    main_Camera_1_in_3,
    main_Camera_1_in_4,
    main_Camera_1_in_5,
    main_Camera_1_in_6,
    main_Camera_1_in_7,
    main_Camera_1_in_8,
    main_Camera_1_in_9
    ) [instance: 1, cache: 1];
    // 
    // node Construct[3]: x = 28, y = 130, inputs = 4, label = Construct
    // input[1]: defaulting = 0, visible = 1, type = 16777224, value = {[0 0 0]}
    // input[4]: defaulting = 0, visible = 1, type = 16777245, value = {1.0}
    // page group: ball
    //
main_Construct_3_out_1[cache: 0] = 
    Construct(
    main_Construct_3_in_1,
    main_Construct_3_in_2,
    main_Construct_3_in_3,
    main_Construct_3_in_4
    ) [instance: 3, cache: 1];
    // 
    // node Scalar[12]: x = 213, y = 133, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_12"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 2.0 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 0
    // input[5]: defaulting = 1, visible = 0, type = 5, value = 0.2
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 3.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = 2.0 
    // page group: ball
    //
    // 
    // node Glyph[1]: x = 22, y = 232, inputs = 7, label = Glyph
    // input[2]: defaulting = 0, visible = 1, type = 5, value = .6
    // page group: ball
    //
main_Glyph_1_out_1[cache: 0] = 
    Glyph(
    main_Construct_3_out_1,
    main_Glyph_1_in_2,
    main_Glyph_1_in_3,
    main_Scalar_12_out_1,
    main_Glyph_1_in_5,
    main_Glyph_1_in_6,
    main_Glyph_1_in_7
    ) [instance: 1, cache: 1];
    // 
    // node Color[1]: x = 50, y = 328, inputs = 5, label = Color
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "red"
    // page group: ball
    //
main_Color_1_out_1[cache: 0] = 
    Color(
    main_Glyph_1_out_1,
    main_Color_1_in_2,
    main_Color_1_in_3,
    main_Color_1_in_4,
    main_Color_1_in_5
    ) [instance: 1, cache: 1];
    // 
    // node Scalar[10]: x = 216, y = 134, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_10"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 22.0 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 0
    // input[5]: defaulting = 1, visible = 0, type = 5, value = 10.0
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 30.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = 22.0 
    // page group: initial_cond
    //
    // 
    // node Transmitter[12]: x = 229, y = 233, inputs = 1, label = initial_v_pos
    // page group: initial_cond
    //
initial_v_pos = main_Scalar_10_out_1;
    // 
    // node Receiver[16]: x = 155, y = 111, inputs = 1, label = initial_v_pos
    // page group: vpos_state
    //
main_Receiver_16_out_1[cache: 0] = initial_v_pos;
    // 
    // node GetLocal[7]: x = 244, y = 186, inputs = 3, label = GetLocal
    // page group: vpos_state
    //
main_GetLocal_7_out_1[cache: 0],
main_GetLocal_7_out_2[cache: 0] = 
    GetLocal(
    main_Receiver_16_out_1,
    main_GetLocal_7_in_2,
    main_GetLocal_7_in_3
    ) [instance: 7, cache: 1];
    // 
    // node Transmitter[13]: x = 153, y = 262, inputs = 1, label = last_v_pos
    // page group: vpos_state
    //
last_v_pos = main_GetLocal_7_out_1;
    // 
    // node Receiver[17]: x = 99, y = 141, inputs = 1, label = last_v_pos
    // page group: vpos
    //
main_Receiver_17_out_1[cache: 0] = last_v_pos;
    // 
    // node Scalar[1]: x = 274, y = 130, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_1"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 0.25 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 1
    // input[5]: defaulting = 1, visible = 0, type = 5, value = 0.1
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 2.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = 0.25 
    // page group: time
    //
    // 
    // node Transmitter[1]: x = 305, y = 515, inputs = 1, label = delta_t
    // page group: time
    //
delta_t = main_Scalar_1_out_1;
    // 
    // node Receiver[19]: x = 193, y = 142, inputs = 1, label = delta_t
    // page group: vpos
    //
main_Receiver_19_out_1[cache: 0] = delta_t;
    // 
    // node GetLocal[8]: x = 156, y = 158, inputs = 3, label = GetLocal
    // input[1]: defaulting = 0, visible = 1, type = 67108863, value = 0
    // page group: vvel_state
    //
main_GetLocal_8_out_1[cache: 0],
main_GetLocal_8_out_2[cache: 0] = 
    GetLocal(
    main_GetLocal_8_in_1,
    main_GetLocal_8_in_2,
    main_GetLocal_8_in_3
    ) [instance: 8, cache: 1];
    // 
    // node Transmitter[14]: x = 43, y = 259, inputs = 1, label = last_v_velocity
    // page group: vvel_state
    //
last_v_velocity = main_GetLocal_8_out_1;
    // 
    // node Receiver[20]: x = 98, y = 145, inputs = 1, label = last_v_velocity
    // page group: vvel
    //
main_Receiver_20_out_1[cache: 0] = last_v_velocity;
    // 
    // node Receiver[21]: x = 202, y = 147, inputs = 1, label = delta_t
    // page group: vvel
    //
main_Receiver_21_out_1[cache: 0] = delta_t;
    // 
    // node Compute[17]: x = 146, y = 224, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 + 9.8*$1"
    // page group: vvel
    // expression: value = last_v_velocity + 9.8*delta_t
    // name[2]: value = last_v_velocity
    // name[3]: value = delta_t
    //
main_Compute_17_out_1[cache: 0] = 
    Compute(
    main_Compute_17_in_1,
    main_Receiver_20_out_1,
    main_Receiver_21_out_1
    ) [instance: 17, cache: 1];
    // 
    // node Transmitter[16]: x = 190, y = 316, inputs = 1, label = v_velocity
    // page group: vvel
    //
v_velocity = main_Compute_17_out_1;
    // 
    // node Receiver[18]: x = 263, y = 143, inputs = 1, label = v_velocity
    // page group: vpos
    //
main_Receiver_18_out_1[cache: 0] = v_velocity;
    // 
    // node Compute[15]: x = 169, y = 341, inputs = 4, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 - $1*$2"
    // page group: vpos
    // expression: value = last_v_position - delta_t*v_velocity
    // name[2]: value = last_v_position
    // name[3]: value = delta_t
    // name[4]: value = v_velocity
    //
main_Compute_15_out_1[cache: 0] = 
    Compute(
    main_Compute_15_in_1,
    main_Receiver_17_out_1,
    main_Receiver_19_out_1,
    main_Receiver_18_out_1
    ) [instance: 15, cache: 1];
    // 
    // node Scalar[11]: x = 351, y = 138, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_11"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 0.55 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 0
    // input[5]: defaulting = 1, visible = 0, type = 5, value = 0.1
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = 0.55 
    // page group: initial_cond
    //
    // 
    // node Transmitter[17]: x = 349, y = 227, inputs = 1, label = bounciness
    // page group: initial_cond
    //
bounciness = main_Scalar_11_out_1;
    // 
    // node Receiver[37]: x = 449, y = 148, inputs = 1, label = bounciness
    // page group: vpos
    //
main_Receiver_37_out_1[cache: 0] = bounciness;
    // 
    // node GetLocal[9]: x = 125, y = 119, inputs = 3, label = GetLocal
    // input[1]: defaulting = 0, visible = 1, type = 67108863, value = 0
    // page group: time
    //
main_GetLocal_9_out_1[cache: 0],
main_GetLocal_9_out_2[cache: 0] = 
    GetLocal(
    main_GetLocal_9_in_1,
    main_GetLocal_9_in_2,
    main_GetLocal_9_in_3
    ) [instance: 9, cache: 1];
    // 
    // node Compute[2]: x = 124, y = 286, inputs = 3, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 +$1"
    // page group: time
    // expression: value = lasttime +delta_t
    // name[2]: value = lasttime
    // name[3]: value = delta_t
    //
main_Compute_2_out_1[cache: 0] = 
    Compute(
    main_Compute_2_in_1,
    main_GetLocal_9_out_1,
    main_Scalar_1_out_1
    ) [instance: 2, cache: 1];
    // 
    // node Transmitter[2]: x = 102, y = 517, inputs = 1, label = time
    // page group: time
    //
time = main_Compute_2_out_1;
    // 
    // node Receiver[15]: x = 81, y = 145, inputs = 1, label = time
    // page group: h_pos
    //
main_Receiver_15_out_1[cache: 0] = time;
    // 
    // node Scalar[8]: x = 41, y = 126, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_8"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = -15.0 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 0
    // input[5]: defaulting = 1, visible = 0, type = 5, value = -25.0
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 0.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = -15.0 
    // page group: initial_cond
    //
    // 
    // node Transmitter[9]: x = 57, y = 228, inputs = 1, label = initial_h_pos
    // page group: initial_cond
    //
initial_h_pos = main_Scalar_8_out_1;
    // 
    // node Receiver[13]: x = 145, y = 140, inputs = 1, label = initial_h_pos
    // page group: h_pos
    //
main_Receiver_13_out_1[cache: 0] = initial_h_pos;
    // 
    // node Scalar[9]: x = 125, y = 135, inputs = 11, label = Scalar
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "Scalar_9"
    // input[3]: defaulting = 0, visible = 0, type = 5, value = 4.6 
    // input[4]: defaulting = 1, visible = 0, type = 3, value = 0
    // input[5]: defaulting = 1, visible = 0, type = 5, value = 0.0
    // input[6]: defaulting = 1, visible = 0, type = 5, value = 5.0
    // input[7]: defaulting = 1, visible = 0, type = 5, value = 1.0
    // input[9]: defaulting = 1, visible = 0, type = 1, value = 5
    // output[1]: visible = 1, type = 5, value = 4.6 
    // page group: initial_cond
    //
    // 
    // node Transmitter[10]: x = 176, y = 227, inputs = 1, label = h_vel
    // page group: initial_cond
    //
h_vel = main_Scalar_9_out_1;
    // 
    // node Receiver[14]: x = 281, y = 143, inputs = 1, label = h_vel
    // page group: h_pos
    //
main_Receiver_14_out_1[cache: 0] = h_vel;
    // 
    // node Compute[14]: x = 156, y = 219, inputs = 4, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$1 + $2*$0"
    // page group: h_pos
    // expression: value = initial_h + h_velocity*time
    // name[2]: value = time
    // name[3]: value = initial_h
    // name[4]: value = h_velocity
    //
main_Compute_14_out_1[cache: 0] = 
    Compute(
    main_Compute_14_in_1,
    main_Receiver_15_out_1,
    main_Receiver_13_out_1,
    main_Receiver_14_out_1
    ) [instance: 14, cache: 1];
    // 
    // node Transmitter[8]: x = 152, y = 320, inputs = 1, label = h_position
    // page group: h_pos
    //
h_position = main_Compute_14_out_1;
    // 
    // node Receiver[38]: x = 553, y = 144, inputs = 1, label = h_position
    // page group: vpos
    //
main_Receiver_38_out_1[cache: 0] = h_position;
    // 
    // node Compute[21]: x = 340, y = 428, inputs = 4, label = Compute: check if we've gone below the table
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$2 <= 10 ? ($0 < 0 ? -$0*$1 : $0) : $0"
    // page group: vpos
    // expression: value = h_pos <= 10 ? (v_pos < 0 ? -v_pos*bounciness : v_pos) : v_pos
    // name[2]: value = v_pos
    // name[3]: value = bounciness
    // name[4]: value = h_pos
    //
main_Compute_21_out_1[cache: 0] = 
    Compute(
    main_Compute_21_in_1,
    main_Compute_15_out_1,
    main_Receiver_37_out_1,
    main_Receiver_38_out_1
    ) [instance: 21, cache: 1];
    // 
    // node Transmitter[23]: x = 365, y = 529, inputs = 1, label = v_position
    // page group: vpos
    //
v_position = main_Compute_21_out_1;
    // 
    // node Receiver[2]: x = 313, y = 98, inputs = 1, label = v_position
    // page group: ball
    //
main_Receiver_2_out_1[cache: 0] = v_position;
    // 
    // node Receiver[10]: x = 394, y = 101, inputs = 1, label = h_position
    // page group: ball
    //
main_Receiver_10_out_1[cache: 0] = h_position;
    // 
    // node Transmitter[18]: x = 512, y = 507, inputs = 1, label = ball_size
    // page group: ball
    //
ball_size = main_Scalar_12_out_1;
    // 
    // node Receiver[23]: x = 483, y = 99, inputs = 1, label = ball_size
    // page group: ball
    //
main_Receiver_23_out_1[cache: 0] = ball_size;
    // 
    // node Compute[9]: x = 309, y = 328, inputs = 4, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "[$1+$2,$0+$2,0]"
    // page group: ball
    // expression: value = [hor+ball_size,vert+ball_size,0]
    // name[2]: value = vert
    // name[3]: value = hor
    // name[4]: value = ball_size
    //
main_Compute_9_out_1[cache: 0] = 
    Compute(
    main_Compute_9_in_1,
    main_Receiver_2_out_1,
    main_Receiver_10_out_1,
    main_Receiver_23_out_1
    ) [instance: 9, cache: 1];
    // 
    // node Translate[1]: x = 87, y = 425, inputs = 2, label = Translate
    // page group: ball
    //
main_Translate_1_out_1[cache: 0] = 
    Translate(
    main_Color_1_out_1,
    main_Compute_9_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[19]: x = 107, y = 524, inputs = 1, label = ball
    // page group: ball
    //
ball = main_Translate_1_out_1;
    // 
    // node Receiver[31]: x = 119, y = 107, inputs = 1, label = ball
    // page group: curr_image
    //
main_Receiver_31_out_1[cache: 0] = ball;
    // 
    // node Construct[2]: x = 122, y = 123, inputs = 4, label = Construct
    // input[1]: defaulting = 0, visible = 1, type = 16777224, value = {[-30 0 0]}
    // input[2]: defaulting = 0, visible = 1, type = 16777224, value = {[1 1 1]}
    // input[3]: defaulting = 0, visible = 1, type = 8, value = [41 1 1]
    // page group: table
    //
main_Construct_2_out_1[cache: 0] = 
    Construct(
    main_Construct_2_in_1,
    main_Construct_2_in_2,
    main_Construct_2_in_3,
    main_Construct_2_in_4
    ) [instance: 2, cache: 1];
    // 
    // node ShowConnections[1]: x = 115, y = 217, inputs = 1, label = ShowConnections
    // page group: table
    //
main_ShowConnections_1_out_1[cache: 0] = 
    ShowConnections(
    main_Construct_2_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Color[2]: x = 133, y = 310, inputs = 5, label = Color
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "white"
    // page group: table
    //
main_Color_2_out_1[cache: 0] = 
    Color(
    main_ShowConnections_1_out_1,
    main_Color_2_in_2,
    main_Color_2_in_3,
    main_Color_2_in_4,
    main_Color_2_in_5
    ) [instance: 2, cache: 1];
    // 
    // node Transmitter[20]: x = 142, y = 395, inputs = 1, label = table
    // page group: table
    //
table = main_Color_2_out_1;
    // 
    // node Receiver[32]: x = 180, y = 105, inputs = 1, label = table
    // page group: curr_image
    //
main_Receiver_32_out_1[cache: 0] = table;
    // 
    // node Collect[1]: x = 136, y = 211, inputs = 2, label = Collect
    // page group: curr_image
    //
main_Collect_1_out_1[cache: 0] = 
    Collect(
    main_Receiver_31_out_1,
    main_Receiver_32_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[25]: x = 149, y = 460, inputs = 1, label = vpos_wo_table
    // page group: vpos
    //
vpos_wo_table = main_Compute_15_out_1;
    // 
    // node Receiver[34]: x = 25, y = 135, inputs = 1, label = vpos_wo_table
    // page group: vvel_table
    //
main_Receiver_34_out_1[cache: 0] = vpos_wo_table;
    // 
    // node Receiver[35]: x = 147, y = 132, inputs = 1, label = v_velocity
    // page group: vvel_table
    //
main_Receiver_35_out_1[cache: 0] = v_velocity;
    // 
    // node Receiver[22]: x = 232, y = 132, inputs = 1, label = bounciness
    // page group: vvel_table
    //
main_Receiver_22_out_1[cache: 0] = bounciness;
    // 
    // node Receiver[25]: x = 350, y = 134, inputs = 1, label = h_position
    // page group: vvel_table
    //
main_Receiver_25_out_1[cache: 0] = h_position;
    // 
    // node Compute[19]: x = 110, y = 331, inputs = 5, label = Compute: modify the vertical velocity if we've passed below the table
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$3 <= 10 ? ($0 < 0 ? -$1*$2 : $1) : $1"
    // page group: vvel_table
    // expression: value = h_pos <= 10 ? (v_pos < 0 ? -v_vel*bounciness : v_vel) : v_vel
    // name[2]: value = v_pos
    // name[3]: value = v_vel
    // name[4]: value = bounciness
    // name[5]: value = h_pos
    //
main_Compute_19_out_1[cache: 0] = 
    Compute(
    main_Compute_19_in_1,
    main_Receiver_34_out_1,
    main_Receiver_35_out_1,
    main_Receiver_22_out_1,
    main_Receiver_25_out_1
    ) [instance: 19, cache: 1];
    // 
    // node Receiver[30]: x = 123, y = 98, inputs = 1, label = v_position
    // page group: done
    //
main_Receiver_30_out_1[cache: 0] = v_position;
    // 
    // node Compute[20]: x = 144, y = 175, inputs = 2, label = Compute
    // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 < -6 ? 1 : 0"
    // page group: done
    // expression: value = vert_position < -6 ? 1 : 0
    // name[2]: value = vert_position
    //
main_Compute_20_out_1[cache: 0] = 
    Compute(
    main_Compute_20_in_1,
    main_Receiver_30_out_1
    ) [instance: 20, cache: 1];
    // 
    // node Render[1]: x = 142, y = 302, inputs = 3, label = Render
    // page group: curr_image
    //
main_Render_1_out_1[cache: 0] = 
    Render(
    main_Collect_1_out_1,
    main_Camera_1_out_1,
    main_Render_1_in_3
    ) [instance: 1, cache: 1];
    // 
    // node Transmitter[21]: x = 135, y = 389, inputs = 1, label = current_image
    // page group: curr_image
    //
current_image = main_Render_1_out_1;
    // 
    // node Receiver[33]: x = 164, y = 131, inputs = 1, label = current_image
    // page group: matte
    //
main_Receiver_33_out_1[cache: 0] = current_image;
    // 
    // node GetLocal[6]: x = 321, y = 222, inputs = 3, label = GetLocal
    // page group: matte
    //
main_GetLocal_6_out_1[cache: 0],
main_GetLocal_6_out_2[cache: 0] = 
    GetLocal(
    main_Receiver_33_out_1,
    main_GetLocal_6_in_2,
    main_GetLocal_6_in_3
    ) [instance: 6, cache: 1];
    // 
    // node Matte[1]: x = 110, y = 270, inputs = 3, label = Matte
    // input[3]: defaulting = 0, visible = 1, type = 5, value = .93
    // page group: matte
    //
main_Matte_1_out_1[cache: 0] = 
    Matte(
    main_Receiver_33_out_1,
    main_GetLocal_6_out_1,
    main_Matte_1_in_3
    ) [instance: 1, cache: 1];
    // 
    // node Options[1]: x = 73, y = 385, inputs = 3, label = Options
    // input[2]: defaulting = 0, visible = 1, type = 32, value = "cache"
    // input[3]: defaulting = 0, visible = 1, type = 29, value = 0
    // page group: matte
    //
main_Options_1_out_1[cache: 0] = 
    Options(
    main_Matte_1_out_1,
    main_Options_1_in_2,
    main_Options_1_in_3
    ) [instance: 1, cache: 1];
    // 
    // node Display[1]: x = 121, y = 499, inputs = 4, label = Display
    // page group: matte
    // depth: value = 24
    // window: position = (0.7016,0.0283), size = 0.2453x0.2881
    //
main_Display_1_out_1[cache: 2] = 
    Display(
    main_Options_1_out_1,
    main_Display_1_in_2,
    main_Display_1_in_3,
    main_Display_1_in_4
    ) [instance: 1, cache: 1];
    // 
    // node Done[1]: x = 150, y = 274, inputs = 1, label = Done
    // page group: done
    //
    Done(
    main_Compute_20_out_1
    ) [instance: 1, cache: 1];
    // 
    // node Receiver[39]: x = 164, y = 386, inputs = 1, label = v_position
    // page group: vpos_state
    //
main_Receiver_39_out_1[cache: 0] = v_position;
    // 
    // node Transmitter[15]: x = 110, y = 458, inputs = 1, label = new_v_velocity
    // page group: vvel_table
    //
new_v_velocity = main_Compute_19_out_1;
    // 
    // node Receiver[40]: x = 34, y = 403, inputs = 1, label = new_v_velocity
    // page group: vvel_state
    //
main_Receiver_40_out_1[cache: 0] = new_v_velocity;
    // 
    // node SetLocal[6]: x = 321, y = 366, inputs = 3, label = SetLocal
    // page group: matte
    //
    SetLocal(
    main_Matte_1_out_1,
    main_GetLocal_6_out_2,
    main_SetLocal_6_in_3
    ) [instance: 6, cache: 1];
    // 
    // node SetLocal[7]: x = 235, y = 488, inputs = 3, label = SetLocal
    // page group: vpos_state
    //
    SetLocal(
    main_Receiver_39_out_1,
    main_GetLocal_7_out_2,
    main_SetLocal_7_in_3
    ) [instance: 7, cache: 1];
    // 
    // node SetLocal[8]: x = 151, y = 478, inputs = 3, label = SetLocal
    // page group: vvel_state
    //
    SetLocal(
    main_Receiver_40_out_1,
    main_GetLocal_8_out_2,
    main_SetLocal_8_in_3
    ) [instance: 8, cache: 1];
    // 
    // node SetLocal[9]: x = 166, y = 451, inputs = 3, label = SetLocal
    // page group: time
    //
    SetLocal(
    main_Compute_2_out_1,
    main_GetLocal_9_out_2,
    main_SetLocal_9_in_3
    ) [instance: 9, cache: 1];
    //
    // decorator Annotate	pos=(79,43) size=428x60 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 131
    // annotation user: This page computes the current horizontal position based
    // annotation user: on the time, the initial horizontal position, and the horizontal
    // annotation user: velocity.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: h_pos
    //
    // decorator Annotate	pos=(48,30) size=548x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 146
    // annotation user: This page sets the initial conditions for the bounce: initial horizontal position,
    // annotation user: horizontal velocity, initial vertical position, and bounciness.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: initial_cond
    //
    // decorator Annotate	pos=(99,14) size=467x60 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 158
    // annotation user: This page computes and stores the current time, and passes the
    // annotation user: current time out to other pages. GetLocal is initialized to 0 (time=0
    // annotation user: at the start of the loop)
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: time
    //
    // decorator Annotate	pos=(82,40) size=495x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 124
    // annotation user: This page creates the ball and translates it to the appropriate position
    // annotation user: using the current horizontal and vertical position.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: ball
    //
    // decorator Annotate	pos=(89,27) size=345x28 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 50
    // annotation user: This page draws the "table" for the visualization.
    // annotation user_end: <NULL>
    // page group: table
    //
    // decorator Annotate	pos=(37,34) size=440x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 106
    // annotation user: This page renders the ball and the table together to create the
    // annotation user: image of the current position of the ball.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: curr_image
    //
    // decorator Annotate	pos=(76,52) size=520x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 145
    // annotation user: This page mattes the current image with a faded image of the previous
    // annotation user: positions of the ball. The resulting matted image is stored using SetLocal.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: matte
    //
    // decorator Annotate	pos=(26,51) size=478x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 75
    // annotation user: This page modifies the current vertical velocity if the table has been
    // annotation user: hit.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: vvel_table
    //
    // decorator Annotate	pos=(75,28) size=351x28 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 50
    // annotation user: This page maintains the current vertical position.
    // annotation user_end: <NULL>
    // page group: vpos_state
    //
    // decorator Annotate	pos=(116,37) size=331x28 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 48
    // annotation user: This page maintains the vertical velocity state.
    // annotation user_end: <NULL>
    // page group: vvel_state
    //
    // decorator Annotate	pos=(29,26) size=349x28 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 49
    // annotation user: This page computes the current vertical velocity.
    // annotation user_end: <NULL>
    // page group: vvel
    //
    // decorator Annotate	pos=(24,26) size=513x44 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 105
    // annotation user: This page terminates the execution of the program if the vertical position
    // annotation user: is off the bottom of the page.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: done
    //
    // decorator Annotate	pos=(66,39) size=506x60 style(Label), font=bold, value = <NULL>
    // annotation user_begin: 211
    // annotation user: This page computes the current vertical position of the ball based on
    // annotation user: the last vertical position, the time that has passed, the current
    // annotation user: vertical velocity, the bounciness of the ball, and the horizontal position.
    // annotation user_end: <NULL>
    // resource *decorator.alignment:XmALIGNMENT_BEGINNING
    // page group: vpos
// network: end of macro body
}
main_Camera_1_in_1 = [0 12.5 0];
main_Camera_1_in_2 = [0 12.5 1];
main_Camera_1_in_3 = 50.0;
main_Camera_1_in_4 = 300;
main_Camera_1_in_5 = NULL;
main_Camera_1_in_6 = NULL;
main_Camera_1_in_7 = NULL;
main_Camera_1_in_8 = 60.0;
main_Camera_1_in_9 = "black";
main_Camera_1_out_1 = NULL;
main_Construct_3_in_1 = {[0 0 0]};
main_Construct_3_in_2 = NULL;
main_Construct_3_in_3 = NULL;
main_Construct_3_in_4 = {1.0};
main_Construct_3_out_1 = NULL;
main_Scalar_12_in_1 = "Scalar_12";
main_Scalar_12_in_2 = NULL;
main_Scalar_12_in_3 = 2.0 ;
main_Scalar_12_in_4 = NULL;
main_Scalar_12_in_5 = NULL;
main_Scalar_12_in_6 = NULL;
main_Scalar_12_in_7 = NULL;
main_Scalar_12_in_8 = NULL;
main_Scalar_12_in_9 = NULL;
main_Scalar_12_in_10 = NULL;
main_Scalar_12_in_11 = NULL;
main_Scalar_12_out_1 = 2.0 ;
main_Glyph_1_in_2 = .6;
main_Glyph_1_in_3 = NULL;
main_Glyph_1_in_5 = NULL;
main_Glyph_1_in_6 = NULL;
main_Glyph_1_in_7 = NULL;
main_Glyph_1_out_1 = NULL;
main_Color_1_in_2 = "red";
main_Color_1_in_3 = NULL;
main_Color_1_in_4 = NULL;
main_Color_1_in_5 = NULL;
main_Color_1_out_1 = NULL;
main_Scalar_10_in_1 = "Scalar_10";
main_Scalar_10_in_2 = NULL;
main_Scalar_10_in_3 = 22.0 ;
main_Scalar_10_in_4 = NULL;
main_Scalar_10_in_5 = NULL;
main_Scalar_10_in_6 = NULL;
main_Scalar_10_in_7 = NULL;
main_Scalar_10_in_8 = NULL;
main_Scalar_10_in_9 = NULL;
main_Scalar_10_in_10 = NULL;
main_Scalar_10_in_11 = NULL;
main_Scalar_10_out_1 = 22.0 ;
main_Transmitter_12_out_1 = NULL;
main_Receiver_16_out_1 = NULL;
main_GetLocal_7_in_2 = NULL;
main_GetLocal_7_in_3 = NULL;
main_GetLocal_7_out_1 = NULL;
main_GetLocal_7_out_2 = NULL;
main_Transmitter_13_out_1 = NULL;
main_Receiver_17_out_1 = NULL;
main_Scalar_1_in_1 = "Scalar_1";
main_Scalar_1_in_2 = NULL;
main_Scalar_1_in_3 = 0.25 ;
main_Scalar_1_in_4 = NULL;
main_Scalar_1_in_5 = NULL;
main_Scalar_1_in_6 = NULL;
main_Scalar_1_in_7 = NULL;
main_Scalar_1_in_8 = NULL;
main_Scalar_1_in_9 = NULL;
main_Scalar_1_in_10 = NULL;
main_Scalar_1_in_11 = NULL;
main_Scalar_1_out_1 = 0.25 ;
main_Transmitter_1_out_1 = NULL;
main_Receiver_19_out_1 = NULL;
main_GetLocal_8_in_1 = 0;
main_GetLocal_8_in_2 = NULL;
main_GetLocal_8_in_3 = NULL;
main_GetLocal_8_out_1 = NULL;
main_GetLocal_8_out_2 = NULL;
main_Transmitter_14_out_1 = NULL;
main_Receiver_20_out_1 = NULL;
main_Receiver_21_out_1 = NULL;
main_Compute_17_in_1 = "$0 + 9.8*$1";
main_Compute_17_out_1 = NULL;
main_Transmitter_16_out_1 = NULL;
main_Receiver_18_out_1 = NULL;
main_Compute_15_in_1 = "$0 - $1*$2";
main_Compute_15_out_1 = NULL;
main_Scalar_11_in_1 = "Scalar_11";
main_Scalar_11_in_2 = NULL;
main_Scalar_11_in_3 = 0.55 ;
main_Scalar_11_in_4 = NULL;
main_Scalar_11_in_5 = NULL;
main_Scalar_11_in_6 = NULL;
main_Scalar_11_in_7 = NULL;
main_Scalar_11_in_8 = NULL;
main_Scalar_11_in_9 = NULL;
main_Scalar_11_in_10 = NULL;
main_Scalar_11_in_11 = NULL;
main_Scalar_11_out_1 = 0.55 ;
main_Transmitter_17_out_1 = NULL;
main_Receiver_37_out_1 = NULL;
main_GetLocal_9_in_1 = 0;
main_GetLocal_9_in_2 = NULL;
main_GetLocal_9_in_3 = NULL;
main_GetLocal_9_out_1 = NULL;
main_GetLocal_9_out_2 = NULL;
main_Compute_2_in_1 = "$0 +$1";
main_Compute_2_out_1 = NULL;
main_Transmitter_2_out_1 = NULL;
main_Receiver_15_out_1 = NULL;
main_Scalar_8_in_1 = "Scalar_8";
main_Scalar_8_in_2 = NULL;
main_Scalar_8_in_3 = -15.0 ;
main_Scalar_8_in_4 = NULL;
main_Scalar_8_in_5 = NULL;
main_Scalar_8_in_6 = NULL;
main_Scalar_8_in_7 = NULL;
main_Scalar_8_in_8 = NULL;
main_Scalar_8_in_9 = NULL;
main_Scalar_8_in_10 = NULL;
main_Scalar_8_in_11 = NULL;
main_Scalar_8_out_1 = -15.0 ;
main_Transmitter_9_out_1 = NULL;
main_Receiver_13_out_1 = NULL;
main_Scalar_9_in_1 = "Scalar_9";
main_Scalar_9_in_2 = NULL;
main_Scalar_9_in_3 = 4.6 ;
main_Scalar_9_in_4 = NULL;
main_Scalar_9_in_5 = NULL;
main_Scalar_9_in_6 = NULL;
main_Scalar_9_in_7 = NULL;
main_Scalar_9_in_8 = NULL;
main_Scalar_9_in_9 = NULL;
main_Scalar_9_in_10 = NULL;
main_Scalar_9_in_11 = NULL;
main_Scalar_9_out_1 = 4.6 ;
main_Transmitter_10_out_1 = NULL;
main_Receiver_14_out_1 = NULL;
main_Compute_14_in_1 = "$1 + $2*$0";
main_Compute_14_out_1 = NULL;
main_Transmitter_8_out_1 = NULL;
main_Receiver_38_out_1 = NULL;
main_Compute_21_in_1 = "$2 <= 10 ? ($0 < 0 ? -$0*$1 : $0) : $0";
main_Compute_21_out_1 = NULL;
main_Transmitter_23_out_1 = NULL;
main_Receiver_2_out_1 = NULL;
main_Receiver_10_out_1 = NULL;
main_Transmitter_18_out_1 = NULL;
main_Receiver_23_out_1 = NULL;
main_Compute_9_in_1 = "[$1+$2,$0+$2,0]";
main_Compute_9_out_1 = NULL;
main_Translate_1_out_1 = NULL;
main_Transmitter_19_out_1 = NULL;
main_Receiver_31_out_1 = NULL;
main_Construct_2_in_1 = {[-30 0 0]};
main_Construct_2_in_2 = {[1 1 1]};
main_Construct_2_in_3 = [41 1 1];
main_Construct_2_in_4 = NULL;
main_Construct_2_out_1 = NULL;
main_ShowConnections_1_out_1 = NULL;
main_Color_2_in_2 = "white";
main_Color_2_in_3 = NULL;
main_Color_2_in_4 = NULL;
main_Color_2_in_5 = NULL;
main_Color_2_out_1 = NULL;
main_Transmitter_20_out_1 = NULL;
main_Receiver_32_out_1 = NULL;
main_Collect_1_out_1 = NULL;
main_Transmitter_25_out_1 = NULL;
main_Receiver_34_out_1 = NULL;
main_Receiver_35_out_1 = NULL;
main_Receiver_22_out_1 = NULL;
main_Receiver_25_out_1 = NULL;
main_Compute_19_in_1 = "$3 <= 10 ? ($0 < 0 ? -$1*$2 : $1) : $1";
main_Compute_19_out_1 = NULL;
main_Receiver_30_out_1 = NULL;
main_Compute_20_in_1 = "$0 < -6 ? 1 : 0";
main_Compute_20_out_1 = NULL;
main_Render_1_in_3 = NULL;
main_Render_1_out_1 = NULL;
main_Transmitter_21_out_1 = NULL;
main_Receiver_33_out_1 = NULL;
main_GetLocal_6_in_2 = NULL;
main_GetLocal_6_in_3 = NULL;
main_GetLocal_6_out_1 = NULL;
main_GetLocal_6_out_2 = NULL;
main_Matte_1_in_3 = .93;
main_Matte_1_out_1 = NULL;
main_Options_1_in_2 = "cache";
main_Options_1_in_3 = 0;
main_Options_1_out_1 = NULL;
main_Display_1_in_2 = NULL;
main_Display_1_in_3 = "X24,,";
main_Display_1_in_4 = NULL;
main_Receiver_39_out_1 = NULL;
main_Transmitter_15_out_1 = NULL;
main_Receiver_40_out_1 = NULL;
main_SetLocal_6_in_3 = NULL;
main_SetLocal_7_in_3 = NULL;
main_SetLocal_8_in_3 = NULL;
main_SetLocal_9_in_3 = NULL;
Executive("product version 3 1 4");
$sync
main();
