{"id":17583,"date":"2015-10-06T05:01:00","date_gmt":"2015-10-05T19:01:00","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=17583"},"modified":"2015-10-05T14:59:11","modified_gmt":"2015-10-05T04:59:11","slug":"htmljavascript-canvas-slope-of-a-line-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-canvas-slope-of-a-line-primer-tutorial\/","title":{"rendered":"HTML\/Javascript Canvas Slope of a Line Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/slope_of_a_line.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"HTML\/Javascript Canvas Slope of a Line Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/slope_of_a_line.jpg\" title=\"HTML\/Javascript Canvas Slope of a Line Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">HTML\/Javascript Canvas Slope of a Line Primer Tutorial<\/p><\/div>\n<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management.<\/p>\n<p>In today&#8217;s tutorial we mainly use the <a target=_blank href='http:\/\/www.w3schools.com\/tags\/canvas_lineto.asp' title='HTML5 Canvas drawImage() method information from w3schools ... thanks'>lineTo<\/a> function to create a webpage where you can draw lines on a canvas and determine the slope of that line.<\/p>\n<p>In trigonometry (and Land Surveying) the slope of a line is of great interest.  Pretty obviously water doesn&#8217;t do very well flowing up against gravity (even with a stern talking to), so the Land Surveying skill called <a target=_blank title='Land Surveying levelling information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Levelling'>levelling<\/a> is all about determining between two points what is the difference in the Z co-ordinate.  Take a ratio of what this change is compared to the horizontal distance between those two points is on a horizontal plane (maybe known via a previous <a target=_blank title='Survey Traverse information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Traverse_(surveying)'>survey traverse<\/a>, or the one you did before or after the levelling &#8230; though it may be these days that <a target=_blank title='Geolocation information from Wikipedia ... thanks' href='https:\/\/en.wikipedia.org\/wiki\/Geolocation'>geolocation<\/a> can help with the (X,Y[,and perhaps the Z]) of these issues, to the point that flying crumbs from your <i>&#8220;making breakfast in bed web application&#8221;<\/i>, can be tracked and identified), and you have a measure of slope (up or down the proverbial hill or molehill).  Quite often in mathematics, or geometry, we are interested in the 2D horizontal plane only, and describe the slope as the ratio between change in the Y co-ordinate over a change in the X co-ordinate (being careful to reference what is the first point and what is the second).<\/p>\n<p>And so today, we show you a web application exploring that &#8230;<\/p>\n<blockquote><p>\nSlope = (Y<sub>2<\/sub> &#8211; Y<sub>1<\/sub>) \/ (X<sub>2<\/sub> &#8211; X<sub>1<\/sub>)\n<\/p><\/blockquote>\n<p> &#8230; concept that you can also read about at <a target=_blank title=\"Mathwords Slope of a Line\" href=\"http:\/\/www.mathwords.com\/s\/slope_of_a_line.htm\">Mathwords<\/a> &#8230; thanks, heaps.<\/p>\n<p>You may want to read more at <a target=_blank title='HTML Canvas Reference' href='http:\/\/www.w3schools.com\/tags\/ref_canvas.asp'>HTML Canvas Reference<\/a> as a generic reference, or here, at the tutorial <a target=_blank title='javascript - How do I add a simple onClick event handler to a canvas element? - Stack Overflow' href='http:\/\/stackoverflow.com\/questions\/9880279\/how-do-i-add-a-simple-onclick-event-handler-to-a-canvas-element'>javascript &#8211; How do I add a simple onClick event handler to a canvas element? &#8211; Stack Overflow<\/a>.<\/p>\n<p>As you can imagine, this HTML canvas element, new to HTML5, can be very useful for some practical client-side web functionality.<\/p>\n<p>Here is a link to some downloadable HTML programming code &#8230; rename to <a target=_blank href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/slope_of_a_line.html_GETME' title='slope_of_a_line.html'>slope_of_a_line.html<\/a><\/p>\n<p>We hope you enjoy this Mathematical tutorial <a target=_blank title='Canvas HTML element live run tutorial'  href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/slope_of_a_line.html\">live run<\/a>.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d17583' onclick='var dv=document.getElementById(\"d17583\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/?tag=mathematics\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d17583' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Canvas HTML element tag can be used as the container to draw graphics on the fly usually via the use of Javascript functions for rendering and event management. In today&#8217;s tutorial we mainly use the lineTo function to create &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/htmljavascript-canvas-slope-of-a-line-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,14,21,37],"tags":[184,1707,483,484,576,652,679,1708,752,997,1706,1303,1309,1319],"class_list":["post-17583","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-land-surveying","category-tutorials","tag-canvas","tag-co-ordinates","tag-geolocation","tag-geometry","tag-html","tag-javascript","tag-land-surveying","tag-levelling","tag-mathematics","tag-programming","tag-slope","tag-traverse","tag-trigonometry","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/17583"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=17583"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/17583\/revisions"}],"predecessor-version":[{"id":17588,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/17583\/revisions\/17588"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=17583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=17583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=17583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}