distinct points

daren.r's Avatar

daren.r

16 Jun, 2022 02:20 AM

I'm trying to replicate a project i once saw that shows each of the possible combinations of the android lock screen.. (the swipe / dots one)

I tried creating a 3x3 grid of points THEN pick 4 points THEN do a distinct on that..

and i notice that it removes a point or two that aren't truly distinct points.. any idea why that's happening?

the screenshot shows the comparison between the distinct and raw.. seed 0, pick 4, grid 3x3

  1. Support Staff 1 Posted by john on 16 Jun, 2022 03:44 AM

    john's Avatar

    Hi Darren,

    Thanks for writing in.

    A distinct node would not remove any points in this situation UNLESS you set grid width or height to 0, producing a single row or column of overlapping points. (Setting both width and height to 0 would produce 9 identical points.) A normal 3 x 3 grid of points (like the points on a lock screen) would all be distinct, so there would be nothing to remove.

    If you did set width or height to 0 and picked 4 of the 9 points you would see one or two duplicate points (or all four if both width and height were 0), and the duplicate node would remove those duplicates (keeping the first original of each point).

    But in any case, there is no need to use a duplicate node. If you have 9 normal distinct points (which is what the grid node will produce if you leave the default width and height alone), the pick node will pick four of them and they will be guaranteed to be distinct by definition. The pick node never picks the same item twice - and here will never pick more than 9 points even if you tell it to.

    So making an Android Lock Screen is quite straightforward - see attached demo and screenshot. Change the seed value of pick to pick a different set of four points. Change the seed value of shuffle to change their order.

    Let me know if you have any other questions! I enjoy answering them and everyone learns from it (including me).

    Keep playing!

    John

  2. Support Staff 2 Posted by john on 16 Jun, 2022 05:30 AM

    john's Avatar

    Darren,

    Now then, if you want to generate ALL POSSIBLE lock screens, that's a different matter.

    To do this you can convert my previous demo into a subnetwork that will draw any given pattern, where a pattern is a four-character string containing the digits 1 through 9. For example, "6248" would draw a Lock Screen connecting points 6, 2, 4, and 8 in that order.

    Inside that subnetwork you would pull out the individual digits, subtract 1 (since counting begins at zero in Nodebox), and use the SLICE node instead of the pick node to select each point.

    Then all you have to do is generate all 3024 possible patterns. You can do this by simply using a range node, converting the numbers to strings, and then remove all pattern strings containing zeroes or having duplicate digits.

    For your convenience I am attaching a screenshot, zipped demo, and PDF of the resulting poster. If you want to figure out exactly how to do this yourself (and I hope you do), don't open the zip file.

    Thanks for a fun challenge!

    John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Screen_Shot_2022-06-15_at_10.19.14_PM.png 81.3 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

06 Feb, 2025 01:37 AM
04 Feb, 2025 06:32 AM
04 Feb, 2025 05:04 AM
30 Jan, 2025 09:31 AM
30 Jan, 2025 09:08 AM

 

30 Jan, 2025 08:40 AM
24 Jan, 2025 07:50 AM
22 Jan, 2025 11:42 PM
21 Jan, 2025 09:43 AM
21 Jan, 2025 09:41 AM
21 Jan, 2025 09:36 AM