// Numbas version: exam_results_page_options {"name": "Trigonometry Q2 Right angled triangle", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Trigonometry Q2 Right angled triangle", "tags": [], "metadata": {"description": "

Draws a right angled triangle based on 2 lengths.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Referring to the triangle below.

", "advice": "

Use pythagoras theorem to find the answer.

", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"min_angle": {"name": "min_angle", "group": "Ungrouped variables", "definition": "29\n\n", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "precround(sqrt(b^2-a^2),2)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(b_min..b_max)", "description": "", "templateType": "anything"}, "max_angle": {"name": "max_angle", "group": "Ungrouped variables", "definition": "61", "description": "", "templateType": "anything"}, "b_min": {"name": "b_min", "group": "Ungrouped variables", "definition": "floor(a/(cos(radians(min_angle))))", "description": "", "templateType": "anything"}, "b_max": {"name": "b_max", "group": "Ungrouped variables", "definition": "ceil(a/(cos(radians(max_angle))))", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(7..50)", "description": "", "templateType": "anything"}, "units": {"name": "units", "group": "Ungrouped variables", "definition": "random(unitList)", "description": "", "templateType": "anything"}, "unitList": {"name": "unitList", "group": "Ungrouped variables", "definition": "[ safe(\"mm\"), safe(\"cm\"), safe(\"m\"), safe(\"km\") ]", "description": "

Units that are to be used for the question.

", "templateType": "list of strings"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["unitList", "units", "a", "min_angle", "max_angle", "b_max", "b_min", "b", "c"], "variable_groups": [{"name": "Unnamed group", "variables": []}], "functions": {"plotgraph": {"parameters": [["units", "string"], ["a", "number"], ["b", "number"], ["c", "number"]], "type": "html", "language": "javascript", "definition": "// This functions plots a right angled triangle based on two lengths\n\n//Set text and graph offsets to appear uniform\nvar yOffset = Math.ceil(a/10);\nvar xOffset = Math.ceil(a+2*yOffset-c/2)\n//Consider removing scale once all adjusted correctly\nvar offset = 1;\nvar textHeight =15;\nvar scale = yOffset/2;\nvar scaleOffset = offset*scale;\nvar scaleText = textHeight*scale;\n// This functions plots two dimensioned lines \n// Max and min x and y values for the axis.\nvar x_min = 0;\nvar x_max = 2*(a+2*yOffset);\nvar y_min = 0;\nvar y_max = a+2*yOffset;\n\n//Browser compatibility\nJXG.Options.text.display = 'internal';\n//Use MathJax for LaTeX display\nJXG.Options.text.useMathJax = true;\n\n// Make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '800px',\n '400px',\n {\n boundingBox: [0,y_max,x_max,0],\n//Change to false after testing\n axis: false,\n }\n);\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n//Draw three points \nvar A = board.create('point', [xOffset, yOffset], \n {size:0, fixed:true,\n label:{offset: [-10,-10]}});\nvar B = board.create('point', [xOffset, (a+yOffset)],\n {size:0, fixed:true,\n label:{offset: [0,10]}});\nvar C = board.create('point', [(c+xOffset), yOffset],\n {size:0, fixed:true,\n label:{offset: [10,0]}});\n\n//Draw a line between them\nvar AB = board.create('line',[A,B],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar BC = board.create('line',[B,C],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\nvar AC = board.create('line',[A,C],{fixed:false, straightFirst:false, straightLast:false, strokeWidth: 1});\n\nvar CAB = board.create('nonreflexangle', [C,A,B], {type:'sector', orthoType:'square', orthoSensitivity:0.4, \nradius:function() { return scale;} \n});\nvar CABLabel = CAB.label.setText(function () {\n var angle = 180.0 * CAB.Value() / Math.PI;\n if ((angle > 90.4) || (angle < 89.6)) {\n return ''+angle.toFixed(1) + '\\u00B0';\n } else {\n return '';\n }\n});\nCABLabel.setAttribute({anchorX:'middle'});\n\n/*Dummy text for testing variables, remove after testing\ntempText = board.create('text',[(2*a),(a+yOffset),\n// function () {return 'ABC = ' +(180.0*ABC.Value()/Math.PI).toFixed(2)+ ' degreeSymbol'}]);\nfunction () {return 'yOffset is ' + yOffset}]);\n*/\n\n//Set up dimension labels to be properly aligned\ntextAB = board.create('text', \n [function () {return (A.X() + B.X())/2},\n function () {return ((A.Y() + B.Y())/2)+(scaleOffset/2)},\n function () {return +A.Dist(B).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n\ntextBC = board.create('text', \n [function () {return (B.X() + C.X())/2},\n function () {return ((B.Y() + C.Y())/2)+(scaleOffset/2)},\n function () {return +B.Dist(C).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n\n/*\n//Hide this for final version\ntextAC = board.create('text', \n [function () {return (A.X() + C.X())/2},\n function () {return ((A.Y() + C.Y())/2)-scaleOffset},\n function () {return +A.Dist(C).toFixed(1) + ' ' + units}],\n {fontSize:15, anchorX:'middle'});\n*/\n\nvar tABRot = board.create('transform', \n [function () {return AB.getAngle()}, \n function () {return (A.X() + B.X())/2}, \n function () {return (A.Y() + B.Y())/2}],\n {type:'rotate'});\n\nvar tBCRot = board.create('transform', \n [function () {return BC.getAngle()}, \n function () {return (B.X() + C.X())/2}, \n function () {return (B.Y() + C.Y())/2}],\n {type:'rotate'});\n\n//Perform text rotations and update\ntABRot.bindTo(textAB);\ntBCRot.bindTo(textBC); \nboard.update();\n\nreturn div;"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

{plotgraph(units,a,b,c)}

\n

What is the length of side AC?

\n

Please give answer to 2 decimal places

\n

AC = [[0]] {units}

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "minValue": "{c}", "maxValue": "{c}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "2", "precisionPartialCredit": "50", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "contributors": [{"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}]}]}], "contributors": [{"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}]}