Feedback for "dir" - mkraska/meclib GitHub Wiki

contributor(o, n, i_dir, tol)

  • o, n contents of the parsed objects field and of the names field
  • i_dir index of the dir object (or any other object suited for direction())
  • tol coefficient tolerance (same footing as the tolerance passed to fb_coeffs)

This function lists the names of every force that will actually contribute a non-negligible term when the forces in o are summed along direction(o[i_dir]) via sum_dir. Typically, an interactive version of "dir" is used to let the student specify that direction.

The main purpose is formative feedback to support a smart choice for the direction of summation (as few as possible unknowns per equation).

Note: The perpendicularity check does not use perpendicularp(), which compares raw (non-normalized) direction vectors and is not comparable across forces of different arrow length — contributor() instead recomputes the same normalized projection sum_dir itself uses.

fb_dir(o, n, i_dir, tol, desc)

Wraps contributor() into the usual [text, flag] shape. flag is always true — this is formative only, with no grading effect. desc is a phrase like "in 1-Richtung", appended at the end of the sentence, kept language/direction-agnostic.

Usage (Feedback variables)

obj: stackjson_parse(objects);
[text, ok]: fb_dir(obj, names, i_dir1, 0.05, "in 1-Richtung");```