Skip to content

Feedback for "dir"

mkraska edited this page Sep 29, 2026 · 3 revisions

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");```

Tryout Space

In order to try code snippets in jsfiddle,

  1. copy the code from the wiki page to the clipboard
  2. follow the link for the JSXGraph version you want to try
  3. Replace the code in the HTML section (contents of <p id="init">) with the content of the clipboard

The remaining jsfiddle pages don't seem to work any more (as of 04/26)

Clone this wiki locally