fb_force() - mkraska/meclib GitHub Wiki

[txt, isOK]: fb_force(o, name, point, dir, toldeg, toldist, description)

  • txt feedback text
  • isOK flag for test result
  • o list of objects
  • name expected object name, as a string, or a list of strings if several names would be equally acceptable (e.g. ["G","F_G"])
  • point a point the force's line of action must pass through
  • dir expected direction, either a number (angle in degrees, standard math convention: 0 = +x axis, 90 = +y axis) or a direction vector [dx, dy]
  • toldeg direction tolerance in degrees
  • toldist tolerance for the distance between the force's line of action and point, in the same length units as the sketch (a bare number for now - no unit tag, though this could later become a [tol, "mm"]-style list if a question ever needs one)
  • description string with text to identify the object for the user

Source

This function provides feedback on a single, freely placed "force" object (e.g. a weight force, or a resultant the student places via forceGen) in the framework of Feedback for Free Body Diagrams. Unlike Feedback for "contact" / fb_bar(), the force is not resolved through a contact/support index - it is matched directly against o by name, since it is not tied to any particular contact point.

Checks done by fb_force():

  • Is there exactly one force object in o that is active and whose name matches name (or one of the names in name, if a list was given)?
  • Does its direction match dir, within toldeg? On a mismatch, the feedback reports the actual deviation as a rounded degree value - the same way fb_unit() reports a numeric deviation as a rounded percentage.
  • Does its line of action pass through point, within toldist? On a mismatch, the feedback reports the actual perpendicular distance as a rounded value, the same way the direction deviation is reported.

Typical PRT

Feedback variables:

obj: stackjson_parse(objects);
[text, isOK]: fb_force(obj, "G", [xO, r], -90, 2, 0.05, "Gewichtskraft: ");

PRT node

Algebraic test for isOK = true and feedback of {@text@} for both branches.