Monday, July 21, 2014

I don't really have a title here, but I was on a roll somewhere.

I am somewhere on the net defending the notion that Nazi Christianity isn't really that strange in the grand scheme of things.



The Gnostics are a very early heretical branch (in this context meaning only that they didn't win) even pre-Trinitarian. They make up about 0% of Modern Christian thought. And while a lot of the early groups did actually vote as to whether to keep the OT or not (with some outright rejecting it), it was generally accepted by the winning branch which became the Catholic Church and then the Catholic and Orthodox church and later gave rise to the Protestant groups.

The better example would be the many groups of real Christians who argue that Jesus fulfilled the law and that with Jesus the law was super-seceded and no longer needed. Though these individuals cite Paul who apparently was, according to Nazi theology, a horrible snake who corrupted Jesus' true stance against the Jewery. And, as it turns out they simply didn't. They accepted the OT.

I have heard that they invented a pseudohistory by which modern Jews are not ancient Jews. Though, I don't have a reliable source for that. And they certainly did that for Jesus, by accepted the whole 'bin Panthera' story that was made up and written into the Talmud and repeated in some pagan sources (Jesus was the kid of a Roman Legionnaire, not born of a virgin!) The Nazis took that as true and said, see he was a member of the Master Race.

They didn't reject the OT.

Hitler for example in the Table Talks compared himself quite favorably with Moses.

(February 1942)

"I have never found pleasure in maltreating others, even if I know it isn't possible to maintain oneself in the world without force. Life is granted only to those who fight the hardest. It is the law of life: Defend yourself! "
    "The time in which we live has the appearance of the collapse of this idea. It can still take 100 or 200 years. I am sorry that, like Moses, I can only see the Promised Land from a distance."

A side note, of importance, for a variety of reasons (mostly due to a French conman) this is translated in the only full English version of the Table Talks(Roper) as:

 "Our epoch will certainly see the end of the disease of Christianity."

Which any check to the actual German would dispossess that notion.


But, they also used the OT as an example of good laws, namely laws based on race:

"I have written such articles again and again; and in my articles I have repeatedly emphasized the fact that the Jews should serve as an example to every race, for they created the racial law for themselves-- the law of Moses, which says, "If you come into a foreign land you shall not take unto yourself foreign women." And that, Gentlemen, is of tremendous importance in judging the Nuremberg Laws.. These laws of the Jews were taken as a model for these laws. When after centuries, the Jewish lawgiver Ezra demonstrated that notwithstanding many Jews had married non-Jewish women, these marriages were dissolved. That was the beginning of Jewry which, because it introduced these racial laws, has survived throughout the centuries, while all other races and civilizations have perished." --Julius Streicher (Trial of The Major War Criminals Before the International Military Tribunal, Nuremberg, 1945, Vol. 12)

The point is, while it seems really odd, it's not actually outside the even pretty narrow band of Christian thought of straight forward Protestantism. Without needed to go back to Arianism or Marcion or any of the heretics, which I would actually have to agree deviate pretty markedly from the Christianity that survived the Dark Ages.

Sunday, July 6, 2014

The theological baggage of Christianity.

The story is a near east creation story. It's intended to explain where we come from, why snakes don't have legs, why human childbirth is so painful, why we know right from wrong. God tells them they will die if they eat the fruit, the serpent says that they won't die, they eat the fruit, they don't die, God finds them and punishes Adam with working the land and eating bread, Woman with painful childbirth and being controlled by men, and the serpent with having no legs, eating dust, and not getting along with people. Then to protect the other magical tree and letting Adam and Eve become fully like the gods (apparently Godhood is simply knowing right from wrong and immortality) he kicks them out and makes a magical fire sword to protect the place.

There's no other theological significance or anything. All the extra eisegesis comes later. The original tale is a creation story in line with Native American stories, "How the Bear Lost its Tail". All cultures have these.

And while it does give rise to the whole fall of man thing, and later the whole Son of God/God sacrifices Himself to Himself to create a loophole in his own system. Because religions keep their baggage. In Genesis being a god is knowing right from wrong and living forever. For fear of them becoming gods they were kicked out etc. Then there's the weird immoral idea that the sins of the father are the sins of the children, hence why Adam and Eve's sin of doing something (which they by definition didn't know was wrong) is passed to all humanity. And because sacrificing animals to forgive sins, what better sacrifice could there be but the sacrifice of a Demigod? Hebrews 9 says almost exactly this. The religion ends up with God sacrificing Himself to Himself (as later Trinitarianism took over and Jesus was said to be one with the father). So each step tends to leave baggage and make it all weirder.

So because of this story with magical trees and talking snakes, mankind is doomed, so to solve this God gives himself a body and kills it. Because only God's own blood had enough magic to allow all-powerful God to create a loophole in his own system. So now, if you accept the story, preferably without questioning it, you can avoid God's first horrible everybody falls short system, and just through God's sacrifice of His blood to Himself, skip that system. So Mahatma Gandhi is burning in hell, because he was Hindu, but Jeffery Dahmer should like his odds because he accepted Jesus and was baptized shortly before his cellmate beat him to death. -- This system is pockmarked with bizarre theological history and crafted towards propagation rather than anything approaching a coherent way of running the universe.

Friday, July 4, 2014

What is the relationship between people believing a claim and its veracity?

When asked to properly evaluate the likelihood of the Loch Ness monster one really can agree that it doesn't exist, but if you put the likelihood at actual zero rather than a number infinitesimally close thereto, you are being a bad skeptic.

If people state things as true and they are true 60% of the time, then we are correct to say there's a positive correlation there. Even according them a very wide wrong margin of 40% (especially considering things they assert are stuff like their names, whether they have pets, how they are doing, where such and such a person is). I am giving a very very wide margin of error, and even given a true/false set of facts guessing could only ever be 50%.

It holds accurate that people tend to be right more often than you would be right, if you were pulling answers at random. Especially in science where refinement and self-checking really gets the answers well into at least the 90%s of being correct.

I'm not looking at the world in rose colored glasses. I'm a skeptic, I do my best to see the world as it actually is. I think that "trust but verify" is a fantastic methodology for having the most true beliefs and the fewest false beliefs. That one can create a robust and functional epistemology. I am not saying, everything people say is true. I'm saying since things people say are more likely to be true than false, it holds that there is a positive correlation between what people believe and what are true facts about the world.

"How does the number of believers have any bearing on the veracity of the claim?"

And the answer is by being positively correlated. There's a number of good and proper responses to the supposing God exists because theists exists. Most people tend to believe in mutually exclusive gods. If everybody believed in unicorns but everybody disagreed as to what color all of them were, it would not what we'd expect of a true belief. Generally people believe in the sun exists, but there's very little disagreement as to what color it appears to be. Equally there are not demonstrated gods. Most people seem to believe chairs exists, and claim that chairs exists. When asked how they know, they will quite often point to a chair. With regard to gods they seem to insist it's impossible to demonstrate, which is an unusually characteristic for things that actually exist.

When I say I have a pet gecko, you would be correct to accept my claim tentatively. When I say I have a pet dragon, you would error to accept my claim, even tentatively. If I said that by "dragon" I mean komodo dragon, my claim becomes astronomically more reasonable, but you would still error to tentatively accept my claim as they are rare, endangered, illegal to own, and highly dangerous.

When you say you have a friend named Bob, and he's a dietitian, that would be a perfectly reasonable claim. When you say you have a friend named Bob, and he's a deity whose created the universe and is magically undetectable, everybody's bullshit detector should go off. The fact that the majority of people think this is true, does very little to dilute the absurdity of notion.

While it the better than average chance that what people say is true suffices to establish that what people tend to think tends (better than random) to be true, that meager amount of evidence is resoundingly rendered moot when you say things as absurd as religion.

If somebody tells you they are a Christian, they are generally going to be telling the truth, and you would do well to believe them. If somebody tells you that Christianity is true, you would do well to not.

Because the saying of things is good enough for trivial claims, but if you want to convince somebody that the creator of the entire universe donned a baby suit so that he could sacrifice Himself to Himself to give Himself permission to forgive His creation for their ancestors sins of eating magical fruit on the advice of a talking reptile, by utilizing His blood in some fashion to create a loophole in His own system, and through His perfect justice damn Mahatma Gandhi to eternal hell-fire for the evil of not believing this claptrap. You need more than words.

Saying something is true is evidence. And for minor claims it's often sufficient evidence for a claim. The problem here is that a billion people believing a lie cannot render it true. There are vastly more cases of a billion people being wrong about something than there are of some religion's creation myth being true, and their deities being real, or for magic.

What is the relationship between a great many people believing a claim and the veracity of that claim. The answer is they share a positive correlation (which means it's evidence). If asked whether that suffices to justify even one miracle, the answer is definitively no.

Friday, June 6, 2014

My New Position Based Color Quantization Algorithm.


pool
491×369
4



Original: 37,671 bytes




ScolorQ: 7,755 bytes




Photoshop: 7,640 bytes



The pictures are hotlinked from scolorq.
http://www.cs.berkeley.edu/~dcoetzee/downloads/scolorq/


And finally my algorithm at 4 colors.























The truth is oddly, that my algorithm is crap for color picking. I'm not very good at it yet. And need a few more things to really make it pop. Here's the SColorQ colors with my positional color dither.


























My thing can't even pick colors and it's better. Or at least has some noted advantages.


Slightly different settings for the dilthering.























And yet a different setting... Which is pretty insane in and of itself.






















Which turns out to be rather cool as an effect. Cooler when you realize that it salvages a lot of the depth of the gradient and such that was otherwise lost at an expense of becoming insane.





To really mess with your head. Here it is, not even color quantized. I fed it raw CYMK (Cyan, Yellow, Magenta, Black).


























Not messed with enough. Here's KCYM. The exact same color except I changed the order. (Yes. The order!)


























Keep in mind. This isn't even quantized. This is just rendering the picture in Cyan, Magenta, Yellow and Black.


Getting rid of the order requirement and making it a total free for all, this is *still* 4 colors. And not even quantized. Just CYMK.






















Here is RGBWCYMK so all the 8 combinations of solid colors.



And bringing it back full circle, here's ScolorQ's 4 colors with my dither, sans ordering and pareto-optimal.

Saturday, May 24, 2014

Unimpressive/Unimpressive Code


    public static boolean permutation(List values, int index) {
        return permutation(values, values.size() - 1, index);
    }

    private static boolean permutation(List values, int n, int index) {
        if ((index == 0) || (n == 0)) {
            return (index == 0);
        }
        Collections.swap(values, n, n - (index % n));
        return permutation(values, n - 1, index / n);
    }

Give it a list, and an index and it will do the permutatation associated with that index. It runs out of integers at 12 items as 12! > Integer.MAX_VALUE

Sunday, May 4, 2014

Why the Singularity is bullshit.

I've done a lot of thinking on the issue. After I solved a few of the theoretical problems, and I've got to say, it's really kind of silly. The claim that AI could improve its design and then cause a runaway explosion of intelligence is quite simply wrong. In fact, the entire idea of the singularity is based on a wrong notion of what intelligence is and how it functions. Which really should be something people should have figured out at square one before moving on and pontificating. But, it wasn't like any of the AI programs were doing anything, and you might as well use that time to daydream about it.

Intelligence takes real work. You don't just have it. You build your brain with what patterns you see and recognize, which means you need to be exposed to them and experience things, and test things within actual reality rather than trying to do physics in one's own head. Intelligence is a bit like the scientific method being automatically implemented on 3 pounds of neurons.

There is no such thing as a free lunch. 

You can't make the scientific method work twenty times as fast if you use a bunch of science to improve the scientific method. You cannot use to do the real intellectual work of understanding things, predicting them, knowing the underlying patterns, to improve the actual work it takes to do that. Just as doubling a functioning AI's computer processor wouldn't make it twice as smart. Just as making a human exist for two seconds for every second wouldn't make her smarter, it would simply allow her to get to the same wrong answer in half the time and not be one iota more intelligent (it would make her an unstoppable devil with a pointed stick though).

Sunday, April 27, 2014

Don't respect my beliefs for no reason.

You should not respect my belief that given any mysterious occurrence I will believe that it isn't magical or supernatural but rather natural phenomenon acting in a previously unknown way. It earns that respect by thus far in the history of mysteries being correct 100% of the time thus far. Your belief that a cosmic superman poofed everything into existence and then had to fix it later on by donning a human suit and sacrificing himself to himself, equally should not unquestioning get respect but be evaluated according to it's actual likelihood of being true.

The claim that 'I respect your beliefs, you are are being cruel by not respecting mine' is a red herring. It's patronizing and disrespectful to me. It's saying you think I would prefer to walk around believing false notions being coddled and unquestioned, more than I would want a small amount of discomfort learning that one of my beliefs is actually false and then being able to correct the notion. -- It's insulting to me to suppose I would prefer the former to the later.

Tuesday, April 22, 2014

Turned off Anon posting.

I got too annoyed with the spam. It was getting all auto filtered but it emailed me about the spam it was filtering off.

Wednesday, April 16, 2014

Hitler Table Talks

So the whole Hitler as a Christian thing came up again, and so I dug around for the original German hoping for the google to save me. And Der Spiegel did publish some of them piecemeal in 1980, and digitized the collection. Of which the major one talking about Christianity is:

http://www.spiegel.de/spiegel/print/d-14317956.html


Only under the effects of the Germanic spirit has gradually lost his Christianity openly Bolshevik character; it has become fairly portable. While it dies, the Jew will again start with the early Christianity, Bolshevism.
One has the high level of Roman art and culture in temples such as flats compare with what brought the Bolshevik underworld back in the catacombs as a new Christian culture. At that time, destroying all the libraries, and today we see in Russia the same: a depression on a very low, all the same level.
At that time and until the Middle Ages, the most terrible tortures, tortures and burns in the name of Christianity, and today the same in the name of Bolshevism. From the Saul a Paul from the Mordechai was a Karl Marx.
If we eradicate this pest, we accomplish a deed for humanity, our men out there still can do no idea of their meaning.



Is traditionally held to say, via the Trever Roper translations via the French conman guy.


 In the old days, as now, destruction of art and civilisation.
The Bolsheviks of their day, what didn't they destroy in Rome,
in Greece and elsewhere? They've behaved in the same way
amongst us and in Russia.
One must compare the art and civilisation of the Romans —
their temples, their houses — with the art and civilisation repre-
sented at the same period by the abject rabble of the catacombs.
In the old days, the destruction of the libraries. Isn't that what
happened in Russia? The result: a frightful levelling-down.
Didn't the world see, carried on right into the Middle Ages,
the same old system of martyrs, tortures, faggots? Of old, it was
in the name of Christianity. To-day, it's in the name of
Bolshevism.
Yesterday, the instigator was Saul: the instigator to-day,
Mardochai.
Saul has changed into St. Paul, and Mardochai into Karl Marx.
By exterminating this pest, we shall do humanity a service of
which our soldiers can have no idea.


The latter seems to suppose that Christianity should be exterminated. The more proper version says the Bulshevik corruption of Christianity should be.

Saturday, February 22, 2014

Why insects are stupid, but seem pretty smart. Evolution And Intelligence

The error with thinking that some life forms are intelligent when they are basically rather simple automatons is the underlying intelligence of our brains is an evolutionary algorithm in and of itself. So the products of evolution always look intelligent. But, that's not because they are, but because intelligence is similarly an evolutionary process carried out within our brains.

It's why the design of highly evolved structures look intelligent. Because intelligence is a type of evolution carried out within neurons rewiring the best predictive pathways in the brain. In short that's the reason behind the flaw in the design argument.

It isn't that the supposed intelligence behind nature is real and evolution is therefore fake. But, the intelligence in our heads is a form of evolution and the evolution in nature looks very similar. Not because it's an illusion, as many wrongly argue, but because they are similar. They are doing the same thing. But, not "being intelligent" but "being evolved."

I've wanted to write a book on that little insight for a while now. But, it explains why people think intelligent design feels so intuitive. -- Because it is, and for deep reasons.

Evolution is well understood and highly established. Intelligence is nebulous and generally vague at best and hugely unknown. Saying intelligence explains evolution, takes absolutely robust science and throws it down a rabbit hole. Saying evolution explains intelligence, takes a rabbit hole and gives it some substance and explanation.

The truth behind the design argument is that it really does look designed. It looks like something very intelligent made it work just like that, knowing all this stuff about how things work and engineering. And it's not an illusion, it's a category mistake. It evolved, but that's how intelligence works to, so saying the causes seem similar is obviously accurate but not because intelligence is behind nature. But, because nature is behind intelligence.

The universal acid flows down hill, not up.

Tuesday, February 18, 2014

I updated my Field Diamond Squared Algorithm Demo.

http://tatarize.nfshost.com/FieldDiamondSquare.htm

Much more drag the background, see the infinite. Also, fixed a few errors I made when I made it to just produce a static one off rather than the full implementation.

Monday, February 17, 2014

Pulled out of thin error.

I'm going to start using this all the time rather than the "air" version.

6 links found on google.

Wednesday, December 25, 2013

Saturday, November 30, 2013

Kmeans++ Color Quantization seeding.

So I was checking through a few color quantization algorithms and read the procedures needed for the Kmeans++ algorithm which is just Kmeans but it is initially seeded by finding maximally distinct colors from all previous color entries. And I was like hey, I totally already solved that problem!


In fact, I made a color dictionary of maximally distinct colors from all previous colors so to do the whole color quantization routine with an optimized initial seed, I can just feed it N digits of my lookup table that basically fits the gamut perfectly.

private static final String[] indexcolors = new String[]{
        "#000000", "#FFFF00", "#1CE6FF", "#FF34FF", "#FF4A46", "#008941", "#006FA6", "#A30059",
        "#FFDBE5", "#7A4900", "#0000A6", "#63FFAC", "#B79762", "#004D43", "#8FB0FF", "#997D87",
        "#5A0007", "#809693", "#FEFFE6", "#1B4400", "#4FC601", "#3B5DFF", "#4A3B53", "#FF2F80",
        "#61615A", "#BA0900", "#6B7900", "#00C2A0", "#FFAA92", "#FF90C9", "#B903AA", "#D16100",
        "#DDEFFF", "#000035", "#7B4F4B", "#A1C299", "#300018", "#0AA6D8", "#013349", "#00846F",
        "#372101", "#FFB500", "#C2FFED", "#A079BF", "#CC0744", "#C0B9B2", "#C2FF99", "#001E09",
        "#00489C", "#6F0062", "#0CBD66", "#EEC3FF", "#456D75", "#B77B68", "#7A87A1", "#788D66",
        "#885578", "#FAD09F", "#FF8A9A", "#D157A0", "#BEC459", "#456648", "#0086ED", "#886F4C",
        
        "#34362D", "#B4A8BD", "#00A6AA", "#452C2C", "#636375", "#A3C8C9", "#FF913F", "#938A81",
        "#575329", "#00FECF", "#B05B6F", "#8CD0FF", "#3B9700", "#04F757", "#C8A1A1", "#1E6E00",
        "#7900D7", "#A77500", "#6367A9", "#A05837", "#6B002C", "#772600", "#D790FF", "#9B9700",
        "#549E79", "#FFF69F", "#201625", "#72418F", "#BC23FF", "#99ADC0", "#3A2465", "#922329",
        "#5B4534", "#FDE8DC", "#404E55", "#0089A3", "#CB7E98", "#A4E804", "#324E72", "#6A3A4C",
        "#83AB58", "#001C1E", "#D1F7CE", "#004B28", "#C8D0F6", "#A3A489", "#806C66", "#222800",
        "#BF5650", "#E83000", "#66796D", "#DA007C", "#FF1A59", "#8ADBB4", "#1E0200", "#5B4E51",
        "#C895C5", "#320033", "#FF6832", "#66E1D3", "#CFCDAC", "#D0AC94", "#7ED379", "#012C58",
        
        "#7A7BFF", "#D68E01", "#353339", "#78AFA1", "#FEB2C6", "#75797C", "#837393", "#943A4D",
        "#B5F4FF", "#D2DCD5", "#9556BD", "#6A714A", "#001325", "#02525F", "#0AA3F7", "#E98176",
        "#DBD5DD", "#5EBCD1", "#3D4F44", "#7E6405", "#02684E", "#962B75", "#8D8546", "#9695C5",
        "#E773CE", "#D86A78", "#3E89BE", "#CA834E", "#518A87", "#5B113C", "#55813B", "#E704C4",
        "#00005F", "#A97399", "#4B8160", "#59738A", "#FF5DA7", "#F7C9BF", "#643127", "#513A01",
        "#6B94AA", "#51A058", "#A45B02", "#1D1702", "#E20027", "#E7AB63", "#4C6001", "#9C6966",
        "#64547B", "#97979E", "#006A66", "#391406", "#F4D749", "#0045D2", "#006C31", "#DDB6D0",
        "#7C6571", "#9FB2A4", "#00D891", "#15A08A", "#BC65E9", "#FFFFFE", "#C6DC99", "#203B3C",

        "#671190", "#6B3A64", "#F5E1FF", "#FFA0F2", "#CCAA35", "#374527", "#8BB400", "#797868",
        "#C6005A", "#3B000A", "#C86240", "#29607C", "#402334", "#7D5A44", "#CCB87C", "#B88183",
        "#AA5199", "#B5D6C3", "#A38469", "#9F94F0", "#A74571", "#B894A6", "#71BB8C", "#00B433",
        "#789EC9", "#6D80BA", "#953F00", "#5EFF03", "#E4FFFC", "#1BE177", "#BCB1E5", "#76912F",
        "#003109", "#0060CD", "#D20096", "#895563", "#29201D", "#5B3213", "#A76F42", "#89412E",
        "#1A3A2A", "#494B5A", "#A88C85", "#F4ABAA", "#A3F3AB", "#00C6C8", "#EA8B66", "#958A9F",
        "#BDC9D2", "#9FA064", "#BE4700", "#658188", "#83A485", "#453C23", "#47675D", "#3A3F00",
        "#061203", "#DFFB71", "#868E7E", "#98D058", "#6C8F7D", "#D7BFC2", "#3C3E6E", "#D83D66",
        
        "#2F5D9B", "#6C5E46", "#D25B88", "#5B656C", "#00B57F", "#545C46", "#866097", "#365D25",
        "#252F99", "#00CCFF", "#674E60", "#FC009C", "#92896B"
    };

Wednesday, November 20, 2013

The Joys of the Hookah

(I don't smoke but digitizing this)

THE JOYS OF THE HOOKAH*.

Though some may smoke segar, cheroot,
Or others' taste a pipe may suit,
They can't with thee the palm dispute,
                                             My Hookah.
When oft in boats I've been confin'd,
And ev'ry festive scene resigned,
Thou hast consol'd my drooping mind,
                                             My Hookah.
Whilst slow the pinnace seem'd to glide,
Along the Gunga's barren side,
What pleasing comfort thou supplied,
                                             My Hookah.
And when for weeks no change I've seen,
No fertile banks or meadows green,
With thee I've ne'er dejected been,
                                             My Hookah.
In gloomy jungles, where, alas!
No friend was near to quaff the glass,
Still did the hours contented pass,
                                             My Hookah.
And if the season bred disease,
From stagnant jeels or wither'd trees,
They smoke dispell'd the noxious breeze,
                                             My Hookah.
Expos'd to Sol's meridian power,
Or delug'd by the pelting shower,
Thou cheer'dst me in the gloomy hour,
                                             My Hookah.
In camps where oft untimely fell,
The valiant youth by fever's spell,
They fumes for ever kept me well,
                                             My Hookah.
From lengthen'd march the foe to meet,
Assail'd by thirst, expos'd to heat,
The conflict gain'd! I'd joyful greet
                                             My Hookah.
By arduous duty now deprest,
My strength exhausted, still no rest,
To me though then wert doubly blest,
                                             My Hookah.
Then as I sat beneath a tree,
If shade there haply chanc'd to be,
I seiz'd thy snake with extasy,
                                             My Hookah.
And now with evils still more trying,
To grieve for friends, departed, dying,
Alas! I often smok'd thee sighing,
                                             My Hookah.
The heart which can refuse a tear
For those who fall in war's career,
Can ne'er deserve thy envy'd cheer,
                                             My Hookah.
And if by chance in party dining,
Where conversation see'd declining,
I never thought of once repining,
                                             My Hookah.
But if that silence should be broke,
I did as others did, I spoke,
And then resumed thy snake to smoke,
                                             My Hookah.
Should lovely women deign partake,
A whiff or two for smoking's sake,
What odour would it give thy snake,
                                             My Hookah.
Not nectar would I wish to sip,
Allow'd that blest Munall to grip,
Which has been press'd by woman's lip,
                                             My Hookah.
If Hookahs can such pleasure give,
And smokers can such joys recieve,
Oh! let me smoke thee while I live,
                                             My Hookah.

Notes:
Verse
1st, "Cheroot," an Eastern name for segar.
3d, "Gunga." the native appellation for the Ganges,
5th, "Jungle", thick forests.
6th, "Jeel," large pools formed by the rains; and from their stagnant state, rendering the neighbourhood peculiarly unhealthy.
11th, "Snake," the name given to the long flexible tube which conveys the smoke.
17th "Munall," the part applied to the mouth; made of gold, silver, or agate,

Sunday, November 10, 2013

Field Terrain Fractals

It occurs to me that treating fractals as fields that iterate from the previous and are solvable recursively for some subset so long as it doesn't diverge from the entire infinite field actually provides for not just a much better diamond squared fractal but rather for an infinite array of different types of fractals. There are basically only noise algorithms to do landscape like things, but if you take my algorithm and simply use it to recursively iterate the iterations within a limited scope you can produce a hell of a lot of different fractals.

Not to say they aren't useful, but most fractal iterations simply iterate and store the entire fractal in memory. To some extent that's not really needed. You could create a series of linear fractions say by starting by in infinite random field and then each iteration inserting the midpoint offset displacement just along the width. You'd get the 1d midpoint replacement fractal in infinite rows.  Or perhaps more useful you could apply say a box blur to a landscape, insert additional area with average random offset and repeat each iteration.

If (iteration == 5) {
     request sliver of the Iteration5 from iteration4 requested + 1 on each side,
     Apply a block blur (or frankly any convolution), and return the center bit that is accurately blurred.
}

You could likely produce pretty good landscape noise by inserting progressively less random additional points between all your current points and then applying a blur to all points. Even larger Gaussian blurs wouldn't be too difficult. In fact, there are some artifacts in diamond squared that cannot be fixed. Some points simply have different probability curves based on their location. If you always got the maximum possible random number every time, for a diamond squared field, you'll notice a *VERY* apparent pattern.


This typically blends into the noise and only matters for the standard deviation of the pattern. So long as they average at 0, it isn't very obvious (if you have run so that on average you deviate in some direction, it becomes apparent). It doesn't really have to be this way.

Saturday, November 9, 2013

Field Diamond Squared Fractal Terrain Algorithm

The traditional Diamond Squared algorithm for generating fractal terrain has a number of constraints that make it really hard to use.

https://code.google.com/p/fractalterraingeneration/wiki/Diamond_Square
Gives a pretty good rundown of the cons:

* The map must be stored in memory, because pixels reference other pixels.
* Because it must be stored in memory, memory becomes a constraint. [...]
* The map must have a width and height of 2x + 1 pixels.
* Has 'creasing' artifacts if wrapping isn't used.
* Wrapping isn't always wanted.

I have solved all of these. And simplified the algorithm.


The traditional algorithm is that you set 4 corners to random values and wrap around the edges.

0 0
0 0


You double the height and width. Then each place you have four corners available to you, you insert the average of those corners and a slight random offset.

0   0
  1   1
0   0
  1   1

Due to the wrapping. You have four diamonds.

Then after all the diamond steps are done, you add in the square sections.

0 2 0 2
2 1 2 1
0 2 0 2
2 1 2 1

Keeping in mind it wraps around.


----

My solution is to simply view the base step as an infinite field of purely random values. This seems harder to conceptualize. But, it fixes the problems. You can't create an infinite field with twice the width as an infinite field. But, if you note, the next iteration doesn't require anything more than 1 away from the current iteration.

Even without any wrapping you can take:
0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

And diverge.

0   0   0   0
  1 2 1 2 1
0 2 0 2 0 2 0
  1 2 1 2 1
0 2 0 2 0 2 0
  1 2 1 2 1
0   0   0   0

We went from a 4x4 to a 5x5. Next it goes to a 7x7 then a 11x11 then a (2n-3)x(2n-3)...

So we can simply reverse this with our well formed request.

If we want 1000x1000 block of data say at the range [0-1000], [0-1000] at 24 iterations (which under the traditional method would require 2^48 bits of memory to store), we can request:

[0,1000] [0,1000] @ 24 which means we divide the range in half rounding towards the larger area and increasing the bounds by 1.
We need the range:
-1 to 501 @ 23
Then:
-1 to 252 @ 22
Then:
-1 to 127 @ 21
Then:
-1 to 65 @ 20
Then:
-1 to 34 @ 19
Then:
-1 to 17 @ 18
Then:
-1 to 10 @ 17
Then:
-1 to 6 @ 16
Then:
-1 to 4 @ 15
Then:
-1 to 3 @ 14
Then:
-1 to 3 @ 13
...
...
Then:
-1 to 3 @ 1
Then:
-1 to 3 @ 0 which simply returns a field of 4x4 random numbers.


Rather than all that nonsense with wrapping and seeding and making what is actually a special case of the base case, we can simply reduce the algorithm to:

getTerrain(x0,y0,x1,y1,iterations) {
    if (iterations == 0) return maxtrixOf(random numbers);
    map = getTerrain(floor(x0/2) - 1, floor(y0/2) - 1, ceiling(x1/2), ceiling(y1/2), iterations-1);
    make a newmap twice as large.
    copy values from map into x*2,y*2 locations in newmap.
    apply diamond where possible. +- smaller random offset
    apply square where possible. +- smaller random offset
    return requested area from within newmap. (This is typically newmap from [1,(n-1)] [1,(n-1]
}

Done.

That's the entire algorithm. No more constraints and it's easier. On top of this the number of iterations doesn't control the size of the field but rather smoothness, of the underlying fractal. And since the base case is seen as an infinite field of purely random numbers, it goes on forever even at just a couple iterations as the iterations has no bearing on the size (it's always infinite).

On top of this rather than using a random number, you can use the the x, y, and iterations to make a pseudorandom but deterministic number like through a SHA1 hash. Then you can page from within the same area, forever without needing to have calculated all of it to start. You can create an infinite landscape without needing infinite memory to start, and returning to the same coordinates will give you the same results, and it doesn't matter which way you took to get there. 'There' will be deterministic.

---

I hacked together a working bit of the code in javascript:

http://tatarize.nfshost.com/FieldDiamondSquare.htm

Stealing liberally from http://www.somethinghitme.com/2009/12/06/terrain-generation-with-canvas-and-javascript/