Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #38071

Re: Refreshing grade school math.

Path csiph.com!weretis.net!feeder7.news.weretis.net!news.mb-net.net!open-news-network.org!.POSTED.226.236.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Refreshing grade school math.
Supersedes <1650540.VLH7GnMWUR@PointedEars.de>
Date Tue, 14 Jan 2020 01:01:37 +0100
Organization PointedEars Software (PES)
Lines 51
Message-ID <7744077.NyiUUSuA9g@PointedEars.de> (permalink)
References <8fe5af4b-242f-460f-b546-4a2ed830d1eb@googlegroups.com> <qv6nnc$h44$1@gioia.aioe.org> <4ca72c7b-2cfd-4310-82d3-0fa8a917d889@googlegroups.com> <9c881808-2ee9-42c0-b964-b4f33f586b8a@googlegroups.com> <faff8a41-a0a7-4fb3-8a91-46b0f9801324@googlegroups.com> <aff0763d-eff8-46f2-ba60-0bcea3dcf5b0@googlegroups.com>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
Injection-Info gwaiyur.mb-net.net; posting-host="226.236.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.236.226"; logging-data="19829"; mail-complaints-to="abuse@open-news-network.org"
User-Agent KNode/4.14.10
Cancel-Key sha1:kwGXjUuEZ8P22+mTgCloPN7X5KI=
Cancel-Lock sha1:umCnbykzDIEMqkKo78tLghZSatE=
X-Face %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
X-User-ID U2FsdGVkX1/1zYIzv4oh748r5M2Rz7nDonIQY1eW3kvyOWZk9ZEAZw==
Xref csiph.com comp.lang.javascript:38071

Show key headers only | View raw


Michael Haufe (TNO) wrote:

> In elementary/primary school you should have learned the equation for a
> circle:
> 
> x^2 + y^2 = r^2
> 
> Alternate form to solve for y:
> 
> y = +/- sqrt(r^2 - x^2)
> 
> That's enough for you to plot your points.
> 
> Assuming a circle of radius 5 and centered at the origin (0,0)
> 
> iterate x from -r to +r and solve for y:
> 
> y = +/- sqrt((5)^2 - (-5)^2)
>   = +/- sqrt(25 - 25)
>   = +/- sqrt(0)
>   = +/- 0
>   = 0
> y = +/- sqrt((5)^2 - (-4)^2)
>   = +/- sqrt(25 - 16)
>   = +/- sqrt(9)
>   = +/- 3
> y = +/- sqrt((5)^2 - (-3)^2)
>   = +/- sqrt(25 - 9)
>   = +/- sqrt(16)
>   = +/- 4
> ...
> 
> now convert that to JavaScript

let r = 5;
document.body.appendChild(
  (new DOMParser()).parseFromString(
    `<svg xmlns="http://www.w3.org/2000/svg" width="${2 * r + 2}" 
height="${2 * r + 2}" stroke="black"><circle cx="${r + 1}" cy="${r + 1}" 
r="${r}" 
fill="transparent"/></svg>`,
    'image/svg+xml'
  ).documentElement
);

;-b

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-08 23:54 -0800
  Re: Refreshing grade school math. "R.Wieser" <address@not.available> - 2020-01-09 09:19 +0100
    Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-09 00:34 -0800
      Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-09 00:43 -0800
        Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-09 00:44 -0800
    Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-11 05:09 -0800
      Re: Refreshing grade school math. Julio Di Egidio <julio@diegidio.name> - 2020-01-11 22:13 -0800
        Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 09:58 -0800
          Re: Refreshing grade school math. Julio Di Egidio <julio@diegidio.name> - 2020-01-13 10:16 -0800
            Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 11:16 -0800
          Re: Refreshing grade school math. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-13 12:22 -0800
            Re: Refreshing grade school math. Julio Di Egidio <julio@diegidio.name> - 2020-01-13 12:53 -0800
              Re: Refreshing grade school math. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-13 15:31 -0800
              Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 16:03 -0800
            Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 13:00 -0800
              Re: Refreshing grade school math. "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-01-13 15:35 -0800
                Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 15:43 -0800
            Re: Refreshing grade school math. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-01-14 01:01 +0100
              Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 16:07 -0800
        Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 10:01 -0800
        Re: Refreshing grade school math. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2020-01-13 10:04 -0800

csiph-web