[Jprogramming] A Dot-Graph Rotator
'PMA' via Programming
programming at jsoftware.com
Thu Dec 7 17:42:39 UTC 2023
Just right. I've got it as
rotate =: 4 : 0
<. 0.5 + x (* ^@:j.@:o.&(%&180)) y
)
Yaaay. Thanks, Henry!
P
On 12/7/23 12:20, Henry Rich wrote:
> 22j10 (* ^@:j.@:o.&(%&180)) 15
> 18.6622j15.3533
>
> Make the middle part a named verb if you like.
>
> Henry Rich
>
> On 12/7/2023 11:48 AM, 'PMA' via Programming wrote:
>> 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
>>
>>
>> On 11/16/23 09:26, Henry Rich wrote:
>>> This is my reply to a question someone posed yesterday. This
>>> afternoon I will post a complete solution. It's like the puzzle
>>> problems I posed you, but just a little longer and comes from a real
>>> user need. If you want to solve it yourself you will need the
>>> primitives
>>>
>>> j. dyad, / monad, / dyad, ~, -. dyad, ^ monad, | dyad, -, /: dyad,
>>> *. monad
>>>
>>> hhr
>>>
>>> On 11/15/2023 6:49 PM, Henry Rich wrote:
>>>> I would find the angles from each point to each other point, take
>>>> modulus(pi/2), concatenate the list with its negative, and sort.
>>>> Rotation by each angle produces a new alignment. Only J primitives
>>>> are needed.
>>>>
>>>> Use complex numbers to represent the (x,y) values, and *. to
>>>> convert to angles.
>>>>
>>>> Henry Rich
>>>>
>>>> On 11/15/2023 5:52 PM, 'PMA' via Wiki wrote:
>>>>>
>>>>> Dear J-Wiki,
>>>>>
>>>>> I want to make a script that, given the X/Y values of a 2D
>>>>> dot-graph, will rotate the graph around its designated origin,
>>>>> looking for instances of 2 or more points coming into new
>>>>> horizontal &/or vertical alignment, and at each such instance
>>>>> output the full set of current X/Y values (integer-rounded).
>>>>>
>>>>> Could you point me to the main needed ingredients?
>>>>>
>>>>> Thanks in advance,
>>>>>
>>>>> Peter Armstrong
>>>>>
>>>>
>>>
>>> ----------------------------------------------------------------------
>>> For information about J forums see http://www.jsoftware.com/forums.htm
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list