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 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> References: <8fe5af4b-242f-460f-b546-4a2ed830d1eb@googlegroups.com> <4ca72c7b-2cfd-4310-82d3-0fa8a917d889@googlegroups.com> <9c881808-2ee9-42c0-b964-b4f33f586b8a@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn 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+&. 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( ``, 'image/svg+xml' ).documentElement ); ;-b -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.