Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Snowflake code

Author
Message
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Oct 2009 18:10 Edited at: 21st Oct 2009 18:15
This is probably a strange question, but would anyone on here know how to write a 3D snowflake generator. The math's is extremely complex for me, and as for creating vectors, I have no idea.

And I mean real physics, not just a photoshop image.

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 21st Oct 2009 20:09
The actual snowflakes? Like to the extent that none are the same? Or just snow falling in general?

I have no idea to be honest, I don't even know how to make a line in 3D space - you could use a tiny cylinder but with DB's built in primitives that would be so high-poly and so inefficient that you'd be getting an appalling speed.

What do snowflakes actually look like? Are they as symmetrical as they look in pictures or are they completely random in every way?

"A West Texas girl, just like me"
-Bush
TheComet
16
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 21st Oct 2009 22:34
Quote: "What do snowflakes actually look like? Are they as symmetrical as they look in pictures or are they completely random in every way?"


If you go down to the atomic level, it is PERFECTLY symmetrical. Nothing can be 100%, but it is the closest you can get to perfection.

What pincho wants is an algorithm for creating a 3D snowflake. If I were you, I'd start with a 2D snowflake. A 2D snowflake has six spikes, and on every spike there are another four spikes, and on those there are another four spikes and so on. (I think). But to do this in 3 dimension is going to be quite hard. By using sinus and cosinus commands, you can rotate and convert a 2D algorithm into a 3D algorithm.

Anyway, I am quite clueless, so I am not able to help you. This goes into 3D fractals, right?

TheComet


Make the paths of your enemies easier with WaypointPro!
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 21st Oct 2009 22:36 Edited at: 21st Oct 2009 22:39
They follow a set of rules, but the X/Y/Z can change through varying temperatures. I don't really care if it is 100% accurate, so long as it creates the proper form that can established by real snowflakes. They are not 100% random, they all look similar at similar temperatures.

I think that fractals just look a bit like snowflakes, but not really all that much. Maybe there is a way to get them to work.. not sure.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Oct 2009 00:44
This sounds like a good challenge idea
I wont promise anything but I've done some procedural stuff before so I'll give it a go.

TGC Forum - converting error messages into sarcasm since 2002.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Oct 2009 00:57
Great thanks!

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Oct 2009 21:29
I've got something, it took ages to work out and I still don't think it looks like a natural snowflake but here it is.


I hope I typed it correctly. It took me several hours of number poking to get to this stage (my knowledge of angles and transforming is not very good). See if you can make the drawing better.

TGC Forum - converting error messages into sarcasm since 2002.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 22nd Oct 2009 23:14
Snowflakes are fractals. I'm sure there is lots of info on the net on generating snowflakes just the way that crystals form into snowflakes in real life.

http://www.schools.manatee.k12.fl.us/boehm/snowflakecurve/snowflake_fractal_lesson_plan.html

TDK

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 22nd Oct 2009 23:22
Thanks, that's pretty good. Doing some physics. Now I need to work on gravity as well. That might be easier.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 23rd Oct 2009 01:53
Oh apparently mine is a koch snowflake haha, I just made up the algorithm myself, didn't think of removing the lines though.
I also don't understand why there are fractals on the lower third of each side, the rules only seem to deal with the mid section of each side.

TGC Forum - converting error messages into sarcasm since 2002.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Oct 2009 02:09 Edited at: 23rd Oct 2009 02:21
I'm trying to learn vectors at the moment using Philip's tutorial. Do I just draw a line using the vectors results? Could you do a quick hexagon with vectors, and lines for me so that I can try to stretch the hexagon in different directions? I've never tried vectors before.

Oh, and do lines have a thickness, I'd like to make the outlines thicker. I think in theory, I can make nearly any shape by stretching hexagons. From snowflakes, to humans. Just by using gravity, and atoms. It could be very interesting if it works. For example.. I am hoping that a stickman becomes more lifelike around its edges. Or two dots for eyes suddenly become eye sockets.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 23rd Oct 2009 02:21
If you search for OBese87's Code Bonanza
the file I uploaded has a function that will draw any-sided regular shapes, I think that is vectors, might be of use to you.
You can't skew the shapes but maybe weighting the sin and cos would produce a skew.

TGC Forum - converting error messages into sarcasm since 2002.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Oct 2009 02:24
Thanks... downloading now.

Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Oct 2009 02:36 Edited at: 23rd Oct 2009 02:38
Ok I started using it to make a hexagon grid. Somehow I am not getting symmetry. This is just an early test, but where is the symmetry going wrong?.....



EDIT: Oh never mind, due to pixels you have to use odd numbers.. just realised.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 23rd Oct 2009 02:39
It might be because I used integers for positioning etc.

TGC Forum - converting error messages into sarcasm since 2002.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 23rd Oct 2009 02:46 Edited at: 23rd Oct 2009 02:46
Yes thanks. I might be able to get it to work. Not sure. Might need actual vector code.

Login to post a reply

Server time is: 2024-05-04 02:41:10
Your offset time is: 2024-05-04 02:41:10