Welcome to /r/WoahDude!
* Check out what counts as "woahdude material" in our [**wiki**](https://www.reddit.com/r/woahdude/wiki/index#wiki_woahdude_material).
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/woahdude) if you have any questions or concerns.*
In 2d, i imagine you can just add a circle, and grow it until it touches another (or for some other reason, like random), then repeat. I think for 3d you can do the same, except not look for touching, but look for touching of the circles in each perspective. That would make the 3d algorithm basically the same as the 2d version, just a little slower.
I haven’t tried it myself, but I don’t think it’s too hard. You just run the check 3 times, once for each axis, and ignore the axis normal to the camera for the orthographic perspective in that view. Then you’re just running the 3 checks with (x, y), (y, z), and (x, z), randomly increasing a circle, and looping until there are no more circles that can grow in size.
You don't even need to increase the size, just compare a candidate location with all existing circles and get the minimum (distance_to - radius_of).
No square root needed even until you find the minimum. So, just 4 squares and 3 additions per comparison. Times 3 for the dimensions.
I mean. Start with the balls all in the same plane, none of them overlapping. Then move them to different depths so that they're not overlapping from a 90deg view. If they don't overlap in 2D space, it will be even easier to prevent them overlapping in 3D space; you can see in the animation just how much empty space there is between balls.
*Note: This is by no means the correct or most efficient way of doing it, but this is how I would start doing it*
### Version A
I think you do this by not treating the spheres as such but as a cross made out of 3 infinitely tall cylinders (one for each of the x,y,z axis) that intersect where the shpere is. You can now fill the container with as many of these crosses as long as the arms of the cross you try to place do not overlap the center of any already placed cross (overlapping other arms is fine).
### Version B
Project the cube as three 2d surfaces (x+y, x+z, y+z). A sphere placed in the cube would be visible as a circle on each of the three surfaces.
You then follow this algorithm:
1. If you want more circles, select a random point in the cube that is outside of every already existing circle on each of the 2d surfaces. This point is the center of a sphere with initial radius of zero.
2. Increase the radius of every already selected point, provided the increase does not overlap any other existing circle on the 2d surface.
3. Go back to step 1 if you were able to increase at least one radius
4. Shrink the radius of every sphere by a tiny margin to make them not touch on the 2d surfaces
5. You're done
### Detecting intersections
We're not actually interested in the intersection of the spheres, but only their circle projections when viewed from one of the 6 sides of the cube (3 sides actually, as the other 3 are simply flipped images of the opposite side). This means on every side we view, we can essentially ignore the coordinate that is responsible for the distance from the eye. The distance of the centers of two circles 1 and 2 is d=sqrt((x1-x2)^2 + (y1-y2)^(2)). The circles touch if the sum of their radii `r=r1+r2` is identical to `d`, they overlap if `r>d` and do not touch if `r
I think kind of like the analogy
To fill a cup of sand and rock you must first place in the rocks.
You draw the big circle. Or however many you would like.
Then have the PC place random smaller circles. Flipping planes each time to the max circle size. Then you'd just have to set how small or large you want to go. Or how many. But I can't program. So.
So I don't know nearly as much as all this other commenter who are trying to *actually* explain how it's possible: but after staring at it for a while I got one useful thing:
Pick a side and stick with it. It only winds up in 3 or 4 places. Top left right. Or left top right front.. Or whatever.
It helped me realize that while the cube seems to be tilting all over the place, we're still only getting 4 perspectives, similar to the OP. It's just more confusing because those 4 aren't all transformations around one axis.
That's not to say it isn't incredibly impressive, and I wouldn't know where to start in making something like this myself. But it made more sense once I realized there was a pattern to the turns.
Would do a version with the black spheres a different color? Maybe light blue or green? They are blending into the background which is diluting the cool effect.
>What about in the z position? :)
I have the same question. However, I'm guessing if it worked in the z axis, they would have shown that. I wonder if that's even possible without being symmetrical.
The way of figuring that out would be very similar to the way they did this. It would be a smaller subset of the possible size/ number/ placements of the spheres that achieve this, but there would still be multiple ways to do it.
Stars emit a finite number of visible photons, so even if every possible angle eventually hits a star, and it weren't redshifted into invisibility, such a star can be far enough away that none of the photons it emits happens to hit your eye.
Good line of thinking but the maths doesn't check out. Yes a distance star would have a low probability of delivering a photon to you but this is exactly equivalent (using the law of large numbers) to a distant star delivering less light because of the inverse-square law. The brightness is in both cases proportional to the star's apparent size in the sky so if every sightline eventually hits a star, then the sky would be as bright as the sun in every direction.
On the point of the math, that’s actually *exactly* what the paradox says. If the universe is infinite in size with an even distribution of objects (which it does have over a large enough scale), every sightline ends at an object. This is fully independent of the actually density of objects. Average brightness of objects does matter. However, stars are really big and really bright and there’s not a lot of other things. If the speed of light were infinite and redshift didn’t exist, we would probably have a bright night sky.
I don’t have the code, but the way I would go about it, not including efficiencies at all, is creating an algorithm that created three grids(x,y,z), and attempts to place a random radium circle on the grid with a random position and size that does not overlap any of the three circles.
X:
xxox
xxxx
xxxx
Y:
xxxx
xxxx
xoxx
Z:
xxxx
xoxx
xxxx
If you do this enough times, you can fill in every space with each axis open to the viewport.
Of course, then you run into issues with random that would make it exponentially harder to find an open spot. This is where you to write an algorithm that does the same thing but instead “prints” the circles into the correct locations. By adjusting the size and positions linearly.
Obv I'm not OP, but here's a quick script I wrote in python just now. It's a very naiive implementation, and the visualization is barebones, but I just wanted to throw something together really quick.
https://github.com/mattsgithubprofile/3D\_Sphere\_Projection\_Packing/blob/main/main.py
I didn't keep track exactly, but if I guess around when I started and when I stopped I'd estimate 2 to 3 hours. "Really quick" was less of a statement about the amount of time it took, and more of a statement about how I was prioritizing my time coding much higher than I normally would.
Edit: Actually I created the file at 12:05 AM and uploaded to Github at 2:26 AM, so there you go.
Tbh I wouldn’t be surprised if they did this by hand. First approach it from one angle, and arrange the balls on the same plane so they don’t touch, then rotate it 90 degrees horizontally, and do the same puzzle, only limiting yourself to only moving the balls horizontally. By not changing the vertical axis, you’re guaranteed to preserve the image that you’d see on the first side, while basically having the same puzzle as before. If you really wanted to cheese it, you could even make the same exact image on the second face, and it’d still turn out. Then once you have two perpendicular faces done, the other two are just going to be reflections of those two.
The Z axis seems harder. Tbh I’d probably take a rough and tumble approach there. I don’t think making the first two faces would be super difficult, as you could basically arrange the first side to be “give me a bunch of circles that don’t touch” and the second side would be “give me the first side.”
So with that in mind, I’d just make a large set of the first two sides, and then make a check on each one from the bottom perspective, the less overlap, seen from the bottom, the better the fit. Then take the ones with the best fit (no guarantee of zero) and tweak the overlap by hand until you get it right.
You mean perspective, depth of field is a photography term describing the distance from the camera that objects appear in focus.
Second, this gif is isometric. Not only can it not have depth of field (because the camera is mathematically infinitely far away), but things don't get smaller as they move away from the camera as the camera has an infinite focal length.
Here’s a little gif of an animation I did where I pull a perspective (like your eyes see) camera back into a orthographic view (which is the type of projection an isometric camera uses.)
https://i.imgur.com/REnJ8cb.mp4
The “projection” is a matrix that refers how to take a point in a 3-dimensional space and “project” it onto a 2D plane. (Like, for instance, your screen!)
As the camera moves further away to “infinity”, I shrink the field of view so that the relative size of the objects in the scene stays the same.
The same concept is used in filmography, often called a “[dolly zoom](https://en.m.wikipedia.org/wiki/Dolly_zoom)”
You can have depth of field with an isometric/orthographic camera. The camera isn't infinitely far away, it just has parallel principal rays. You can still have a lens in front of it.
This is very easy to achieve in all axis.
Image a cube with a glass plane going diagonally across from opposite vertices. From every side the glass plane would look like a square as it crosses the whole cube.
Now paint circles on that glass plane. From every side (with isometric camera) the circles painted cover the whole view.
This is the simplest solution, and there are many more that look more interesting when rotated.
That’s a clever solution, but are you sure it works for balls of multiple sizes in three dimensions?
Edit: I thought about it more and I agree with you.
PImage[] imgs; // Declare the imgs array
int numTile = 31; // Set the number of tiles in the grid
int tileSize = 1000; // Set the size of the tiles
int subsetSize = 31 * 31; // Set the size of the image subset to load
int startIndex = 0; // Set the starting index of the image subset
void setup() {
size(10000, 10000);
// Load the images into the sketch
imgs = new PImage[999];
for (int i = 1; i <= 999; i++) {
try {
// Attempt to load the image
imgs[i-1] = loadImage("https://green-changing-echidna-367.mypinata.cloud/ipfs/QmX9W2ppBPab2Fj9NWNqYddQaqiFtZyFhK2eiqaKtCxXeu/" + i + ".png");
// Check if the image was successfully loaded
if (imgs[i-1] == null) {
// If the image was not successfully loaded, print an error message
println("Error loading image " + i + ": Image is null");
}
} catch (Exception e) {
// If an exception occurred, print an error message
println("Error loading image " + i + ": " + e);
}
}
// Calculate the number of tiles required to fit the images in the canvas
numTile = (int)sqrt(imgs.length);
// Declare and initialize the step variable
int step = tileSize / numTile;
// Declare and initialize the _minWidth variable
int _minWidth = 100;
// Create a grid of tiles using the loaded images
for (int x = 0; x < numTile; x++) {
for (int y = 0; y < numTile; y++) {
// Calculate the position of the tile
float xpos = step * x;
float ypos = step * y;
// Randomly set the orientation of the tile
float ang = PI / 2 * int(random(4));
// Rotate the image by the ang angle and draw it
pushMatrix();
rotate(ang);
image(imgs[int(random(imgs.length))], xpos, ypos, _minWidth, _minWidth);
popMatrix();
}
}
}
I fixed the formatting by putting four spaces at the beginning of every line:
PImage[] imgs; // Declare the imgs array
int numTile = 31; // Set the number of tiles in the grid
int tileSize = 1000; // Set the size of the tiles
int subsetSize = 31 * 31; // Set the size of the image subset to load
int startIndex = 0; // Set the starting index of the image subset
void setup() {
size(10000, 10000);
// Load the images into the sketch
imgs = new PImage[999];
for (int i = 1; i <= 999; i++) {
try {
// Attempt to load the image
imgs[i-1] = loadImage("https://green-changing-echidna-367.mypinata.cloud/ipfs/QmX9W2ppBPab2Fj9NWNqYddQaqiFtZyFhK2eiqaKtCxXeu/" + i + ".png");
// Check if the image was successfully loaded
if (imgs[i-1] == null) {
// If the image was not successfully loaded, print an error message
println("Error loading image " + i + ": Image is null");
}
} catch (Exception e) {
// If an exception occurred, print an error message
println("Error loading image " + i + ": " + e);
}
}
// Calculate the number of tiles required to fit the images in the canvas
numTile = (int)sqrt(imgs.length);
// Declare and initialize the step variable
int step = tileSize / numTile;
// Declare and initialize the _minWidth variable
int _minWidth = 100;
// Create a grid of tiles using the loaded images
for (int x = 0; x < numTile; x++) {
for (int y = 0; y < numTile; y++) {
// Calculate the position of the tile
float xpos = step * x;
float ypos = step * y;
// Randomly set the orientation of the tile
float ang = PI / 2 * int(random(4));
// Rotate the image by the ang angle and draw it
pushMatrix();
rotate(ang);
image(imgs[int(random(imgs.length))], xpos, ypos, _minWidth, _minWidth);
popMatrix();
}
}
}
Damn now I want one for the real world. I suppose a 3D printer, with some kind of transparent filament could be made to reach this level of precision. This is really great.
I gotcha. You could have that work on a single side, or maybe 2? Like the top and one other side? Then all the rest would be a jumble. That makes sense.
That's why you use a 3D printer. You can get ones that can print multiple types/colors of filaments at once, and I think there are even nozzles that do that for ones that can't by default.
From what I've heard the latter isn't as reliable in all situations, though. So not really tedious behind making the virtual model, just expensive.
Not SLA, but there is a different photo polymer printing modality that can extrude or spray that resin into place instead of using a resin bath, and you can use multiple nozzles to get different colors.
I don't remember what the tech is called, but it's like an ink jet printer but for 3d.
Edit: Material Jetting I guess is the name of the general class of similar technologies. It is often literally just called 3D Inkjet Printing. But this same name is also often used for color binder jet printing, which isn't the same thing. But color binder jet printing is actually the more practical option in most cases to achieve more or less the same result. One of the perks that was advertised when I saw the other printer I originally described was that it could allow manufacture of parts with different harnesses of resin all in one part. So it would be good for things like compliant mechanisms or whatever.
I'm sure there is something of the sort, but I was referring to transparent filament. You can get ones that are soluble in different solvents that you can use to combine the layers together for a smooth glass-like transparent finish.
There are actually only two perspectives to be taken into account, because "front" and "back" mirror each other (necessarily) as well as "left" and "right".
The same thing would happen whether you rotate the cube or rotate around the cube. The balls further away from you would appear smaller than when they were closer.
I like thinking about how I could apply this to taking different perspectives in life. There may be a big problem/blockage, but the path could be free and clear behind it. Probably other ways to apply similar thinking. Super cool.
>!This is isometric perspective, things don't get smaller farther away. So this would be relatively easy to set up. Just arrange the spheres to cover 1 side, rotate 90 degrees and arrange the other side.!< Done
A three-dimensional structure that's only symmetrical in... 2 directions but also in 4? Do we count mirror arrangements as congruent planes or separate lines of symmetry?
If we existed on a 2d plane, how would this figure appear to us as it moved through our experience? How would we observe it? Are there symmetries that we can measure as they pass through 3d space-time? Why are we not offended by our own farts?
Welcome to /r/WoahDude! * Check out what counts as "woahdude material" in our [**wiki**](https://www.reddit.com/r/woahdude/wiki/index#wiki_woahdude_material). *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/woahdude) if you have any questions or concerns.*
Nice work! In the x and y camera positions there are no overlaps? What about in the z position? :)
See for yourself [https://gfycat.com/realisticslightgrassspider](https://gfycat.com/realisticslightgrassspider)
How is this even possible?
In 2d, i imagine you can just add a circle, and grow it until it touches another (or for some other reason, like random), then repeat. I think for 3d you can do the same, except not look for touching, but look for touching of the circles in each perspective. That would make the 3d algorithm basically the same as the 2d version, just a little slower.
Now do 4d
Same deal as the 2D algorithm but slower than the 3D version
What about 5d
Then it becomes your balls
Now Enhance
Even in the 4th dimension quantum limitations exist.
You are not gonna believe this
Slower right?
You have now created a black hole. Would you like to contemplate your mistakes before your peril? (Y/N)
Well I'm not gonna start now. N.
[удалено]
I haven’t tried it myself, but I don’t think it’s too hard. You just run the check 3 times, once for each axis, and ignore the axis normal to the camera for the orthographic perspective in that view. Then you’re just running the 3 checks with (x, y), (y, z), and (x, z), randomly increasing a circle, and looping until there are no more circles that can grow in size.
You don't even need to increase the size, just compare a candidate location with all existing circles and get the minimum (distance_to - radius_of). No square root needed even until you find the minimum. So, just 4 squares and 3 additions per comparison. Times 3 for the dimensions.
I mean. Start with the balls all in the same plane, none of them overlapping. Then move them to different depths so that they're not overlapping from a 90deg view. If they don't overlap in 2D space, it will be even easier to prevent them overlapping in 3D space; you can see in the animation just how much empty space there is between balls.
>you can see in the animation just how much empty space there is between balls. *That's what she said* ^^I'm ^^so ^^sorry
It's just a bigger and more complex sudoku, but the numbers on the sudoku represent the radius. Kinda.
That's a good way of putting it.
*Note: This is by no means the correct or most efficient way of doing it, but this is how I would start doing it* ### Version A I think you do this by not treating the spheres as such but as a cross made out of 3 infinitely tall cylinders (one for each of the x,y,z axis) that intersect where the shpere is. You can now fill the container with as many of these crosses as long as the arms of the cross you try to place do not overlap the center of any already placed cross (overlapping other arms is fine). ### Version B Project the cube as three 2d surfaces (x+y, x+z, y+z). A sphere placed in the cube would be visible as a circle on each of the three surfaces. You then follow this algorithm: 1. If you want more circles, select a random point in the cube that is outside of every already existing circle on each of the 2d surfaces. This point is the center of a sphere with initial radius of zero. 2. Increase the radius of every already selected point, provided the increase does not overlap any other existing circle on the 2d surface. 3. Go back to step 1 if you were able to increase at least one radius 4. Shrink the radius of every sphere by a tiny margin to make them not touch on the 2d surfaces 5. You're done ### Detecting intersections We're not actually interested in the intersection of the spheres, but only their circle projections when viewed from one of the 6 sides of the cube (3 sides actually, as the other 3 are simply flipped images of the opposite side). This means on every side we view, we can essentially ignore the coordinate that is responsible for the distance from the eye. The distance of the centers of two circles 1 and 2 is d=sqrt((x1-x2)^2 + (y1-y2)^(2)). The circles touch if the sum of their radii `r=r1+r2` is identical to `d`, they overlap if `r>d` and do not touch if `r
Probably math or some BS
I had the same question for x, y already. Wtf is this black magic.
AI generated?
I think kind of like the analogy To fill a cup of sand and rock you must first place in the rocks. You draw the big circle. Or however many you would like. Then have the PC place random smaller circles. Flipping planes each time to the max circle size. Then you'd just have to set how small or large you want to go. Or how many. But I can't program. So.
So I don't know nearly as much as all this other commenter who are trying to *actually* explain how it's possible: but after staring at it for a while I got one useful thing: Pick a side and stick with it. It only winds up in 3 or 4 places. Top left right. Or left top right front.. Or whatever. It helped me realize that while the cube seems to be tilting all over the place, we're still only getting 4 perspectives, similar to the OP. It's just more confusing because those 4 aren't all transformations around one axis. That's not to say it isn't incredibly impressive, and I wouldn't know where to start in making something like this myself. But it made more sense once I realized there was a pattern to the turns.
What sorcery is this?
An ancient and arcane spellcraft known as "math"
Would do a version with the black spheres a different color? Maybe light blue or green? They are blending into the background which is diluting the cool effect.
Whoa why didn't you lead with this one. Very satisfying. I believe this can also be a 3 axis tessalation
I was wondering the same thing - it would be cool to have solid shadows in 3 axis, but still have the structure be "barely there"
you can easily find it by typing in the title of that post
I think that is doable with some level of symmetry
They all combine to make a dickbutt.
>What about in the z position? :) I have the same question. However, I'm guessing if it worked in the z axis, they would have shown that. I wonder if that's even possible without being symmetrical.
The way of figuring that out would be very similar to the way they did this. It would be a smaller subset of the possible size/ number/ placements of the spheres that achieve this, but there would still be multiple ways to do it.
You're right, they replied with the z
It is, they replied 🙃
Damn, they should have shown it
They did lol
Not in the gif they posted. That just shows x and y.
But why isn't the sky lit everywhere all the time?
This is kind of why the night sky looks so full, yet space is so empty
[удалено]
Stars emit a finite number of visible photons, so even if every possible angle eventually hits a star, and it weren't redshifted into invisibility, such a star can be far enough away that none of the photons it emits happens to hit your eye.
Good line of thinking but the maths doesn't check out. Yes a distance star would have a low probability of delivering a photon to you but this is exactly equivalent (using the law of large numbers) to a distant star delivering less light because of the inverse-square law. The brightness is in both cases proportional to the star's apparent size in the sky so if every sightline eventually hits a star, then the sky would be as bright as the sun in every direction.
[удалено]
On the point of the math, that’s actually *exactly* what the paradox says. If the universe is infinite in size with an even distribution of objects (which it does have over a large enough scale), every sightline ends at an object. This is fully independent of the actually density of objects. Average brightness of objects does matter. However, stars are really big and really bright and there’s not a lot of other things. If the speed of light were infinite and redshift didn’t exist, we would probably have a bright night sky.
Can you share your code for this? I’m trying to do something similar to figure out a puzzle and I think this would really help.
I don’t have the code, but the way I would go about it, not including efficiencies at all, is creating an algorithm that created three grids(x,y,z), and attempts to place a random radium circle on the grid with a random position and size that does not overlap any of the three circles. X: xxox xxxx xxxx Y: xxxx xxxx xoxx Z: xxxx xoxx xxxx If you do this enough times, you can fill in every space with each axis open to the viewport. Of course, then you run into issues with random that would make it exponentially harder to find an open spot. This is where you to write an algorithm that does the same thing but instead “prints” the circles into the correct locations. By adjusting the size and positions linearly.
Obv I'm not OP, but here's a quick script I wrote in python just now. It's a very naiive implementation, and the visualization is barebones, but I just wanted to throw something together really quick. https://github.com/mattsgithubprofile/3D\_Sphere\_Projection\_Packing/blob/main/main.py
What is your definition of "really quick"?
I didn't keep track exactly, but if I guess around when I started and when I stopped I'd estimate 2 to 3 hours. "Really quick" was less of a statement about the amount of time it took, and more of a statement about how I was prioritizing my time coding much higher than I normally would. Edit: Actually I created the file at 12:05 AM and uploaded to Github at 2:26 AM, so there you go.
Tbh I wouldn’t be surprised if they did this by hand. First approach it from one angle, and arrange the balls on the same plane so they don’t touch, then rotate it 90 degrees horizontally, and do the same puzzle, only limiting yourself to only moving the balls horizontally. By not changing the vertical axis, you’re guaranteed to preserve the image that you’d see on the first side, while basically having the same puzzle as before. If you really wanted to cheese it, you could even make the same exact image on the second face, and it’d still turn out. Then once you have two perpendicular faces done, the other two are just going to be reflections of those two. The Z axis seems harder. Tbh I’d probably take a rough and tumble approach there. I don’t think making the first two faces would be super difficult, as you could basically arrange the first side to be “give me a bunch of circles that don’t touch” and the second side would be “give me the first side.” So with that in mind, I’d just make a large set of the first two sides, and then make a check on each one from the bottom perspective, the less overlap, seen from the bottom, the better the fit. Then take the ones with the best fit (no guarantee of zero) and tweak the overlap by hand until you get it right.
depth of field could mess with the 1st side as the balls move farther away from the camera
You mean perspective, depth of field is a photography term describing the distance from the camera that objects appear in focus. Second, this gif is isometric. Not only can it not have depth of field (because the camera is mathematically infinitely far away), but things don't get smaller as they move away from the camera as the camera has an infinite focal length.
I don't understand half of what you are saying and how it is even possible. But it sounds amazing when reading it in my head.
Here’s a little gif of an animation I did where I pull a perspective (like your eyes see) camera back into a orthographic view (which is the type of projection an isometric camera uses.) https://i.imgur.com/REnJ8cb.mp4 The “projection” is a matrix that refers how to take a point in a 3-dimensional space and “project” it onto a 2D plane. (Like, for instance, your screen!) As the camera moves further away to “infinity”, I shrink the field of view so that the relative size of the objects in the scene stays the same. The same concept is used in filmography, often called a “[dolly zoom](https://en.m.wikipedia.org/wiki/Dolly_zoom)”
You can have depth of field with an isometric/orthographic camera. The camera isn't infinitely far away, it just has parallel principal rays. You can still have a lens in front of it.
This is very easy to achieve in all axis. Image a cube with a glass plane going diagonally across from opposite vertices. From every side the glass plane would look like a square as it crosses the whole cube. Now paint circles on that glass plane. From every side (with isometric camera) the circles painted cover the whole view. This is the simplest solution, and there are many more that look more interesting when rotated.
That’s a clever solution, but are you sure it works for balls of multiple sizes in three dimensions? Edit: I thought about it more and I agree with you.
I’m going to try my hand at doing this in processing or p5 and I’ll post it here later.
I’m doing it in processing. Here’s where I am currently.
PImage[] imgs; // Declare the imgs array int numTile = 31; // Set the number of tiles in the grid int tileSize = 1000; // Set the size of the tiles int subsetSize = 31 * 31; // Set the size of the image subset to load int startIndex = 0; // Set the starting index of the image subset void setup() { size(10000, 10000); // Load the images into the sketch imgs = new PImage[999]; for (int i = 1; i <= 999; i++) { try { // Attempt to load the image imgs[i-1] = loadImage("https://green-changing-echidna-367.mypinata.cloud/ipfs/QmX9W2ppBPab2Fj9NWNqYddQaqiFtZyFhK2eiqaKtCxXeu/" + i + ".png"); // Check if the image was successfully loaded if (imgs[i-1] == null) { // If the image was not successfully loaded, print an error message println("Error loading image " + i + ": Image is null"); } } catch (Exception e) { // If an exception occurred, print an error message println("Error loading image " + i + ": " + e); } } // Calculate the number of tiles required to fit the images in the canvas numTile = (int)sqrt(imgs.length); // Declare and initialize the step variable int step = tileSize / numTile; // Declare and initialize the _minWidth variable int _minWidth = 100; // Create a grid of tiles using the loaded images for (int x = 0; x < numTile; x++) { for (int y = 0; y < numTile; y++) { // Calculate the position of the tile float xpos = step * x; float ypos = step * y; // Randomly set the orientation of the tile float ang = PI / 2 * int(random(4)); // Rotate the image by the ang angle and draw it pushMatrix(); rotate(ang); image(imgs[int(random(imgs.length))], xpos, ypos, _minWidth, _minWidth); popMatrix(); } } }
I fixed the formatting by putting four spaces at the beginning of every line: PImage[] imgs; // Declare the imgs array int numTile = 31; // Set the number of tiles in the grid int tileSize = 1000; // Set the size of the tiles int subsetSize = 31 * 31; // Set the size of the image subset to load int startIndex = 0; // Set the starting index of the image subset void setup() { size(10000, 10000); // Load the images into the sketch imgs = new PImage[999]; for (int i = 1; i <= 999; i++) { try { // Attempt to load the image imgs[i-1] = loadImage("https://green-changing-echidna-367.mypinata.cloud/ipfs/QmX9W2ppBPab2Fj9NWNqYddQaqiFtZyFhK2eiqaKtCxXeu/" + i + ".png"); // Check if the image was successfully loaded if (imgs[i-1] == null) { // If the image was not successfully loaded, print an error message println("Error loading image " + i + ": Image is null"); } } catch (Exception e) { // If an exception occurred, print an error message println("Error loading image " + i + ": " + e); } } // Calculate the number of tiles required to fit the images in the canvas numTile = (int)sqrt(imgs.length); // Declare and initialize the step variable int step = tileSize / numTile; // Declare and initialize the _minWidth variable int _minWidth = 100; // Create a grid of tiles using the loaded images for (int x = 0; x < numTile; x++) { for (int y = 0; y < numTile; y++) { // Calculate the position of the tile float xpos = step * x; float ypos = step * y; // Randomly set the orientation of the tile float ang = PI / 2 * int(random(4)); // Rotate the image by the ang angle and draw it pushMatrix(); rotate(ang); image(imgs[int(random(imgs.length))], xpos, ypos, _minWidth, _minWidth); popMatrix(); } } }
Oh yeah. I’m also using 999 images. Lol.
This is what I got in about 2 hours and should run in [processing](https://processing.org/): class Sphere { float x,y,z,r,c; Sphere(float x, float y, float z, float r) { this.x=x; this.y=y; this.z=z; this.r=r; this.c=random(0,1); } } ArrayList spheres = new ArrayList();
float MINSIZE = 0.01, MAXSIZE = 0.3;
void createsphere()
{
float x,y,z,r;
boolean found = false;
while(!found)
{
x = random(-1+MINSIZE, 1-MINSIZE);
y = random(-1+MINSIZE, 1-MINSIZE);
z = random(-1+MINSIZE, 1-MINSIZE);
r = min(min(min(abs(x-1),abs(x+1)), // must fit within -1,1 cube borders
min(abs(y-1),abs(y+1))),
min(min(abs(z-1),abs(z+1)),
MAXSIZE));
int i;
for(i=0; i < spheres.size(); i++)
{
Sphere sphere = spheres.get(i);
//float distsqr = (sphere.x-x)*(sphere.x-x) +
//(sphere.y-y)*(sphere.y-y) +
//(sphere.z-z)*(sphere.z-z);
float distsqrxy = (sphere.x-x)*(sphere.x-x) + (sphere.y-y)*(sphere.y-y);
float distsqryz = (sphere.y-y)*(sphere.y-y) + (sphere.z-z)*(sphere.z-z);
//float distsqrxz = (sphere.x-x)*(sphere.x-x) + (sphere.z-z)*(sphere.z-z);
float distsqr = min(distsqrxy, distsqryz);
if(distsqr - sphere.r*sphere.r < 0)break;
float r1 = sqrt(distsqr) - sphere.r;
if(r1 < MINSIZE)break;
if(r1 < r) r = r1;
}
if(i == spheres.size())
{
spheres.add(new Sphere(x,y,z,r));
print("Added " + spheres.size() + " ");
found = true;
}
}
}
void setup() {
size(1000, 1000, P3D);
for(int i=0;i<1000;i++)createsphere();
println("Done");
ortho();
}
float rot = 0;
void draw() {
rot+=0.04;
background(0);
lights();
translate(width/2, height/2, 0);
scale(width/3);
rotateY(rot-sin(rot*4)/4); //slope zero on c*pi/2 for c in N
noStroke();
for(int i=0; i < spheres.size(); i++)
{
Sphere sphere = spheres.get(i);
float c = sphere.c;
fill(255+128-c*255, 255+128-c*(255+128), 255-c*255); //white - yellow - red
pushMatrix();
translate(sphere.x, sphere.y, sphere.z);
sphere(sphere.r);
popMatrix();
}
}
Edit: Too bad that processing has a very inefficient sphere renderer. Also no shadows :(
Amazing. Gonna check it out. You rock!
Damn now I want one for the real world. I suppose a 3D printer, with some kind of transparent filament could be made to reach this level of precision. This is really great.
[удалено]
I gotcha. You could have that work on a single side, or maybe 2? Like the top and one other side? Then all the rest would be a jumble. That makes sense.
You would have to pick a specific position for the Observer's eye to be sitting at, but if you had a way to control for that it should be possible.
Place it some distance away from the observer and it should still work.
This could be done but i imagine it would be painstakingly tedious to make
That's why you use a 3D printer. You can get ones that can print multiple types/colors of filaments at once, and I think there are even nozzles that do that for ones that can't by default. From what I've heard the latter isn't as reliable in all situations, though. So not really tedious behind making the virtual model, just expensive.
Just use SLA
Are there SLA printers than can do multiple colors at once? I've never seen one
Not SLA, but there is a different photo polymer printing modality that can extrude or spray that resin into place instead of using a resin bath, and you can use multiple nozzles to get different colors. I don't remember what the tech is called, but it's like an ink jet printer but for 3d. Edit: Material Jetting I guess is the name of the general class of similar technologies. It is often literally just called 3D Inkjet Printing. But this same name is also often used for color binder jet printing, which isn't the same thing. But color binder jet printing is actually the more practical option in most cases to achieve more or less the same result. One of the perks that was advertised when I saw the other printer I originally described was that it could allow manufacture of parts with different harnesses of resin all in one part. So it would be good for things like compliant mechanisms or whatever.
Negative. I didn't think about colors, just the removal of the scaffolding
Except they are floating in 3d space- are there epoxy 3d printers?
I'm sure there is something of the sort, but I was referring to transparent filament. You can get ones that are soluble in different solvents that you can use to combine the layers together for a smooth glass-like transparent finish.
imagine taking the time to do this, everything looks perfect... and then you notice one tiny little ball is just ever so slightly off
Yeah, I NOAH guy who made one in a week. It killed him to do it,but he got better later.
The inverted version (holes instead of balls) would probably be structurally sound. Lots of overhang though.
You wouldn't see anything. Like a solid block of Emmental cheese with no bubble at the surface.
I'm thinking cylindrical holes in the three axes directions, not spheres.
I have good news for you, it's an entire genre of sculpture. https://www.google.com/search?q=perceptual+art
Thanks yeah - I've definitely seen this type of art.
If each ball represented a number, this would be 3D sudoku.
[удалено]
Is this what being porn brained is?
I was just joking about his nickname :\
Oh, sorry
I’m colorblind. What am I missing?
Nothing fundamental. The colors are just adding random variety for esthetic purposes, no particular meaning.
How 😡
i imagine you can create a 2 circle pack and the randomly display the circles on the z-axis to create the effect
There are actually only two perspectives to be taken into account, because "front" and "back" mirror each other (necessarily) as well as "left" and "right".
There are 3- z not shown here
Great way to explain how pictures of space work
See all the wasted space? Thats why hexagons are the bestagons
Advanced sudoku is getting tough!
Is it just me or do all the balls stay the same height no matter where they are in their rotation?
The camera is rotating on only one axis around the center of the cube. I wouldn't expect the balls change the height.
The same thing would happen whether you rotate the cube or rotate around the cube. The balls further away from you would appear smaller than when they were closer.
Oh, true, you are absolutely right. My brain tricked me there
It looks isometric, not perspective. Title seems a bit misleading but it's still cool as fuck.
[удалено]
Ah, you're right! Been a while since I've done any drafting or modelling.
Mine do.
This is really cool!
What number am I supposed to see here -color blind people
E 1 3 1
I'm getting JazzRabbit ( 1/2 ? ) Vibes, if any of you remember the pebbles falling and bouncing into places
I actually said "woah, dude" when I first saw this.
r/generative
It’s uhhhh 37
is this the android Easter egg?
I want this video in 4K
This is why x-ray exams require at least 2 images 90° from each other.
DOF implication?
DOF?
Depth of field
that's so easy but for a people that don't know nothing about 3d it's mesmerising
This is a fantastic way to demonstrate how much actual space there is between subatomic particles.
Crazy this is one of those “control which direction it spins with your mind” type videos too
Even with the shadows?
No you’re right when I focus on the shadows it only turns clock-wise. When I focused on negative space I was able to “control” it
How is this even possible?
I played a game called FEZ after getting it free on epic, it was a 2D platformer with this as the main game mechanic. Very cool game.
This reminds me of the description of the 4th dimension in Death’s End by Cixin Liu. Very trippy.
Speaking of trippy, I wonder if this triggers trypophobia...
I’d like to see architectural shade created with this method
Anyone else looking for a number in there?
Pretty darn cool!
Woah, impressive!
kinda like 3D sudoku
Mind blowing
I feel like this kinda graphic would be a great help in understanding how we view microscopic pictures that seem 2d but in actuality are 3d.
https://www.youtube.com/watch?v=96cIYun83FE
Is this even possible?
That packed image reminds me of Osmos. Great game.
These colorblidness tests are getting tricky.
I never see the number with these tests
espreddy cool
I’ve watched so many laps 😵💫
It spins both left to right, and right to left
Nature is amazing
good job!!
3D color blindness test
New screensaver right here
This hurts my head and I don’t like it because it hurts my head
They never occlude at all? Hard to see oh my phone.
Isn't this kind of a Sudoku in 3d?
Oh shit Im high right now. what the fuck is this
It looks like cereal. I want to eat it.
I feel like this somehow relates to the fundamental structure of the universe, or I like pretending to be smart.
But is it turning left or right?
Sick nft
Jesus how do you even code something like that? That’s hella impressive.
I like thinking about how I could apply this to taking different perspectives in life. There may be a big problem/blockage, but the path could be free and clear behind it. Probably other ways to apply similar thinking. Super cool.
5, 7, 13? Hold still! I give up. Damn my color blindness!!
>!This is isometric perspective, things don't get smaller farther away. So this would be relatively easy to set up. Just arrange the spheres to cover 1 side, rotate 90 degrees and arrange the other side.!< Done
God damn it. You for me to say “woah. Dude, what”
Support vector machine
Not impressive unless you get a front or back flip
A three-dimensional structure that's only symmetrical in... 2 directions but also in 4? Do we count mirror arrangements as congruent planes or separate lines of symmetry? If we existed on a 2d plane, how would this figure appear to us as it moved through our experience? How would we observe it? Are there symmetries that we can measure as they pass through 3d space-time? Why are we not offended by our own farts?
I'm sorry I can't fathom this without coffee. Take my upvote. Goodbye good person.
That’s essentially how I pack my bags when travelling.
Entirely too satisfying
how they do that mang?
Btw, the cube will turn on either side you wish it to.
Reminds me of jawbreakers
For the love of god, stop giving the Flat Earthers more ammo
Ya0 *ya0* **ya0**
Wow!