-
Notifications
You must be signed in to change notification settings - Fork 4
fb_force()
mkraska edited this page Oct 4, 2026
·
2 revisions
-
txtfeedback text -
isOKflag for test result -
olist of objects -
nameexpected object name, as a string, or a list of strings if several names would be equally acceptable (e.g.["G","F_G"]) -
pointa point the force's line of action must pass through -
direxpected direction, either a number (angle in degrees, standard math convention: 0 = +x axis, 90 = +y axis) or a direction vector[dx, dy] -
toldegdirection tolerance in degrees -
toldisttolerance for the distance between the force's line of action andpoint, 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) -
descriptionstring with text to identify the object for the user
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
forceobject inothat isactiveand whose name matchesname(or one of the names inname, if a list was given)? - Does its direction match
dir, withintoldeg? On a mismatch, the feedback reports the actual deviation as a rounded degree value - the same wayfb_unit()reports a numeric deviation as a rounded percentage. - Does its line of action pass through
point, withintoldist? On a mismatch, the feedback reports the actual perpendicular distance as a rounded value, the same way the direction deviation is reported.
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.
In order to try code snippets in jsfiddle,
- copy the code from the wiki page to the clipboard
- follow the link for the JSXGraph version you want to try
- 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)