Ball Reflection in Rectangle (Trajectory)

Ball Reflection in Rectangle (Trajectory)
Loading the math board and drawing, please wait…
2012-04-13 06:06
This example demonstrates the trajectory of a ball reflecting within a rectangle, simulating a billiard game without holes. It involves key mathematical concepts like reflection laws, vectors, coordinate geometry, and geometric constructions. The construction utilizes GeoGebra commands and objects such as Intersect, Vector, Segment, Ray, If, and Element. Suitable for high school and above students to understand trajectory generation and geometric transformations.

GeoGebra Commands & Parameters

  1. Intersect(xAxis, yAxis) → A
  2. Vector(E, F) → dir
  3. Segment(B, C) → st
  4. Segment(C, D) → sr
  5. Segment(A, D) → sb
  6. Segment(A, B) → sl
  7. Ray(E, dir) → A2
  8. Intersect(A2, st) → B2
  9. Intersect(A2, sr) → C2
  10. Intersect(A2, sb) → D2
  11. Intersect(A2, sl) → E2
  12. If(Defined[B2] ∨ Defined[D2], (1, -1), (-1, 1)) → F2
  13. Element(RemoveUndefined[{B2, C2, D2, E2}], 1) → G2
  14. Ray(G2, Vector[H2]) → A3
  15. If(Intersect[A3, st] ≠ B2, Intersect[A3, st], (NaN, NaN)) → B3
  16. If(Intersect[A3, sr] ≠ C2, Intersect[A3, sr], (NaN, NaN)) → C3
  17. If(Intersect[A3, sb] ≠ D2, Intersect[A3, sb], (NaN, NaN)) → D3
  18. If(Intersect[A3, sl] ≠ E2, Intersect[A3, sl], (NaN, NaN)) → E3
  19. If(Defined[B3] ∨ Defined[D3], (1, -1), (-1, 1)) → F3
  20. Element(RemoveUndefined[{B3, C3, D3, E3}], 1) → G3
  21. Ray(G3, Vector[H3]) → A4
  22. If(Intersect[A4, st] ≠ B3, Intersect[A4, st], (NaN, NaN)) → B4
  23. If(Intersect[A4, sr] ≠ C3, Intersect[A4, sr], (NaN, NaN)) → C4
  24. If(Intersect[A4, sb] ≠ D3, Intersect[A4, sb], (NaN, NaN)) → D4
  25. If(Intersect[A4, sl] ≠ E3, Intersect[A4, sl], (NaN, NaN)) → E4
  26. If(Defined[B4] ∨ Defined[D4], (1, -1), (-1, 1)) → F4
  27. Element(RemoveUndefined[{B4, C4, D4, E4}], 1) → G4
  28. Ray(G4, Vector[H4]) → A5
  29. If(Intersect[A5, st] ≠ B4, Intersect[A5, st], (NaN, NaN)) → B5
  30. If(Intersect[A5, sr] ≠ C4, Intersect[A5, sr], (NaN, NaN)) → C5
  31. If(Intersect[A5, sb] ≠ D4, Intersect[A5, sb], (NaN, NaN)) → D5
  32. If(Intersect[A5, sl] ≠ E4, Intersect[A5, sl], (NaN, NaN)) → E5
  33. If(Defined[B5] ∨ Defined[D5], (1, -1), (-1, 1)) → F5
  34. Element(RemoveUndefined[{B5, C5, D5, E5}], 1) → G5
  35. Ray(G5, Vector[H5]) → A6
  36. If(Intersect[A6, st] ≠ B5, Intersect[A6, st], (NaN, NaN)) → B6
  37. If(Intersect[A6, sr] ≠ C5, Intersect[A6, sr], (NaN, NaN)) → C6
  38. If(Intersect[A6, sb] ≠ D5, Intersect[A6, sb], (NaN, NaN)) → D6
  39. If(Intersect[A6, sl] ≠ E5, Intersect[A6, sl], (NaN, NaN)) → E6
  40. If(Defined[B6] ∨ Defined[D6], (1, -1), (-1, 1)) → F6
  41. Element(RemoveUndefined[{B6, C6, D6, E6}], 1) → G6
  42. Ray(G6, Vector[H6]) → A7
  43. If(Intersect[A7, st] ≠ B6, Intersect[A7, st], (NaN, NaN)) → B7
  44. If(Intersect[A7, sr] ≠ C6, Intersect[A7, sr], (NaN, NaN)) → C7
  45. If(Intersect[A7, sb] ≠ D6, Intersect[A7, sb], (NaN, NaN)) → D7
  46. If(Intersect[A7, sl] ≠ E6, Intersect[A7, sl], (NaN, NaN)) → E7
  47. If(Defined[B7] ∨ Defined[D7], (1, -1), (-1, 1)) → F7
  48. Element(RemoveUndefined[{B7, C7, D7, E7}], 1) → G7
  49. Ray(G7, Vector[H7]) → A8
  50. If(Intersect[A8, st] ≠ B7, Intersect[A8, st], (NaN, NaN)) → B8
  51. If(Intersect[A8, sr] ≠ C7, Intersect[A8, sr], (NaN, NaN)) → C8
  52. If(Intersect[A8, sb] ≠ D7, Intersect[A8, sb], (NaN, NaN)) → D8
  53. If(Intersect[A8, sl] ≠ E7, Intersect[A8, sl], (NaN, NaN)) → E8
  54. If(Defined[B8] ∨ Defined[D8], (1, -1), (-1, 1)) → F8
  55. Element(RemoveUndefined[{B8, C8, D8, E8}], 1) → G8
  56. Ray(G8, Vector[H8]) → A9
  57. If(Intersect[A9, st] ≠ B8, Intersect[A9, st], (NaN, NaN)) → B9
  58. If(Intersect[A9, sr] ≠ C8, Intersect[A9, sr], (NaN, NaN)) → C9
  59. If(Intersect[A9, sb] ≠ D8, Intersect[A9, sb], (NaN, NaN)) → D9
  60. If(Intersect[A9, sl] ≠ E8, Intersect[A9, sl], (NaN, NaN)) → E9
  61. If(Defined[B9] ∨ Defined[D9], (1, -1), (-1, 1)) → F9
  62. Element(RemoveUndefined[{B9, C9, D9, E9}], 1) → G9
  63. Ray(G9, Vector[H9]) → A10
  64. If(Intersect[A10, st] ≠ B9, Intersect[A10, st], (NaN, NaN)) → B10
  65. If(Intersect[A10, sr] ≠ C9, Intersect[A10, sr], (NaN, NaN)) → C10
  66. If(Intersect[A10, sb] ≠ D9, Intersect[A10, sb], (NaN, NaN)) → D10
  67. If(Intersect[A10, sl] ≠ E9, Intersect[A10, sl], (NaN, NaN)) → E10
  68. If(Defined[B10] ∨ Defined[D10], (1, -1), (-1, 1)) → F10
  69. Element(RemoveUndefined[{B10, C10, D10, E10}], 1) → G10
  70. Ray(G10, Vector[H10]) → A11
  71. If(Intersect[A11, st] ≠ B10, Intersect[A11, st], (NaN, NaN)) → B11
  72. If(Intersect[A11, sr] ≠ C10, Intersect[A11, sr], (NaN, NaN)) → C11
  73. If(Intersect[A11, sb] ≠ D10, Intersect[A11, sb], (NaN, NaN)) → D11
  74. If(Intersect[A11, sl] ≠ E10, Intersect[A11, sl], (NaN, NaN)) → E11
  75. If(Defined[B11] ∨ Defined[D11], (1, -1), (-1, 1)) → F11
  76. Element(RemoveUndefined[{B11, C11, D11, E11}], 1) → G11
  77. Ray(G11, Vector[H11]) → A12
  78. If(Intersect[A12, st] ≠ B11, Intersect[A12, st], (NaN, NaN)) → B12
  79. If(Intersect[A12, sr] ≠ C11, Intersect[A12, sr], (NaN, NaN)) → C12
  80. If(Intersect[A12, sb] ≠ D11, Intersect[A12, sb], (NaN, NaN)) → D12
  81. If(Intersect[A12, sl] ≠ E11, Intersect[A12, sl], (NaN, NaN)) → E12
  82. If(Defined[B12] ∨ Defined[D12], (1, -1), (-1, 1)) → F12
  83. Element(RemoveUndefined[{B12, C12, D12, E12}], 1) → G12
  84. Ray(G12, Vector[H12]) → A13
  85. If(Intersect[A13, st] ≠ B12, Intersect[A13, st], (NaN, NaN)) → B13
  86. If(Intersect[A13, sr] ≠ C12, Intersect[A13, sr], (NaN, NaN)) → C13
  87. If(Intersect[A13, sb] ≠ D12, Intersect[A13, sb], (NaN, NaN)) → D13
  88. If(Intersect[A13, sl] ≠ E12, Intersect[A13, sl], (NaN, NaN)) → E13
  89. If(Defined[B13] ∨ Defined[D13], (1, -1), (-1, 1)) → F13
  90. Element(RemoveUndefined[{B13, C13, D13, E13}], 1) → G13
  91. If(colno ≥ J2, Segment[F, G2]) → I2
  92. If(colno ≥ J2, Segment[G2, G3]) → I3
  93. If(colno ≥ J3, Segment[G3, G4]) → I4
  94. If(colno ≥ J4, Segment[G4, G5]) → I5
  95. If(colno ≥ J5, Segment[G5, G6]) → I6
  96. If(colno ≥ J6, Segment[G6, G7]) → I7
  97. If(colno ≥ J7, Segment[G7, G8]) → I8
  98. If(colno ≥ J8, Segment[G8, G9]) → I9
  99. If(colno ≥ J9, Segment[G9, G10]) → I10
  100. If(colno ≥ J10, Segment[G10, G11]) → I11
  101. If(colno ≥ J11, Segment[G11, G12]) → I12
  102. If(colno ≥ J12, Segment[G12, G13]) → I13
  103. Ray(G13, Vector[H13]) → A14
  104. If(Intersect[A14, st] ≠ B13, Intersect[A14, st], (NaN, NaN)) → B14
  105. If(Intersect[A14, sr] ≠ C13, Intersect[A14, sr], (NaN, NaN)) → C14
  106. If(Intersect[A14, sb] ≠ D13, Intersect[A14, sb], (NaN, NaN)) → D14
  107. If(Intersect[A14, sl] ≠ E13, Intersect[A14, sl], (NaN, NaN)) → E14
  108. If(Defined[B14] ∨ Defined[D14], (1, -1), (-1, 1)) → F14
  109. Element(RemoveUndefined[{B14, C14, D14, E14}], 1) → G14
  110. If(colno ≥ J13, Segment[G13, G14]) → I14
  111. Ray(G14, Vector[H14]) → A15
  112. If(Intersect[A15, st] ≠ B14, Intersect[A15, st], (NaN, NaN)) → B15
  113. If(Intersect[A15, sr] ≠ C14, Intersect[A15, sr], (NaN, NaN)) → C15
  114. If(Intersect[A15, sb] ≠ D14, Intersect[A15, sb], (NaN, NaN)) → D15
  115. If(Intersect[A15, sl] ≠ E14, Intersect[A15, sl], (NaN, NaN)) → E15
  116. If(Defined[B15] ∨ Defined[D15], (1, -1), (-1, 1)) → F15
  117. Element(RemoveUndefined[{B15, C15, D15, E15}], 1) → G15
  118. If(colno ≥ J14, Segment[G14, G15]) → I15
  119. Ray(G15, Vector[H15]) → A16
  120. If(Intersect[A16, st] ≠ B15, Intersect[A16, st], (NaN, NaN)) → B16
  121. If(Intersect[A16, sr] ≠ C15, Intersect[A16, sr], (NaN, NaN)) → C16
  122. If(Intersect[A16, sb] ≠ D15, Intersect[A16, sb], (NaN, NaN)) → D16
  123. If(Intersect[A16, sl] ≠ E15, Intersect[A16, sl], (NaN, NaN)) → E16
  124. If(Defined[B16] ∨ Defined[D16], (1, -1), (-1, 1)) → F16
  125. Element(RemoveUndefined[{B16, C16, D16, E16}], 1) → G16
  126. If(colno ≥ J15, Segment[G15, G16]) → I16
  127. Ray(G16, Vector[H16]) → A17
  128. If(Intersect[A17, st] ≠ B16, Intersect[A17, st], (NaN, NaN)) → B17
  129. If(Intersect[A17, sr] ≠ C16, Intersect[A17, sr], (NaN, NaN)) → C17
  130. If(Intersect[A17, sb] ≠ D16, Intersect[A17, sb], (NaN, NaN)) → D17
  131. If(Intersect[A17, sl] ≠ E16, Intersect[A17, sl], (NaN, NaN)) → E17
  132. If(Defined[B17] ∨ Defined[D17], (1, -1), (-1, 1)) → F17
  133. Element(RemoveUndefined[{B17, C17, D17, E17}], 1) → G17
  134. If(colno ≥ J16, Segment[G16, G17]) → I17
  135. Ray(G17, Vector[H17]) → A18
  136. If(Intersect[A18, st] ≠ B17, Intersect[A18, st], (NaN, NaN)) → B18
  137. If(Intersect[A18, sr] ≠ C17, Intersect[A18, sr], (NaN, NaN)) → C18
  138. If(Intersect[A18, sb] ≠ D17, Intersect[A18, sb], (NaN, NaN)) → D18
  139. If(Intersect[A18, sl] ≠ E17, Intersect[A18, sl], (NaN, NaN)) → E18
  140. If(Defined[B18] ∨ Defined[D18], (1, -1), (-1, 1)) → F18
  141. Element(RemoveUndefined[{B18, C18, D18, E18}], 1) → G18
  142. If(colno ≥ J17, Segment[G17, G18]) → I18
  143. Ray(G18, Vector[H18]) → A19
  144. If(Intersect[A19, st] ≠ B18, Intersect[A19, st], (NaN, NaN)) → B19
  145. If(Intersect[A19, sr] ≠ C18, Intersect[A19, sr], (NaN, NaN)) → C19
  146. If(Intersect[A19, sb] ≠ D18, Intersect[A19, sb], (NaN, NaN)) → D19
  147. If(Intersect[A19, sl] ≠ E18, Intersect[A19, sl], (NaN, NaN)) → E19
  148. If(Defined[B19] ∨ Defined[D19], (1, -1), (-1, 1)) → F19
  149. Element(RemoveUndefined[{B19, C19, D19, E19}], 1) → G19
  150. If(colno ≥ J18, Segment[G18, G19]) → I19
  151. Ray(G19, Vector[H19]) → A20
  152. If(Intersect[A20, st] ≠ B19, Intersect[A20, st], (NaN, NaN)) → B20
  153. If(Intersect[A20, sr] ≠ C19, Intersect[A20, sr], (NaN, NaN)) → C20
  154. If(Intersect[A20, sb] ≠ D19, Intersect[A20, sb], (NaN, NaN)) → D20
  155. If(Intersect[A20, sl] ≠ E19, Intersect[A20, sl], (NaN, NaN)) → E20
  156. If(Defined[B20] ∨ Defined[D20], (1, -1), (-1, 1)) → F20
  157. Element(RemoveUndefined[{B20, C20, D20, E20}], 1) → G20
  158. If(colno ≥ J19, Segment[G19, G20]) → I20
  159. Ray(G20, Vector[H20]) → A21
  160. If(Intersect[A21, st] ≠ B20, Intersect[A21, st], (NaN, NaN)) → B21
  161. If(Intersect[A21, sr] ≠ C20, Intersect[A21, sr], (NaN, NaN)) → C21
  162. If(Intersect[A21, sb] ≠ D20, Intersect[A21, sb], (NaN, NaN)) → D21
  163. If(Intersect[A21, sl] ≠ E20, Intersect[A21, sl], (NaN, NaN)) → E21
  164. If(Defined[B21] ∨ Defined[D21], (1, -1), (-1, 1)) → F21
  165. Element(RemoveUndefined[{B21, C21, D21, E21}], 1) → G21
  166. If(colno ≥ J20, Segment[G20, G21]) → I21