<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ geometry - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ geometry - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sat, 06 Jun 2026 22:30:27 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/geometry/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Angle Names in Geometry: Acute, Obtuse, Straight, & Right Angles, Defined ]]>
                </title>
                <description>
                    <![CDATA[ Angles: Acute, Obtuse, Straight and Right There are four types of angles depending on their size in degrees. These are: Right angles Straight angles Acute angles Obtuse angles Right angles Right angles are angles that have a measure of exactly 90°.... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/angle-names-in-geometry-acute/</link>
                <guid isPermaLink="false">66c3449d52e2abc555bfcc05</guid>
                
                    <category>
                        <![CDATA[ geometry ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Math ]]>
                    </category>
                
                    <category>
                        <![CDATA[ toothbrush ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Sun, 16 Feb 2020 23:19:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2020/03/jon-spectacle-Px4FW7rIXfo-unsplash.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <h2 id="heading-angles-acute-obtuse-straight-and-right"><strong>Angles: Acute, Obtuse, Straight and Right</strong></h2>
<p>There are four types of angles depending on their size in degrees. These are:</p>
<ul>
<li>Right angles</li>
<li>Straight angles</li>
<li>Acute angles</li>
<li>Obtuse angles</li>
</ul>
<h3 id="heading-right-angles"><strong>Right angles</strong></h3>
<p>Right angles are angles that have a measure of exactly 90°. For example, the angle at the corner of a square or rectangle is a right angle. An example of a right angle is below:</p>
<p><img src="https://user-images.githubusercontent.com/17547686/31929587-4f167f38-b8a5-11e7-8ee7-e76fc239e866.png" alt="example of a right angle" width="306" height="262" loading="lazy"></p>
<h3 id="heading-straight-angles"><strong>Straight angles</strong></h3>
<p>Right angles are angles that have a measure of exactly 180°. For example, a straight line has a straight angle. An example of a straight angle is below:</p>
<p><img src="https://user-images.githubusercontent.com/17547686/31929586-4efbd912-b8a5-11e7-8f43-5d73cca6e2eb.png" alt="example of a straight angle" width="502" height="222" loading="lazy"></p>
<h3 id="heading-acute-angles"><strong>Acute angles</strong></h3>
<p>Acute angles are angles that have a measure of less than 90°. For example, a capital letter "A" has an acute angle. An example of an acute angle is below:</p>
<p><img src="https://user-images.githubusercontent.com/17547686/31929585-4ee08266-b8a5-11e7-8af6-9860a8c46e67.png" alt="screen shot 2017-10-24 at 10 22 45" width="342" height="258" loading="lazy"></p>
<h3 id="heading-obtuse-angles"><strong>Obtuse angles</strong></h3>
<p>Obtuse angles are angles that have a measure of more than 90° but less than 180°. For example, a clock showing 5 o'clock has an obtuse angle. An example of an obtuse angle is below:</p>
<p><img src="https://user-images.githubusercontent.com/17547686/31929584-4ec4b216-b8a5-11e7-943d-ea74ce460f1b.png" alt="example of an obtuse angle" width="576" height="294" loading="lazy"></p>
<h2 id="heading-examples">Examples</h2>
<h4 id="heading-example-1"><strong>Example 1</strong></h4>
<p>What is the measure of the largest integer acute angle? Since acute angles are angles with a measure less than 90°, the largest integer acute angle will have a measure of 89°.</p>
<h4 id="heading-example-2"><strong>Example 2</strong></h4>
<p>What is the measure of the smallest integer obtuse angle? Since obtuse angles are angles with a measure larger than 90°, the smallest integer obtuse angle will have a measure of 91°.</p>
<h4 id="heading-example-3"><strong>Example 3</strong></h4>
<p>What is the measure of the angle in a capital letter "L", and what type of angle is it?The measure of the angle in a capital letter "L" is 90°, and the angle is a right angle.</p>
<h2 id="heading-more-articles-about-math">More articles about math:</h2>
<ul>
<li><a target="_blank" href="https://www.freecodecamp.org/news/math-in-javascript/">JavaScript Math Functions explained</a></li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ How to lock an angle when drawing on canvas in JavaScript ]]>
                </title>
                <description>
                    <![CDATA[ By Thang Minh Vu In many drawing tools (Adobe Photoshop, Sketch, and so on), if we hold the SHIFT button when drawing a line, we can create perfectly straight lines horizontally or vertically. Recently, I tried implementing this feature in canvas by ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-lock-an-angle-when-drawing-on-canvas-in-javascript-51938b5abc7c/</link>
                <guid isPermaLink="false">66c35328d58e4fdd567d51ae</guid>
                
                    <category>
                        <![CDATA[ canvas ]]>
                    </category>
                
                    <category>
                        <![CDATA[ geometry ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Mon, 18 Mar 2019 16:16:31 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*cWcey5rf6AkuNtkVZ7ywwg.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Thang Minh Vu</p>
<p>In many drawing tools (<a target="_blank" href="https://www.adobe.com/products/photoshop.html">Adobe Photoshop</a>, <a target="_blank" href="https://www.sketchapp.com/">Sketch</a>, and so on), if we hold the SHIFT button when drawing a line, we can create perfectly straight lines horizontally or vertically.</p>
<p>Recently, I tried implementing this feature in canvas by JavaScript. The process is really interesting. I would like to share the progress of how I approach it.</p>
<p><strong>Demo</strong>: To easier understand the idea, you can check a demo version at the <a target="_blank" href="https://ittus.github.io/draw-lock-angle/">demo page</a>.</p>
<h3 id="heading-requirements">Requirements</h3>
<p><strong>Input</strong></p>
<ul>
<li>A base point (B)</li>
<li>Current mouse position (M)</li>
</ul>
<p><strong>Output</strong></p>
<ul>
<li>Projection of current mouse position on x-axis or y-axis (P)</li>
</ul>
<p>For convenience, in all graphs, we will mark the base point by a red circle and the current mouse point by a green circle.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/zvt4t9MmiO6Uxc3zAyLDxUOta3S-j4Nl7JvE" alt="Image" width="488" height="458" loading="lazy">
<em>Problem: Decide which projection is better</em></p>
<h3 id="heading-simple-solution">Simple solution</h3>
<p>As I tackle the problem, it’s intuitive to see we can calculate the distance between the current mouse position with the horizontal line and vertical line. If the mouse position is nearer the horizontal line than the vertical line, we will take the projection on the horizontal line, and vice versa.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/F-mQyWvLknInihDnYTgeS2CYyiHljKRB-P1R" alt="Image" width="632" height="495" loading="lazy"></p>
<p>The calculation is quite simple — here is the Javascript code:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/AmQiLZ6chh1YF30QhI6MXs0Qrpwq1SkXAdti" alt="Image" width="800" height="475" loading="lazy"></p>
<h3 id="heading-extended-problem">Extended Problem</h3>
<p>How about if we want to project on the bisector line between the horizontal line and vertical line (similar with <a target="_blank" href="https://www.sketchapp.com/">Sketch</a>)? That means users can project the mouse position on the horizontal line, vertical line, 45-degree angle line, or 135-degree angle line.</p>
<p>The approach is similar. This time we need to calculate the distance between the mouse position to 4 lines: horizontal line, vertical line, and 2 bisector lines (45-degree line and 135-degree line). But the calculation is more complex.</p>
<p>We still can divide it into 2 steps:</p>
<ol>
<li>Determine which line is nearest with mouse position</li>
<li>Calculate the projection of mouse position on the nearest line</li>
</ol>
<p><img src="https://cdn-media-1.freecodecamp.org/images/yRRlpXpZg16PFuGjohkEwMBRTQ074yN4UmvH" alt="Image" width="489" height="460" loading="lazy"></p>
<h4 id="heading-step-1-determine-which-line-is-nearest-with-mouse-position">Step 1: Determine which line is nearest with mouse position</h4>
<p>First, we need to determine line formulation of 4 lines above. Because we already know the base point (x0, y0) and the line angle, it’s easy to figure out the formulation of each line.</p>
<blockquote>
<p>Example: To calculate the formula of the 45-degree bisector, we already know that the line will go through the base point (x0, y0) and (x0 + 1, y0 + 1). Using the <a target="_blank" href="https://www.wikihow.com/Find-the-Equation-of-a-Line">Find-the-Equation-of-a-Line</a> method, we can figure out the line formula.</p>
</blockquote>
<p>Finally, we will have 4 lines’ formulas:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/ngaxjDK6zWtgP74BOXPwMU2jZY014c7L-lu6" alt="Image" width="187" height="82" loading="lazy"></p>
<p>To calculate the distance between the base mouse position to each line, we can use a popular math formula:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/C4Tk7kqRbwGbPtYFwK-HDSRlmVnGTRunxAso" alt="Image" width="359" height="27" loading="lazy">
<em>Distance from a point to a line</em></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Adk5BQAv15Jy4IuGUBSyKiSxkU68gEgsdh7z" alt="Image" width="800" height="561" loading="lazy">
<em>Finding the nearest line</em></p>
<h4 id="heading-step-2-calculate-the-orthogonal-projection-of-mouse-position-on-the-nearest-line">Step 2: Calculate the orthogonal projection of mouse position on the nearest line</h4>
<p>Now the problem becomes calculating the orthogonal projection of the mouse position (M) to the nearest line with the formula: ax + by + c = 0 (L)</p>
<p>There are multiple ways to solve this problem. I took a simple way: First, calculate the formula of the line which contains mouse position M and perpendicular to line L, called L'. Then, solve the system of equations to get the intersection point between line L and L', which is the projection point which we are finding.</p>
<p>After some calculation, I figured out the formula of L’, which goes through M (x0, y0) and perpendicular to L (ax + by + c = 0):</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/BwlHT2VPl2baMMHQtQYI2vGkCUq0jl0ZpiLz" alt="Image" width="198" height="17" loading="lazy"></p>
<p>Now to find the intersection, we need to solve the system of equations:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/4nJ1rFj7FrXEwZ0KK3MLEGo10DMJDUrchUxB" alt="Image" width="211" height="54" loading="lazy"></p>
<p>Using <a target="_blank" href="https://en.wikipedia.org/wiki/Cramer%27s_rule">Cramer’s rule</a> and matrix determinant, we can solve this equation easily:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/YeHWX9l70xghLPvDkqTZA19RSbRGyRIZq4WJ" alt="Image" width="800" height="526" loading="lazy">
<em>Solve simultaneous equations</em></p>
<h3 id="heading-boundary">Boundary</h3>
<p>There is a situation when we want to limit the boundary of projection.</p>
<p>Example:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/3WNRAcorUIwF9lwihmXCjAna8DovCrhgmUxi" alt="Image" width="379" height="404" loading="lazy">
<em>The projection point is outside of the boundary</em></p>
<p>In this case, we want to limit the projection in the white rectangle area, but using the discussed method, the projection point can be outside of the boundary area.</p>
<p>In this situation, we can simply get the intersection point of line L’ to the boundary (called P’).</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Zl5D-QVbgmra2XCyD6khtLSFE1sF9VzPz49c" alt="Image" width="800" height="1049" loading="lazy">
<em>Support boundary of the projection</em></p>
<h3 id="heading-full-source-code"><strong>Full source code</strong></h3>
<p>You can check out the demo and source code on <a target="_blank" href="https://github.com/ittus/draw-lock-angle">Github</a>.</p>
<p>Happy Coding!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
