3D Points

A spot for all things TestTube
Post Reply
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

3D Points

Post by A Random Player »

Icosahedron
Icosahedron
3D Points Icosahedron.png (35.4 KiB) Viewed 9557 times
So one day I realized that 3D polyhedra are fun. But cutting and taping takes forever. So I made a program to simulate them. (also I somewhat gave up on the rocket game for now.)

It's not that complicated yet. So far it has
Add points
Connect points with various distances and strengths (they will pull on each other, and there's a resistance force applied to everything proportional to velocity for friction)
Remove these connections
Move the view around (but not rotate it)
Drag points around
Saving/loading (done!)
Flatten (new!)
Length error (new!)
Displaying distances between points (done!)

I'm planning to add:
Rotating the view (3d angles are complicated!)
Deleting points
Merging points
Maybe:
Changing frictional force
Copy-pasting
Changing masses of particles (the current parameter does nothing)

Since angles are not fixed, you need braces to hold together shapes larger than triangles.
So far I've made a triangle (drawing starts somewhere!), tetrahedron, octahedron, cube (surprisingly difficult since you need twice the edges as normal for bracing), and icosahedron.
I was planning to use this to create a virtual paper model of the hyperbolic plane, since I don't want to tape stuff together.
Last edited by A Random Player on Mon Mar 10, 2014 11:42 am, edited 4 times in total.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: 3D Points

Post by robly18 »

Woah! This is insane! Good luck with that, let me know how it goes!
Convincing people that 0.9999... = 1 since 2012
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: 3D Points

Post by A Random Player »

Done with saving/loading (well, I was already done yesterday), and made keypresses only work if form is in focus. Also added a flatten function (squeezes everything toward X-Y plane)

Edit: Added a "length error" display (shows how far the connections are from the equilibrium) and a distance display for two points.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: 3D Points

Post by testtubegames »

Cool! Are all those points I see scattered around your 'pool' of vertices? Looks like your shape is rising through the air in a stream of bubbles -- neat effect, actually. Also, love the simple way you represent distance.
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: 3D Points

Post by A Random Player »

testtubegames wrote:Cool! Are all those points I see scattered around your 'pool' of vertices? Looks like your shape is rising through the air in a stream of bubbles -- neat effect, actually. Also, love the simple way you represent distance.
Yeah, it's easier to just grab a point from the surrounding pool than clicking the button every time. They don't actually rise like bubbles though :P
The distance is not entirely correct for the points - Their radius is currently proportional to 1/z, but true spheres would appear larger.
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
robly18
Posts: 413
Joined: Tue Jun 04, 2013 2:03 pm

Re: 3D Points

Post by robly18 »

A Random Player wrote:
testtubegames wrote:Cool! Are all those points I see scattered around your 'pool' of vertices? Looks like your shape is rising through the air in a stream of bubbles -- neat effect, actually. Also, love the simple way you represent distance.
Yeah, it's easier to just grab a point from the surrounding pool than clicking the button every time. They don't actually rise like bubbles though :P
The distance is not entirely correct for the points - Their radius is currently proportional to 1/z, but true spheres would appear larger.
Wouldn't the real radius be... I'll be honest, trig is something I haven't learned yet. Still, I think it would be something along the lines of arctan(z) ?
Convincing people that 0.9999... = 1 since 2012
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: 3D Points

Post by testtubegames »

A Random Player wrote:The distance is not entirely correct for the points - Their radius is currently proportional to 1/z, but true spheres would appear larger.
Huh. Got me thinking -- and I jotted down a little diagram. By my reckoning you are more right than you think. (Or maybe it depends on your projection scheme? I'm no expert, so feel free to enlighten me)

My back of the envelope figure--
quickJot.png
quickJot.png (7.05 KiB) Viewed 9539 times
On the left is your eye, the far right is the 'sphere' in 3D space, and in between is the 2D screen where you're drawing it. They'll trace out similar triangles, which means that r/d = r'/d'. Or that r' = c/d, where c is just some constant of your choosing. So the radius on screen should indeed go as 1/z (at least if your 'z' is considered the distance from the viewer, I suppose.)

Does that make sense, or am I missing something?
A Random Player
Posts: 523
Joined: Mon Jun 03, 2013 4:54 pm

Re: 3D Points

Post by A Random Player »

testtubegames wrote:
A Random Player wrote:The distance is not entirely correct for the points - Their radius is currently proportional to 1/z, but true spheres would appear larger.
Huh. Got me thinking -- and I jotted down a little diagram. By my reckoning you are more right than you think. (Or maybe it depends on your projection scheme? I'm no expert, so feel free to enlighten me)

My back of the envelope figure--
The attachment quickJot.png is no longer available
On the left is your eye, the far right is the 'sphere' in 3D space, and in between is the 2D screen where you're drawing it. They'll trace out similar triangles, which means that r/d = r'/d'. Or that r' = c/d, where c is just some constant of your choosing. So the radius on screen should indeed go as 1/z (at least if your 'z' is considered the distance from the viewer, I suppose.)

Does that make sense, or am I missing something?
Ah, but that assumes that the sphere is a 2d circle perpendicular to your line of vision.
Back of the Microsoft Paint canvas sketch
Back of the Microsoft Paint canvas sketch
Perspective Sketch.png (4.14 KiB) Viewed 9536 times
Example: You look down at the (idealized) earth as a flea (with an eye basically on the surface). It looks infinite to you. If it were a circle centered at the earth's center, you would see it as a disk below you.

Edit: Here's a better version.
Back of the Microsoft Paint canvas sketch 2
Back of the Microsoft Paint canvas sketch 2
Perspective Sketch 2.png (6.8 KiB) Viewed 9536 times
$1 = 100¢ = (10¢)^2 = ($0.10)^2 = $0.01 = 1¢ [1]
Always check your units or you will have no money!
User avatar
testtubegames
Site Admin
Posts: 1148
Joined: Mon Nov 19, 2012 7:54 pm

Re: 3D Points

Post by testtubegames »

A Random Player wrote:Ah, but that assumes that the sphere is a 2d circle perpendicular to your line of vision.
Ah, sure, of course! Good call. Gotta remember that computer screens are flat (... for now? ;))
Post Reply