This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Calling this function will return a function that gives you the position of the dot at an index. | |
| // This version uses the golden angle to create a tightly packed spiral. | |
| // This is made as a closure so that the array of positions is only calculated once. | |
| // | |
| // Usage: | |
| // let getDotPosition = initCircleOfDots_Spiral(); | |
| // let p = getDotPosition(50); | |
| // | |
| // This will return a point in the format { x: 2.9227, y: 1.9894 } | |
| // The distance between the dots is approximately 1, so you probably have to scale the positions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Calling this function will return a function that gives you the position of the dot at an index. | |
| // This version creates rings of dots. The outer ring will be partially filled most of the time. | |
| // This is made as a closure so that the array of positions is only calculated once. | |
| // | |
| // Usage: | |
| // let getDotPosition = initCircleOfDots_SimpleRings(); | |
| // let p = getDotPosition(50); | |
| // | |
| // This will return a point in the format { x: 1.4724, y: 3.7191 } | |
| // The distance between the dots is approximately 1, so you probably have to scale the positions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Calling this function will return a function that gives you the position of the dot at an index. | |
| // You must also pass the total number of dots of the circle to this function to calculate correctly. | |
| // | |
| // This version creates rings in a more advanced way, so that the outer ring is always completely filled. | |
| // This is made as a closure so that the array of positions is only calculated once. | |
| // | |
| // Usage: | |
| // let getDotPosition = initCircleOfDots_AdvancedRings(); | |
| // let p = getDotPosition(50, 100); | |
| // |
OlderNewer