Thanks David, I'll experiment with this.
P
On 12/8/23 20:24, David Lambert wrote:
TAU=:2p1 NB. tauday.com
NB. round y to nearest multiple of x
round=: 1&$: :([*[:<.1r2+%~)
round 4.5
5
3 round 4.5
6
round&.:+. 22j10 * ^j.TAU*15% 360
19j15
NB. x the angle, y the point
NB. round "under" expression as Re Im vector
rotate=: [: round&.:+. (* [: ^ [: j. [: %/ ,&(360 , TAU))~
15 rotate 22j10
19j15
Date: Thu, 7 Dec 2023 11:48:26 -0500
From: "'PMA' via Programming"<programm...@jsoftware.com>
To:programm...@jsoftware.com
Subject: Re: [Jprogramming] A Dot-Graph Rotator
Message-ID:<370d931d-42eb-6de0-6a75-3454b0d0c...@eskimo.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
A slightly different approach. Rather than search out all alignments
and then deduce their degrees of rotation, I mean now to specify as
input the degrees for which rotations are to be generated.
Example: given a graph of one dot -- 22j10 -- I'd input that value with
a rotation choice -- 15 degrees counterclockwise -- and expect a single
integer-rounded output value of approximately 19j15.
(Those two "15"s are coincidental.)
My question is, what J syntax will generate that output?
Thanks again for your consideration!
Peter A
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm