But in case those “means of nearest points” are actually needed,
the 2D case is easily generated:
require'plot'
r =: 4 NB. some radius
minmax =: 4%: -: r ^ 4 NB. minimum maximal coordinate
X =: minmax+(r-minmax)*1000%~i.1001
Y =: X -~&.:*: X %~ *:r
NB. this is quick and dirty, there are better ways to build
symmetric plots
quarterX =: X,~|.Y
quarterY =: Y,~|.X
halfX =: (,~-&|.) quarterX
halfY =: (,~|.) quarterY
fullX =: (,~|.) halfX
fullY =: (,~-&|.) halfY
plot fullX;fullY
Am 15.08.22 um 15:19 schrieb Raul Miller:
On Mon, Aug 15, 2022 at 6:31 AM Richard Donovan <rsdono...@hotmail.com> wrote:
I want to construct and plot a Squircle in J.
There is a lengthy article in Wikipedia but in simple language I want my
Squircle to be defined as the continuous line between a unit circle and the
unit square that encloses it such that every point on the Squircle is the mean
of the nearest points of the circle and the square.
Er... that's not what the wikipedia article says.
https://en.wikipedia.org/wiki/Squircle says that a squircle is a curve
between a square and a circle, but does not say anything about any
such mean.
That said, based on the wikipedia page, this would be a squircle:
require'viewmat'
viewmat 1>: +&|/~ ((i:300)%200)^4
--
----------------------
mail written using NEO
neo-layout.org
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm