Ball Reflection in Rectangle (Trajectory)
Loading the math board and drawing, please wait…
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
Intersect(xAxis, yAxis) → AVector(E, F) → dirSegment(B, C) → stSegment(C, D) → srSegment(A, D) → sbSegment(A, B) → slRay(E, dir) → A2Intersect(A2, st) → B2Intersect(A2, sr) → C2Intersect(A2, sb) → D2Intersect(A2, sl) → E2If(Defined[B2] ∨ Defined[D2], (1, -1), (-1, 1)) → F2Element(RemoveUndefined[{B2, C2, D2, E2}], 1) → G2Ray(G2, Vector[H2]) → A3If(Intersect[A3, st] ≠ B2, Intersect[A3, st], (NaN, NaN)) → B3If(Intersect[A3, sr] ≠ C2, Intersect[A3, sr], (NaN, NaN)) → C3If(Intersect[A3, sb] ≠ D2, Intersect[A3, sb], (NaN, NaN)) → D3If(Intersect[A3, sl] ≠ E2, Intersect[A3, sl], (NaN, NaN)) → E3If(Defined[B3] ∨ Defined[D3], (1, -1), (-1, 1)) → F3Element(RemoveUndefined[{B3, C3, D3, E3}], 1) → G3Ray(G3, Vector[H3]) → A4If(Intersect[A4, st] ≠ B3, Intersect[A4, st], (NaN, NaN)) → B4If(Intersect[A4, sr] ≠ C3, Intersect[A4, sr], (NaN, NaN)) → C4If(Intersect[A4, sb] ≠ D3, Intersect[A4, sb], (NaN, NaN)) → D4If(Intersect[A4, sl] ≠ E3, Intersect[A4, sl], (NaN, NaN)) → E4If(Defined[B4] ∨ Defined[D4], (1, -1), (-1, 1)) → F4Element(RemoveUndefined[{B4, C4, D4, E4}], 1) → G4Ray(G4, Vector[H4]) → A5If(Intersect[A5, st] ≠ B4, Intersect[A5, st], (NaN, NaN)) → B5If(Intersect[A5, sr] ≠ C4, Intersect[A5, sr], (NaN, NaN)) → C5If(Intersect[A5, sb] ≠ D4, Intersect[A5, sb], (NaN, NaN)) → D5If(Intersect[A5, sl] ≠ E4, Intersect[A5, sl], (NaN, NaN)) → E5If(Defined[B5] ∨ Defined[D5], (1, -1), (-1, 1)) → F5Element(RemoveUndefined[{B5, C5, D5, E5}], 1) → G5Ray(G5, Vector[H5]) → A6If(Intersect[A6, st] ≠ B5, Intersect[A6, st], (NaN, NaN)) → B6If(Intersect[A6, sr] ≠ C5, Intersect[A6, sr], (NaN, NaN)) → C6If(Intersect[A6, sb] ≠ D5, Intersect[A6, sb], (NaN, NaN)) → D6If(Intersect[A6, sl] ≠ E5, Intersect[A6, sl], (NaN, NaN)) → E6If(Defined[B6] ∨ Defined[D6], (1, -1), (-1, 1)) → F6Element(RemoveUndefined[{B6, C6, D6, E6}], 1) → G6Ray(G6, Vector[H6]) → A7If(Intersect[A7, st] ≠ B6, Intersect[A7, st], (NaN, NaN)) → B7If(Intersect[A7, sr] ≠ C6, Intersect[A7, sr], (NaN, NaN)) → C7If(Intersect[A7, sb] ≠ D6, Intersect[A7, sb], (NaN, NaN)) → D7If(Intersect[A7, sl] ≠ E6, Intersect[A7, sl], (NaN, NaN)) → E7If(Defined[B7] ∨ Defined[D7], (1, -1), (-1, 1)) → F7Element(RemoveUndefined[{B7, C7, D7, E7}], 1) → G7Ray(G7, Vector[H7]) → A8If(Intersect[A8, st] ≠ B7, Intersect[A8, st], (NaN, NaN)) → B8If(Intersect[A8, sr] ≠ C7, Intersect[A8, sr], (NaN, NaN)) → C8If(Intersect[A8, sb] ≠ D7, Intersect[A8, sb], (NaN, NaN)) → D8If(Intersect[A8, sl] ≠ E7, Intersect[A8, sl], (NaN, NaN)) → E8If(Defined[B8] ∨ Defined[D8], (1, -1), (-1, 1)) → F8Element(RemoveUndefined[{B8, C8, D8, E8}], 1) → G8Ray(G8, Vector[H8]) → A9If(Intersect[A9, st] ≠ B8, Intersect[A9, st], (NaN, NaN)) → B9If(Intersect[A9, sr] ≠ C8, Intersect[A9, sr], (NaN, NaN)) → C9If(Intersect[A9, sb] ≠ D8, Intersect[A9, sb], (NaN, NaN)) → D9If(Intersect[A9, sl] ≠ E8, Intersect[A9, sl], (NaN, NaN)) → E9If(Defined[B9] ∨ Defined[D9], (1, -1), (-1, 1)) → F9Element(RemoveUndefined[{B9, C9, D9, E9}], 1) → G9Ray(G9, Vector[H9]) → A10If(Intersect[A10, st] ≠ B9, Intersect[A10, st], (NaN, NaN)) → B10If(Intersect[A10, sr] ≠ C9, Intersect[A10, sr], (NaN, NaN)) → C10If(Intersect[A10, sb] ≠ D9, Intersect[A10, sb], (NaN, NaN)) → D10If(Intersect[A10, sl] ≠ E9, Intersect[A10, sl], (NaN, NaN)) → E10If(Defined[B10] ∨ Defined[D10], (1, -1), (-1, 1)) → F10Element(RemoveUndefined[{B10, C10, D10, E10}], 1) → G10Ray(G10, Vector[H10]) → A11If(Intersect[A11, st] ≠ B10, Intersect[A11, st], (NaN, NaN)) → B11If(Intersect[A11, sr] ≠ C10, Intersect[A11, sr], (NaN, NaN)) → C11If(Intersect[A11, sb] ≠ D10, Intersect[A11, sb], (NaN, NaN)) → D11If(Intersect[A11, sl] ≠ E10, Intersect[A11, sl], (NaN, NaN)) → E11If(Defined[B11] ∨ Defined[D11], (1, -1), (-1, 1)) → F11Element(RemoveUndefined[{B11, C11, D11, E11}], 1) → G11Ray(G11, Vector[H11]) → A12If(Intersect[A12, st] ≠ B11, Intersect[A12, st], (NaN, NaN)) → B12If(Intersect[A12, sr] ≠ C11, Intersect[A12, sr], (NaN, NaN)) → C12If(Intersect[A12, sb] ≠ D11, Intersect[A12, sb], (NaN, NaN)) → D12If(Intersect[A12, sl] ≠ E11, Intersect[A12, sl], (NaN, NaN)) → E12If(Defined[B12] ∨ Defined[D12], (1, -1), (-1, 1)) → F12Element(RemoveUndefined[{B12, C12, D12, E12}], 1) → G12Ray(G12, Vector[H12]) → A13If(Intersect[A13, st] ≠ B12, Intersect[A13, st], (NaN, NaN)) → B13If(Intersect[A13, sr] ≠ C12, Intersect[A13, sr], (NaN, NaN)) → C13If(Intersect[A13, sb] ≠ D12, Intersect[A13, sb], (NaN, NaN)) → D13If(Intersect[A13, sl] ≠ E12, Intersect[A13, sl], (NaN, NaN)) → E13If(Defined[B13] ∨ Defined[D13], (1, -1), (-1, 1)) → F13Element(RemoveUndefined[{B13, C13, D13, E13}], 1) → G13If(colno ≥ J2, Segment[F, G2]) → I2If(colno ≥ J2, Segment[G2, G3]) → I3If(colno ≥ J3, Segment[G3, G4]) → I4If(colno ≥ J4, Segment[G4, G5]) → I5If(colno ≥ J5, Segment[G5, G6]) → I6If(colno ≥ J6, Segment[G6, G7]) → I7If(colno ≥ J7, Segment[G7, G8]) → I8If(colno ≥ J8, Segment[G8, G9]) → I9If(colno ≥ J9, Segment[G9, G10]) → I10If(colno ≥ J10, Segment[G10, G11]) → I11If(colno ≥ J11, Segment[G11, G12]) → I12If(colno ≥ J12, Segment[G12, G13]) → I13Ray(G13, Vector[H13]) → A14If(Intersect[A14, st] ≠ B13, Intersect[A14, st], (NaN, NaN)) → B14If(Intersect[A14, sr] ≠ C13, Intersect[A14, sr], (NaN, NaN)) → C14If(Intersect[A14, sb] ≠ D13, Intersect[A14, sb], (NaN, NaN)) → D14If(Intersect[A14, sl] ≠ E13, Intersect[A14, sl], (NaN, NaN)) → E14If(Defined[B14] ∨ Defined[D14], (1, -1), (-1, 1)) → F14Element(RemoveUndefined[{B14, C14, D14, E14}], 1) → G14If(colno ≥ J13, Segment[G13, G14]) → I14Ray(G14, Vector[H14]) → A15If(Intersect[A15, st] ≠ B14, Intersect[A15, st], (NaN, NaN)) → B15If(Intersect[A15, sr] ≠ C14, Intersect[A15, sr], (NaN, NaN)) → C15If(Intersect[A15, sb] ≠ D14, Intersect[A15, sb], (NaN, NaN)) → D15If(Intersect[A15, sl] ≠ E14, Intersect[A15, sl], (NaN, NaN)) → E15If(Defined[B15] ∨ Defined[D15], (1, -1), (-1, 1)) → F15Element(RemoveUndefined[{B15, C15, D15, E15}], 1) → G15If(colno ≥ J14, Segment[G14, G15]) → I15Ray(G15, Vector[H15]) → A16If(Intersect[A16, st] ≠ B15, Intersect[A16, st], (NaN, NaN)) → B16If(Intersect[A16, sr] ≠ C15, Intersect[A16, sr], (NaN, NaN)) → C16If(Intersect[A16, sb] ≠ D15, Intersect[A16, sb], (NaN, NaN)) → D16If(Intersect[A16, sl] ≠ E15, Intersect[A16, sl], (NaN, NaN)) → E16If(Defined[B16] ∨ Defined[D16], (1, -1), (-1, 1)) → F16Element(RemoveUndefined[{B16, C16, D16, E16}], 1) → G16If(colno ≥ J15, Segment[G15, G16]) → I16Ray(G16, Vector[H16]) → A17If(Intersect[A17, st] ≠ B16, Intersect[A17, st], (NaN, NaN)) → B17If(Intersect[A17, sr] ≠ C16, Intersect[A17, sr], (NaN, NaN)) → C17If(Intersect[A17, sb] ≠ D16, Intersect[A17, sb], (NaN, NaN)) → D17If(Intersect[A17, sl] ≠ E16, Intersect[A17, sl], (NaN, NaN)) → E17If(Defined[B17] ∨ Defined[D17], (1, -1), (-1, 1)) → F17Element(RemoveUndefined[{B17, C17, D17, E17}], 1) → G17If(colno ≥ J16, Segment[G16, G17]) → I17Ray(G17, Vector[H17]) → A18If(Intersect[A18, st] ≠ B17, Intersect[A18, st], (NaN, NaN)) → B18If(Intersect[A18, sr] ≠ C17, Intersect[A18, sr], (NaN, NaN)) → C18If(Intersect[A18, sb] ≠ D17, Intersect[A18, sb], (NaN, NaN)) → D18If(Intersect[A18, sl] ≠ E17, Intersect[A18, sl], (NaN, NaN)) → E18If(Defined[B18] ∨ Defined[D18], (1, -1), (-1, 1)) → F18Element(RemoveUndefined[{B18, C18, D18, E18}], 1) → G18If(colno ≥ J17, Segment[G17, G18]) → I18Ray(G18, Vector[H18]) → A19If(Intersect[A19, st] ≠ B18, Intersect[A19, st], (NaN, NaN)) → B19If(Intersect[A19, sr] ≠ C18, Intersect[A19, sr], (NaN, NaN)) → C19If(Intersect[A19, sb] ≠ D18, Intersect[A19, sb], (NaN, NaN)) → D19If(Intersect[A19, sl] ≠ E18, Intersect[A19, sl], (NaN, NaN)) → E19If(Defined[B19] ∨ Defined[D19], (1, -1), (-1, 1)) → F19Element(RemoveUndefined[{B19, C19, D19, E19}], 1) → G19If(colno ≥ J18, Segment[G18, G19]) → I19Ray(G19, Vector[H19]) → A20If(Intersect[A20, st] ≠ B19, Intersect[A20, st], (NaN, NaN)) → B20If(Intersect[A20, sr] ≠ C19, Intersect[A20, sr], (NaN, NaN)) → C20If(Intersect[A20, sb] ≠ D19, Intersect[A20, sb], (NaN, NaN)) → D20If(Intersect[A20, sl] ≠ E19, Intersect[A20, sl], (NaN, NaN)) → E20If(Defined[B20] ∨ Defined[D20], (1, -1), (-1, 1)) → F20Element(RemoveUndefined[{B20, C20, D20, E20}], 1) → G20If(colno ≥ J19, Segment[G19, G20]) → I20Ray(G20, Vector[H20]) → A21If(Intersect[A21, st] ≠ B20, Intersect[A21, st], (NaN, NaN)) → B21If(Intersect[A21, sr] ≠ C20, Intersect[A21, sr], (NaN, NaN)) → C21If(Intersect[A21, sb] ≠ D20, Intersect[A21, sb], (NaN, NaN)) → D21If(Intersect[A21, sl] ≠ E20, Intersect[A21, sl], (NaN, NaN)) → E21If(Defined[B21] ∨ Defined[D21], (1, -1), (-1, 1)) → F21Element(RemoveUndefined[{B21, C21, D21, E21}], 1) → G21If(colno ≥ J20, Segment[G20, G21]) → I21