Andrew and Raul, your verbs give correct results on the example
4 3 0 ,: _4 _3 _2. I need to check Oleg's original verb; the one modified by
Raul doesn't work on this example. Yes, I would be interested in dimensions
other than 3. Kip
Andrew Nikitin wrote:
>> From: Kip Murray
>>
>> Raul, Oleg, and Andrew
> ...
>> I would like for you to subject your solutions to one more test: try them on
>> the
>> box with diagonal 4 3 0 ,: _4 _3 _2 . This moves the previous example
>> 0 0 0 ,: 4 3 2 down two units, so the top face of the new example is in the
>> xy
>> plane, and the bottom face is two units below the xy plane. Do your verbs
>> give
>> correct results for this new example?
>
>
> cr=:(<./ ,:>./)&.(+/\)
> faces=:[: ,/ ((({:@[ * -...@]) ,:"1~ {...@[ ,: {...@[ + {:@[ * ])"2 1
> =...@i.@{:@$)
> cr 4 3 0 ,: _4 _3 _2
> 0 0 _2
> 4 3 2
> <"2 faces cr 4 3 0 ,: _4 _3 _2
> ┌──────┬──────┬──────┬──────┬──────┬─────┐
> │0 0 _2│4 0 _2│0 0 _2│0 3 _2│0 0 _2│0 0 0│
> │0 3 2│0 3 2│4 0 2│4 0 2│4 3 0│4 3 0│
> └──────┴──────┴──────┴──────┴──────┴─────┘
> <"2 faces 4 3 0 ,: _4 _3 _2
> ┌───────┬───────┬───────┬───────┬───────┬────────┐
> │4 3 0│0 3 0│ 4 3 0│ 4 0 0│ 4 3 0│ 4 3 _2│
> │0 _3 _2│0 _3 _2│_4 0 _2│_4 0 _2│_4 _3 0│_4 _3 0│
> └───────┴───────┴───────┴───────┴───────┴────────┘
>
> faces gives normalized (canonic) faces on normlized input and non-normalized
> (but still valid) faces on non-normalized input.
>
> I briefly considered rewriting the verb so it returns all set of k-faces of
> arbitrary n-dimensional cube. It adds complexity quite a bit.
>
> What are your use cases? Are higher dimensions interesting, or is it just 3?
>
>
>
> _________________________________________________________________
> Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
> http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm