Skip to content

i1abnrk/WaxyGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##About Author: Zakri M. Kneebone
License: CC BY-NC 3.0 (see http://creativecommons.org/licenses/by-nc/3.0/) (see additional warnings below)
Project: WaxyGenerator (waxy.js)
Purpose: A 3D fractal terrain generator designed to look like a melted wax sculpture and to the plan is to interface it with the voxel.js package. (http://github.com/maxogden/voxeljs/)

#Classes
Classes: Point, ConnectedPoint, BoundingBox, BoxIterator, MapProperty, MapData, DropSheet, WaxyGenerator

Point: a wrapper class for an x,y,z triple. Constructor takes arguments {x,y,z}, noargs produces Point(0,0,0). Method translate returns a new Point instance that is the specified x,y,z distance away from the current instance. For a Point p1 at (1,-2,-3) a call to p1.translate({x:4,y:-5,z:6}) returns a new Point p2 with coordinates {x:5,y:-7,z:3}

ConnectedPoint: a Point with reference to 6 neighbors: below, north, south, east, west and above. An array of all 6 (and not center) is returned with the facets property, respective of that order. The original Point is the center property of a ConnectedPoint instance.

BoundingBox: a rectangular prism defined by two corners: lowerBound and upperBound. lowerBound and upperBound are both instances of Point, having x,y,z. Constructor takes these two Points as an array. Size methods are available for width (x-axis), height (y-axis) and depth (z-axis). There are two set logic methods: contains and intersects. contains returns true if all of the Points in parameter other are within the instance. intersects returns true if some or all of the parameter lies within bounds of the instance. The method iterator returns an instance of BoxIterator for iterating over the bounds of the instance it is called from.

BoxIterator: an Iterator starting at lowerBound and proceeding through each integer point until upperBound. It has two methods, hasNext() and next(). hasNext() returns true if next() has not yet returned the Point defined by the upperBound property of the parameter passed to constructor.

MapProperty: a property common to all Points in the BoundingBox of a MapData instance. Each MapProperty has three elements: key (a String name), type (a javascript primitive type. Not implemented.), and defaultValue (the value set for each x,y,z,property on initialization).

MapData: an in-memory storage for map property values. Use the function map() to get values and use property data[] to set values. Constructor takes two arguments: workingSet and properties where workingSet is an instance of BoundingBox and properties is an array of MapProperty instances. Property propKeys is an array of property key strings used as the 4th dimension of the data array.

WaxyGenerator: generate is the main loop. Properties are many and changing too fast to document, see the code for details.

##Design notes: each spot has a temperature, the hotter it is, the less sticky it is.
each drop has a high initial temperature
the drop will heat up or cool down on contact with a spot
each spot has six neighbors, (above, below, north, south, east, west)
the temperature of a spot is the mean temperature of the neighbors and itself an empty spot has a temperature of freezing
if the drop is above freezing it will randomly move to an empty neighbor
if the drop hits the floor (y===0) it will freeze instantly
if a drop freezes it will fall until a not empty spot is below it
a drop will move below 90%, nsew 9% (2.25% each), above (1%) while it is hot
constructed in a way that each property has its own map

NOUNS: spot, temperature, drop, high initial temperature, six neighbors (north, south, east, west, above, below), itself mean temperature of neighbors, empty neighbor, floor

VERBS: has a temperature, is hot, is sticky, heat up or cool down on contact, has neighbors, randomly move to an empty neighbor, freeze instantly

SPOT: temperature, six neighbors, empty, self

DROP: initial temperature, current temperature, current age, current spot

FLOOR: z=0, temperature = FREEZING

##Related research
thermal conductivity of air = 0.024 k - W/m*K (Watts per meter-degree kelvin) Diatomaceous earth (Sil-o-cel) 0.06
Paraffin Wax 0.25
http://www.engineeringtoolbox.com/thermal-conductivity-d_429.html

##Warnings Disclaimer: This program is distributed without any implied warranty or fitness for any particular use. It is experimental and as such it may break your computer equipment or cause other consequential damages. Using this software means you accept this risk as your personal responsibility. If you are unable to accept this risk you are not allowed to use this program.

Resource hog: this algorithm requires about 25GBh of processing time per million Points of BoundingBox space. You may want to increase the heap size of your interpreter. I like to use a setting of 4096K.

About

A terrain generator in javascript that uses a simulated annealing algorithm.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published