Monday, April 5, 2021

Font Licenses. Typeface vs. Font

Typefaces are not subject to copyright (in the US, not Germany or the UK), however fonts *are* subject to copyright, and software licenses are contracts. You could rasterize each glyph in a font and auto-digitize those glyphs to make your own font. This could be done in a couple seconds purely in software. However, depending on the original license you could have sworn away your rights to use a reverse engineered font. EULAs could also exclude reverse-engineering as a licensed use. You could also *maybe* create large images of each glyph and have the font auto-digitization done by a 3rd party, arguing that you performed a licensed use and they were sent non-copyrighted data and they created a program that could *also* render the same typeface as the original program. You would be only be using your agreed upon right "create images on a surface where the the image has a fixed size".

The actual font glyphs in vector form are protected but in raster form are not. However, licenses are contracts and the EULA could demand you not make large raster images to be auto-digitized, attempt to reverse engineer, or use something that was reverse engineered or substantially similar to the originally licensed font. The "bezier curve control point choice" which was the intellectual property recognized in Adobe Systems v. Southern Software, and the reason "fonts are programs and programs are subject to copyright" could be stripped through rasterization and auto-digitization, but the actual contract agreed to by the customer with legal access to the font could actively say "you are not allowed to do or facilitate that" and breaching that contract could result in considerable liability. However, if it lacked such language, one could perform Southern Software's process of mass ripping off fonts is a less dubious manner. Font licensing is basically a method of using contracts to try to protect intellectual property not protected by intellectual property law.

Friday, November 6, 2020

Never again. No more hell elections.

I would not have wished this on my worst enemy. This election was cruel to everybody. First in an election that all predictions said the Going into the election it was expected that Dems would comfortably get massive gains. But, the first thing that seemed wrong was many states that had counted votes first and added them to the same day weirdly blue. Kentucky went strongly blue and Montana and Texas. And all the states that counted those before hand.
Then everything else that didn't have those blue votes went blood curtailing red. Death in an election red. All your polls are wrong, Trump will even win the popular vote ruby red. Sleep on your doom while the Trumpists drink your libtears! Good night America.
Then slowly those states started counting up the missing democratic vote in the mail in ballots and were shocked when it was enough to exactly counter-act how blood curtailing red the first day map was. And restore them back to the average which comes close to the polling average.
It would have been much more kind to everybody if the map was simply the end result right away and not give the Trumpists the most delectable candy before punching them in the throat for days on end. And this is without NC going blue, without many of those house races reversing, without the Senate. I would not have wished this on anybody. It was cruel to everybody, for no reason. One of the first things that must be done is to ensure that all states pre-count their mail in ballots going forward or completely convert to mail in only ballots and count them at whatever speed you want.
Never ever ever ever, have a strong partisan divide where all Republicans cast their ballots to show up right away in the count and all Democrats cast their ballots in a way that takes several days to count. You should not torture everybody with a #RedMirage and then be even crueler to those who thought they win, by slowly making them feel the death of a thousand cuts as everything that they were not getting and did not earn was removed from them piece by excruciating piece. This election was hell. Never again.

Tuesday, June 9, 2020

Wes Nunn The empty tomb of Jesus is an historical fact, as certain as the destruction of the second Temple in 70 AD. The best explanation for the empty tomb is that God raised Jesus Christ from the dead. The tomb was guarded by Roman soldiers to ensure that the disciples of Jesus didn’t steal the body and lie about the resurrection, on orders from Caiaphas, the high Jewish priest. A “merely human” Jesus is not a sufficient explanation for the most popular religion in the world, nor can it explain how Christianity flourished under threat of persecution as a doctrine that undermined the Roman hegemony of the time. There’s just no way that Jesus was a mere man. The Bible would not exist today if Jesus was a mere human who opposed a political ideology and was tried for treason. Rational human beings would not risk persecution and certain death to spread his doctrine unless they were 100% sure that he was more than just a man.
The empty tomb of Jesus is not a historical fact. It's actually likely related to the weird cyclops cave in Homer's Odyssey. Also the soldiers are completely made up specifically because of the whole ending of Mark. It's pretty blantantly obvious there.

Mark ends with the giant stone rolled away. Keep in mind this is not what Jewish funerals or burials looked like, its a scene where the cyclops house has a giant rock in front of it rolled away. Nobody puts dead body in giant caves with roll away stones. But, Mark ends like that scene in the Odyssey. And the obvious skeptical answer is that why is he magically resurrected when clearly it's more plausible that somebody just stole the body. Like misplacing one body makes a person the messiah. That's silly.

In response to that criticism Luke puts the tomb being guarded by some of the most elite soldiers in the Roman Empire. So now a dead body of some nobody person is being guarded by basically the ancient version of Navy SEAls, for entirely spurious reasons when clearly the actual explanation is Mark's ending had critics so Luke invented some reason why the most obvious criticism couldn't be true. But, the only reason Luke made up this historically impossible thing was because Mark was written as fiction and was more concerned with the sort of literary ending the whole thing than with the obvious criticisms that people would raise when told this story.

A merely human Jesus could aptly explain the religion. It's growth was not extra-ordinary and in fact it's grown much more slowly than Islam. And the there's actually very little record of any active persecution except for a few years under Nero. For the most part the Romans didn't know who the Christians were until it got pretty popular. And then Roman kind of collapses around the 2nd century anyway, and started sliding pretty quickly backwards. To the point that the Christians took over, not so much because they were were so powerful but Roman had fallen so entirely far.

The Bible is entirely a story that only makes sense within the historical context the religion arose in. In reality the blood sacrifice of demigods does not do anything magical. You do not actually get magical blood that fixes the universe. And only God's blood had enough magic to do it, so he gave himself a body and killed it. That is not how reality actually works. Blood is merely the oxygen carrying cells of various species of animals on this planet. It is not actually magical. But, some religions like the Jews took to blood propitiation. And then got taken over by the romans, who loved their demigods so it's little wonder why exactly out of that region we get the blood sacrifice of a demigod. As all the various cultures in the regions the Romans took over had their own pagan influences to their local relgiions.

Also, nobody seems to care that the Christians apparently worshipped an escaped criminal. It seems like if you offered that religion on the surface the obvious explanation is that somebody who was due to be executed escaped and was somehow on the run gathering outlaw followers. It seems like if that was something pitched on the level it would tend to make that a proper crime, but nobody seemed to think that was what happened, enough to take the early Christians at face value.

Also, early Christians, the earliest records we have of them are found in a letter of Pliny to the Emperor. And we don't find them facing persecution and death for Jesus. We find them quickly recanting, insisting that they were never Christians. Praying the the Emperor and spitting on pictures of Jesus to save their own skins. While most of these are pretty basic arguments for Christianity that you'd find in any apologetics book. Not one of them sustains any understanding of history or how religions form. Also, blood isn't magical. The entire central story behind the whole Jesus thing doesn't make any real sense. You don't cleared away sins with blood. That's not actually a thing and never has been, early Jewish beliefs aside. We also know the reasons religions like that developed but it's simply the case that no aspect of that makes any sense.

So we have a religion that is absurdist on the face of it, better historical, literary and religious explanations for everything you mentioned. And that magic has never been the right answer to anything, ever, it's simply never been correct. So to try to suspend how reality actually works because Jesus is magical is a problem. And the better explanations for all of that does not require any magic. You really could have Mark write the gospels largely as fiction, and Luke try to fix the clear plot holes that were intended for literary reasons. And a bunch of ahistorical nonsense that doesn't actually work.

Tuesday, September 3, 2019

"Not for all the Ts in China."

There's no Ts in CHINA. That's the joke.

Wednesday, December 26, 2018

PNG seam carving chunks. (seMw, seMh)

As a fun quirk I recently read the PNG specifications and that's some clever stuff. It's wildly extensible even by 3rd party folks. I recall messing around with seam carving years ago, and I now realized that PNG files themselves would be a fine way to store seam carving data. seMw seMh chunks would define the seam carving width and seam carving height enumerations. The data in these blocks would contain zlib compressed data (compression identical to that of other PNG chunks) of 8/16/24/32/etc bit numbers, one number, per pixel laid out left to right, top to bottom. The required bits of the number is the ceiling function to the next full byte needed to express the maximum value to enumerate that dimension. So if your width is 255 you can make do with a 8 bit number but between 256 and 65535 you need a 16 bit number. The numbers are stored in big endian notation (like that of PNG) The blocks for seMw and SeMh are independent (as required by PNG) so if you have a 360 x 240 image it will require 2 bytes per width, and 1 byte per height.

That's it. We just provide a number for each pixel, in one or two directions.

Height carving will be done first. Because of the need for pixels from other scanlines to fill in the gaps left by the now missing pixels and then the width carving.

Height carving:
* All pixels that are above a given height threshold are declared blank
* Entirely blank columns are removed.
* All pixels are copied to the topmost available pixel and blank pixels are overwritten.
* The new height is the position of the last complete scanline.
* If some scanlines are the new height, that they are truncated.

Width carving:
* All pixels that are above a given width threshold are declared blank.
* Entirely blank scanlines are removed.
* All scanlines pixels are copied to the first available pixel and blank pixels are overwritten.
* The new width is the shortest valid scanline.
* If some scanlines are longer than new width, they are truncated.

Do note, that if a threshold value causes all values in a scanline to be blanked that scanline, during width carving, is removed. Likewise if all column pixels are blank in height carving that column is removed. This allows for thresholds within width carving that remove entire lines (so long as they are the same scanline). These removed scanlines and columns are disqualified from being the shortest valid scanline or causing no scanline to be completed.

There is no guarantee you will get a particular width or height, just that it can be reduced. If at a certain pixels have a value of 0, these cannot be removed until the value is actually 0 (unless removed by the other directional carving). If all pixels are given a minimum value of 120-width the entire image is gone below that value. If well behaved it will simply reduce gradually losing seams in a proper and effective manner, if not we behaved it could do a bunch of weird and kind of rebellious things, all of which are valid. If a block (seMh, seMw) does not exist, it's assumed that it values are all entirely 0. That is to say regardless the threshold given (above zero) it won't change, and need not be implemented.

You should not assume the values are actually seams, they simply number assigned to pixels in width and height directions. The removal algorithm remains the same.

The process is not iterative. You remove the height pixels then the width pixels. If you perform this operation again, the the correct result is if you did this from the original image.

There is no requirement that both width and height carving be implemented, you could simply implement direction (width would be the easiest there).

--- The general advantage of this scheme is that in most cases it'll just be a normal PNG and work like a graphics file except in something or other that cares about this data. And when nothing cares about that data it'll be fine and just store a normal image file anyway.

Friday, September 14, 2018

If unix time is base 36, the last word in the unix epoch is ZIGZAG

Never makes it to 7 letters words. All words in 2018 start with P.
1547408965 PLACED Sun Jan 13 11:49:25 2019 1543566578 PIZZLE Fri Nov 30 00:29:38 2018 ... 1528992094 PABLUM Thu Jun 14 09:01:34 2018 1511124996 OZONIC Sun Nov 19 12:56:36 2017
September 9th was full of words. There will be no more until October. 1540710226 PHARMA Sun Oct 28 00:03:46 2018 1540702422 PHALLI Sat Oct 27 21:53:42 2018 1540695700 PHAGES Sat Oct 27 20:01:40 2018 1536787497 PEYOTL Wed Sep 12 14:24:57 2018 1536787490 PEYOTE Wed Sep 12 14:24:50 2018 1536700131 PEWTER Tue Sep 11 14:08:51 2018 1536686416 PEWITS Tue Sep 11 10:20:16 2018 1536680692 PEWEES Tue Sep 11 08:44:52 2018

Thursday, April 5, 2018

Human brains are basically trash.

It takes a lot of humility to realize how utterly stupid human brains are. They are actually pretty trash, but while you're thinking with one, you think they are absolutely flawless and inerrant but that's exactly the problem.

Friday, March 30, 2018

"Behold, I come quickly."

Though the Bible is filled with prognostications about the premature exaltation of these mortal coils, this God fellow extends this much-promised rapture like a guy who thinks he is himself 'God's gift to Mankind' but is excessively focused one tiny pointless strip in the desert.

Tuesday, October 3, 2017

On Supposition of a single entendre.

Missing a double entendre is when, in social intercourse, there is another meaning upon the lips, that one fails to fully wrap their head around or penetrate the whole of the available depth, a sort of premature interpretation.

Within this oral intercourse,
There is a seeming, source
Of a premature interpretation.
Flip it with a second destination.
On those lips, left wanting,
of a deeper thrust,
a pair of content's taunting,
their points securely trussed.
Beyond the naked point's, another.
A spectrum of awaited breadth,
It's hard to grasp
the whole, of the penetrable depth.

When in oral intercourse there is pair of points upon the lips, yet a failure to grasp the whole of the penetrable depth.

Double Entendre: n. pair of material and both points are grasped, and the whole of available depth is penetrated.

Double Entendre: when there is considerable pair, and both points are grasped

--- My hope here was to make a good and quippy definition for what a double entendre is, but I dunno, these seem a bit lackluster.

Friday, September 22, 2017

Adding to my list of oddities in computer science.

CS folks are enamored of dividing 2D space in 2D space chunks? It makes all of the math needlessly harder, even if it makes the math-sense and understandability easier. You divide 2D space into two instances of 1D space. The algorithms don't require trees, you can still easily access the needed data in log(n) time, update them as easy as a sorted list can be updated, and with a bit of style you can easily prove points don't need to be checked. It's weird because no algorithms do this, but you can do an amazing amount of very simple math to solve all the traditional problems in computational geometry with simpler algorithms.

  • You can build the space in d*n*log(n) time (sorting lists).
  • With sorted lists of points you can insert in as easy as inserting into a list.
  • You can remove as easily as removing from a list.
  • You can find the nearest neighbor to a point in a short algorithm in log(n) time.
  • You can find k nearest neighbors to a point in a similar short algorithm in ~k*log(k)*log(n) time.
  • You can do basically all the AABB math quite easily too. You can easily find in n time the bounding boxes relevant to a point. And update that point very easily.
  • You can find if a point is inside a polygon.
  • You can find all points within an axis aligned rectangle in trivial time.

But the really really pressing bits of this is that categorically these algorithms are tiny. Like they don't take much work at all. They are exceptionally short. And the datastructure is what modern memory systems are optimized for so you won't be cache missing all the time. And it's so common it's implemented in like four lines of code. So why the hell are all games doing collision detection of divided up 2D space in 2D chunks or 3D chunks in 3D space? Also, these algorithms obviously scale really easily with the degree of dimensionality. They don't violate theoretical points though. If you do a Nearest Neighbor Search in 3D it's basically identical code with the steps as the 2D code but since we're dealing with 3D, it can easily end up checking most all the points anyway simply because you can't rule out the remaining checks as quickly.

I needed a nearest neighbor search for my android app to find the nearest point to a point and do this many many times in real time. But, when a point is moved it required a lot to fix the pre-processed datastructure since they were organized into trees so the nodes needed to be fiddled with etc. This allowed for nodes to be updated en masse, and the lists to simply be very quickly resorted in a trivial amount of time and perfectly ready for the next tick.

I hit upon this algorithm largely because I had also done considerable work with filling monotone polygons using a scanline, and used a sort of step-raytrace with line segments which is another brilliant algorithm (it's very similar to the good solution to the skyline problem), it's largely just a single list of all the points sorted along one axis. Then you scan through the list, keeping a working list of active line segments. This solves the perpendicular rays and finds all intersections of that perpendicular ray (it's literally the intersections of the active list of line segments) in fast enough time that a little android phone can do the ray traced lines in real time.

To speed up my attract tool (requires many nearest neighbor searches), I previously made an interesting nearest neighbor search with a point quadtree which equally used the same general idea that you could prove the invalidity of other parts of the tree by showing that the distance in just 1 dimension is greater than the shortest distance already found. I thought this was awesome as nobody seemed to have any nearest neighbor algorithms based on that rather rare datastructure.

But, if you could do this with a tree it would be much easier to do this with 2 different 1D sorted lists. Just binary search into the list, and go to each point in the +X, +Y, -X, -Y directions until the distance in just dX is greater than your best candidate so far.  You can also conclude things like if +X and -X are exhausted then there can be no closer point, as you proved all points exhausted (the points found in the other dimensions are going to be duplicates of the ones you ruled out). But, the point is implementing all of that is trivial compared to the other ways. And all the tricks in computational geometry are simply proving you don't have to check those other points, which is can be done with the same trick over and over, can this point further along this axis possibly be closer or included? For the K-nearest neighbor algorithm, you store the candidates in a heap sorted by distance and only compare the worst of them to the new potential candidates until just that one direction along is enough to be worse in which case no more points along that axis can possibly be better.

For Axis Aligned Bounding Boxes (AABB) you can rather simply add the start points and end points of the shapes. Then when you cross a threshold by traveling along the axis (only going to the next relevant point always as that's how the traversal works), you can trivially check if the relevant point is within that bounding box. So you can rather easily linearly iterate into the list and you'll know exactly which bounding boxes that point is within tracking them basically exactly as one would the skyline problem. Then moving that point within the space equally quite quick and just means updating any active elements as you cross thresholds (and if you don't cross any relevant boundaries, changing nothing at all). Equally it solves a number of common problems in collision detections like not updating something that moved in time to see that it struck something. As the object moves it needs to find it's place in the lists, which means you must process each element in order, which means you know if you hit anything, regardless whether you would now be completely on the other side of that object now.

I totally understand that it's easier to think in 3d space in 3d and 2d space in 2d so when you're partitioning space you are wildly more likely to divide the space in ways that does not screw up the dimensionality. It's easy to think of dividing a square into two half-squares but it's a bit weird to divide it into two equally lengthed lines. But the math is easier if you divide it into two lines for obvious reasons, even if it's harder to conceptualize.

Monday, September 4, 2017

On Intelligence being evolution.

Wrote this elsewhere as personal correspondence, but it makes some points I'd rather not forget for future reference. I'm a computer scientist and one of my notable skills is understanding algorithms that underlie things. In 2007, I watched a pretty great TED talk by Jeff Hawkins ( Jeff Hawkins on how brain science will change computing. ) which had some really critical ideas about understanding intelligence and it made me realize that if brains predict the future, and that seems right, then the algorithm for intelligence is necessarily: evolution. Now, I don't mean this to say intelligence evolved, I mean this to say that a child from infancy to adulthood how they work in the brain is fundamentally an implementation of evolution. And I don't mean that lightly. There's a few people who note that artificial neural nets have a somewhat evolutionary strengthening, or folks who argue that brains work kind of like the adaptive immune system. I mean this strongly like algorithmically evolution and intelligence are identical. It seems a bit weird at first, but the more you let it infect your mind the more you realize it explains things. Creationists always look at trees and insist they were intelligently designed. Because they look at trees and the products of intelligence and say; the causes of these things are the same. We turn around and say we know the tree formed through evolution and therefore that statement is not true; but I think this is wrong. I think this rather shockingly strong *illusion* of intelligence is no fiction at all. Sometimes the opposite of a profound truth is another profound truth. The error we make is in assuming we know what the fuck intelligence is and are therefore correct in dismissing Darwinian evolution as a form of it; I think it is a form of it because at the core the two are the same thing. The argument from design says that the two things are the same. We say that argument is wrong because the tree is the result of evolution by natural selection. But, there's a missing premise there required to deny the argument: intelligence is not evolution. And I think that premise is false; It is evolution. This also gives us a few interesting requirements about what is required between senses and minds; namely there's no requirement for a connection at all. It isn't as if the environment programs DNA of various species. There's no direct connection there at all. Rather the things that work effectively are strengthened and those that don't do not. Likewise if brains are making predictions of things fairly randomly and are only being confirmed by your senses, then we necessarily do not need our senses to direct our actions at all. Without senses we'd start hallucinating wildly, with them we hallucinate coherently. Our senses only need to confirm things after the fact. So some weird items like how we can swing a bat in less time than we could have decided to, just sort of evaporate. And seemingly profound thought experiments like Searle's Chinese Box become rather trite. Undoubtedly you can think of dozens more examples that quickly get explained away. So the posted article contains things like "Your mind filters, sorts, selects, contains, and bestows meaning to an element in the endless stream of external data flooding your senses." -- This is completely pointless and wrong. Your mind doesn't need to do any of that because our senses don't do any of that. We invent a world inside our own heads with various theories and ideas and understandings, and then our senses tell us whether that stuff is right or not and we react accordingly. This is also largely why in sensory deprivation chambers or our sleep we kind of go a little crazy, because nothing ends up registering as being more true than anything else so we start hallucinating. We also get basically every form of hallucination for free, from excess details that we can't really see to the blind spot in our eyes, and why we make up intermediate steps between events even if they didn't exist. Under my theory, we not only get these for free; they are required to be true. It also broadly explains why "there is a difference between what you experience, and what exists out there: The virtual can never be real. The essence of your understanding is, in effect, rooted in this difference. Where does difference arise?" -- The difference arises because the stuff we perceive is completely made up. Everything about our understanding of the world what we think the world actually is, is a confabulation that was made up inside our head, and whittled down by our senses. Just as every nucleotide in our very amazing DNA was a random mutation. It sounds like this should completely unmoor our understanding of reality from reality itself and it does, but our senses narrow that range of possibilities and those elements, just as the process of selection culls random mutations into "endless forms most beautiful". If you take this idea seriously, you will quickly realize that it starts knocking down barriers by its mere existence in your head. It not only explains the veil but why it must exist. Our very nature as intelligent beings requires that this is how we work. Most of the objections to George Berkeley's sort of idealism ((1) We perceive ordinary objects (houses, mountains, etc.). (2) We perceive only ideas. Therefore, (3) Ordinary objects are ideas.) are generally that reality is real and it is, but if you understand what intelligence is you can thread the needle aptly enough to take the correct points from idealism and from materialism. It's entirely true that reality comes only from us internally and that reality is not somehow the result of our senses grabbing reality and pulling it into our head. Rather the reality in our head is influenced by our senses and our ability to predict what we well sense next requires us to come up with an internal view of reality that need not be anything like actual reality (in fact we know a lot of aspects like color are just ad hoc inventions and do not exist outside our heads) it's filled in with a bunch of hallucinations and randomness because the internal view of reality need not have anything to do with actual reality, except that we have consistent ideas about reality that have evolved and they are remarkably resilient. Just as evolved forms need not be efficient hunters or energy gatherers but because of the nature of evolution that's how they end up. We need not have a good grasp of reality and make correct predictions and correct understandings, but because of the nature of what evolution does, the more efficient forms are preferred. In other words, under this understanding intelligence will end up being as robust as the web of life itself. Update, based on a reply discussing evolutionary epistemology: No. I am not at all saying evolutionary epistemology. Fucking obviously evolution formed our senses, but that's not even remotely the point. I'm thinking I missed the point if you couldn't get your head around it enough to stop you from jumpping down one of the many different lines of similar but all equally inexact thoughts. I mean what I say more profoundly than that, like expelling the hobgoblins there and replacing the whole shebang. I wrote it well and tried to stress the points to help get your head around it, but apparently it still missed the mark. Imagine if you would that there is no such thing as intelligence. That that which we call intelligence is entirely just evolution taking place in neurons. Not that senses are evolved or brains are evolved or that brains use vaguely reinforcing neurons that are akin to evolutionary processes; no. Everything about intelligence is just evolution taking place in the medium of brains. That the mind is running an evolutionary algorithm. That's how it entirely works.

Wednesday, June 28, 2017

A conclusion shopping around for a theory.

You sir are a donkey fucker. Okay, maybe you're not a donkey fucker, since there's no evidence of that. You sir, are a chicken fucker. Wait, no evidence there either. You sir are a squirrel fucker. -- Look, I have my conclusion, you fuck some kind of animal and when that type of animal is shot-down, I'm going to shop around for another type of animal. Because that's how this shit works apparently. --- Make some shit up, when that gets demolished, make different similar shit up, with generally the same conclusion.
You catch the analogy there goat-fucker?

Tuesday, June 27, 2017

Approximating an arc with cubic bezier curves, yet another metric.

C = 0.552

C = 0.55201372171

The idea is that rather than minimize the extrema of the error we can instead minimize the total error. Graph out formula for the error and calculate what would be under the curve as a whole. So rather than positive and negative error equal it would seek to minimize the error overall. It's not too different from the other metrics. But, rather than trying to keep the first pixel from being wrong, it tries to keep the pixels as a whole from being wrong for as long as possible. It's different than the number for the extrema because oddly the graph is symmetric at 0.5. It's not symmetric with regard to the y axis, and has different amounts areas of positive and negative and the error shifts as the value of c shifts.

Mortensen's value. Even extrema point.
0.55191502449 at 0.0000001 increments
Total error:1180.57375326880434046054832219597498652621901536765190
Samples: 10000001

My calculated value, brute force.
0.55201372171 at 0.0000001 increments
Total error:1159.83397426356807198675826572857280613256846239728729
Samples: 10000001

Naive geometric value, with purely positive error ((4/3)*(sqrt(2) - 1).
0.552284749 at 0.0000001 increments
Total error:1401.62730758375303300973494715872257045283590056376636
Samples: 10000001

As we can see the total error over a million samples gives us an improvement of 20. Compared to the naive value for all error being positive we gain 242 which is better than Mortensen's gain of 222.

We're talking literally fractions of percents here, but this number has another advantage. You can call it .552 which is a much shorter fraction. Besides the more slices I do the more I narrow in on the value, but it's still a bit off. I'm pretty sure on most of those digits but without actually doing the calculus I can't get much better than that.

0.552 at 0.0000001 increments
Total error:1160.26180861006145200701189677079769078925976995284068
Samples 10000001

You'll notice my value is only 0.4279 different than that in total error over a million samples. And since that truncation lowers it, it will only make it a bit closer to the even extrema point, which is a fine metric.

P_0 = (0,1), P_1 = (c,1), P_2 = (1,c), P_3 = (1,0)
P_0 = (1,0), P_1 = (1,-c), P_2 = (c,-1), P_3 = (0,-1)
P_0 = (0,-1), P_1 = (-c,-1), P_2 = (-1,-c), P_3 = (-1,0)
P_0 = (-1,0), P_1 = (-1,c), P_2 = (-c,1), P_3 = (0,1)
with c = 0.552

Under this metric the cubic value something like: 0.92103099 which might be more important because really flattening out the error might matter in that case a lot more than in the cubic case. I'll call it 0.921

Friday, June 16, 2017

Using a quad to emulate an arc, solving for C.

Basic geometry allows one to solve for the best solution to use a value of C to make a bezier curve close to an arc. The naive solution using Geometry is

This is the solution to the question of we have anchor points on the curve and the curve touches the circle at the center, what value of C for a control point on the quadrant curve (0,1),(C,C),(1,0). Gives us the best fit to the curve.

However Mortenson points out that we are better if we minimize the error rather than allow all the error to be on one side of the circle.

This issue allows a few more percent with the Cubic Bezier form. But, it's more important if we're using one fewer control points. The same is also true at one fewer yet. If we have a square, what square looks most similar to a circle.

The if the naive geometry solution is the same we get:

. Where the corners touch the circle but do not exceed it. The other way you could do it is to have them only touch at the corners and just make the curve larger than the circle.

And finally we have Mortensen's solution to it, by making the metric for closest be the average error across the entire graph.

Well, solving this for 1 control point means doing the same thing he did. Which isn't super-trivial because it means calculating min and max error and adjusting various things. So I wrote a program to do it.

Your C points in Quad Bezier curves are:

C= 0.92519820883625651516056680057654772234129017577799879993432335355559372311727101122467939843041708056568481020881580812152533756252840773920708961655740969447362217856208142868847332990974178763987890

Having the program I refigured it for Cubic:

Having a deviation in both directions of: ±0.00019607646987687817401874512914923 ....

Mortensen gave this as,

Since we might well be using doubles I'd give it as:

C0.5519150244935106,1 1,0.5519150244935106 1,0
C1,-0.5519150244935106 0.5519150244935106,-1 0,-1
C-0.5519150244935106,-1 -1,-0.5519150244935106 -1,0
C-1,0.5519150244935106 -0.5519150244935106,1 0,1

And the c value for the quad bezier curve as:

Q0.9251982088362565 0.9251982088362565 1,0
Q0.9251982088362565 -0.9251982088362565 0,-1
Q-0.9251982088362565 -0.9251982088362565 -1,0
Q-0.9251982088362565 0.9251982088362565 0,1

This is much better than the more naive value: 0.91421356237 which is effectively unusable. While Mortensen's use for the cubic is great, it changes the quad naive to almost usable, generally not, but *almost* usable. The Mortensen-optimized value for quads is off by max 0.007767318 whereas the naive value is off by 0.010781424258 which is 28% better. Hm. That's the same value Mortensen got for the cubic.
Naive Quad: For comparison.

Saturday, June 3, 2017

1 dimensional fractals.

1 dimensional fractals all look the same. That's why they are fractals. Get it? Because they are all lines. And fractals look the same. And all 1d anything is a line which looks like all the other lines. HAHAHAHAHAHA!

Thursday, May 25, 2017

Entirely Hex Words

aa, ab, aba, abaca, abba, abbe, abed, accede, acceded, ace, aced, ad, add, added, ae, aff, ba, baa, baaed, baba, babe, bacca, baccae, bad, bade, baff, baffed, be, bead, beaded, bed, bedad, bedded, bee, beebee, beef, beefed, cab, cabbed, caca, cad, cade, caeca, caf, cafe, caff, ceca, cede, ceded, cee, da, dab, dabbed, dace, dad, dada, daff, daffed, de, dead, deaf, deb, decade, decaf, dee, deed, deeded, def, deface, defaced, ebb, ebbed, ed, ef, eff, efface, effaced, fa, fab, facade, face, faced, fad, fade, faded, faff, faffed, fe, fed, fee, feeb, feed

My favorite: effedface. Though 0xeffdface would fit in an int. 0xFADEDBEE 0xBEDAFFED 0xDECAFBAE 0xFEEDFACE 0xDEFACADE

32 bit hexwords.

abasedly aba5ed17
abatable aba7ab1e
abatises aba715e5
abbacies abbac1e5
abbatial abba71a1
abbesses abbe55e5
abettals abe77a15
abigails ab16a115
ableists ab1e1575
abscised ab5c15ed
abscises ab5c15e5
abscissa ab5c155a
abseiled ab5e11ed
accessed acce55ed
accesses acce55e5
accidias acc1d1a5
accidies acc1d1e5
accolade acc01ade
accosted acc057ed
acetylated ace7718d
acetylates ace77185
acetylic ace7711c
acidoses ac1d05e5
acidosis ac1d0515
acidotic ac1d071c
acolytes ac0177e5
addicted add1c7ed
adelgids ade161d5
aecidial aec1d1a1
affected affec7ed
affiliated aff1118d
affiliates aff11185
afflicts aff11c75
affordable af4dab1e
affordably af4dab17
afforested af4e57ed
agiotage a6107a6e
agitable a617ab1e
agitatedly a6178d17
albedoes a1bed0e5
alcaides a1ca1de5
alcaldes a1ca1de5
alcaydes a1ca7de5
aldolase a1d01a5e
alfalfas a1fa1fa5
algicide a161c1de
algidity a161d177
algology a1601067
alidades a11dade5
alliable a111ab1e
allodial a110d1a1
allotted a11077ed
allottee a11077ee
allseeds a115eed5
alogical a1061ca1
asbestic a5be571c
ascetics a5ce71c5
asocials a50c1a15
assagais a55a6a15
assailed a55a11ed
assegais a55e6a15
assessed a55e55ed
assesses a55e55e5
assisted a55157ed
associated a550c18d
associates a550c185
assoiled a55011ed
astasias a57a51a5
astilbes a5711be5
atalayas a7a1a7a5
attaboys a77ab075
attendees a710dee5
attested a77e57ed
atticist a771c157
babbitts babb1775
babesias babe51a5
babydoll bab7d011
babysits bab75175
bacalaos baca1a05
baccalas bacca1a5
badassed bada55ed
badasses bada55e5
bagasses ba6a55e5
bagatelles ba6811e5
baggages ba66a6e5
baggiest ba661e57
bailable ba11ab1e
bailiffs ba111ff5
ballades ba11ade5
balladic ba11ad1c
ballasts ba11a575
ballboys ba11b075
balletic ba11e71c
balliest ba111e57
ballista ba11157a
balloted ba1107ed
basaltes ba5a17e5
basaltic ba5a171c
baseball ba5eba11
baseless ba5e1e55
baseload ba5e10ad
basicity ba51c177
basidial ba51d1a1
basified ba51f1ed
basifies ba51f1e5
basilect ba511ec7
basilica ba5111ca
basseted ba55e7ed
bassetts ba55e775
bassists ba551575
bastiles ba5711e5
bastille ba57111e
batistes ba7157e5
battalia ba77a11a
battiest ba771e57
baysides ba751de5
beadiest bead1e57
beasties bea571e5
beatable bea7ab1e
beatific bea71f1c
beatless bea71e55
bebloods beb100d5
bedabble bedabb1e
beddable beddab1e
bedotted bed077ed
bedsides bed51de5
bedstead bed57ead
beefalos beefa105
beefiest beef1e57
beefless beef1e55
befitted bef177ed
befleaed bef1eaed
befogged bef066ed
befooled bef001ed
begalled be6a11ed
beladied be1ad1ed
beladies be1ad1e5
belittle be11771e
bellboys be11b075
bellcast be11ca57
beltless be171e55
besieged be51e6ed
besieges be51e6e5
besotted be5077ed
besteads be57ead5
biacetyl b1ace771
biasedly b1a5ed17
bibelots b1be1075
biblical b1b11ca1
biblists b1b11575
bicycled b1c7c1ed
bicycles b1c7c1e5
bicyclic b1c7c11c
biddable b1ddab1e
biddably b1ddab17
bifacial b1fac1a1
bifidity b1f1d177
bifocals b1f0ca15
bigfoots b16f0075
bilabial b11ab1a1
bilgiest b1161e57
billable b111ab1e
billeted b111e7ed
billetee b111e7ee
billfold b111f01d
bilsteds b1157ed5
bioassay b10a55a7
biocidal b10c1da1
biocides b10c1de5
biocycle b10c7c1e
biogases b106a5e5
biologic b101061c
biolyses b10175e5
biolysis b1017515
biolytic b101771c
biosolid b105011d
biotical b1071ca1
biotites b10717e5
biotitic b107171c
biscotti b15c0771
bisected b15ec7ed
bistable b157ab1e
biteable b17eab1e
bitsiest b1751e57
bittiest b1771e57
blasties b1a571e5
blastoffs b1a52ff5
bloodied b100d1ed
bloodies b100d1e5
bloodily b100d117

Hex words, as in words that can be spelled purely in hex.`

aa aa
aal aa1
aalii aa111
aaliis aa1115
aals aa15
aas aa5
ab ab
aba aba
abaca abaca
abacas abaca5
abaci abac1
abaft abaf7
abas aba5
abase aba5e
abased aba5ed
abasedly aba5ed17
abases aba5e5
abasia aba51a
abasias aba51a5
abatable aba7ab1e
abate ab8
abated ab8d
abates ab85
abatis aba715
abatises aba715e5
abattis aba7715
abattises aba7715e5
abaya aba7a
abayas aba7a5
abba abba
abbacies abbac1e5
abbacy abbac7
abbas abba5
abbatial abba71a1
abbe abbe
abbes abbe5
abbess abbe55
abbesses abbe55e5
abbey abbe7
abbeys abbe75
abbot abb07
abbotcies abb07c1e5
abbotcy abb07c7
abbots abb075
abdicable abd1cab1e
abdicate abd1c8
abdicated abd1c8d
abdicates abd1c85
abed abed
abele abe1e
abeles abe1e5
abelia abe11a
abelias abe11a5
abet abe7
abets abe75
abettal abe77a1
abettals abe77a15
abetted abe77ed
abide ab1de
abided ab1ded
abides ab1de5
abigail ab16a11
abigails ab16a115
abilities ab11171e5
ability ab11177
abiological ab101061ca1
abioses ab105e5
abiosis ab10515
abiotic ab1071c
abiotically ab1071ca117
ablate ab18
ablated ab18d
ablates ab185
able ab1e
abled ab1ed
ablegate ab1e68
ablegates ab1e685
ableist ab1e157
ableists ab1e1575
ables ab1e5
ablest ab1e57
ably ab17
abo ab0
abode ab0de
aboded ab0ded
abodes ab0de5

Wednesday, January 4, 2017

Reinventing the world without reinventing the wheel

I just made this up. Dibs.

"Reinventing the world without reinventing the wheel" - Tatarize.

Thursday, December 22, 2016

Flaw in VelocityTracker changes to a diagonal.

Velocity is the direction and speed of an object. Changing the direction because of the maximum velocity was reached must be considered a defect. This also clearly causes a flaw in that a diagonal velocity is faster than the orthogonal one.

The problematic bit of code akin to:
mXVelocity = accumX < 0.0f ? Math.max(accumX, -maxVelocity) : Math.min(accumX, maxVelocity);
mYVelocity = accumY < 0.0f ? Math.max(accumY, -maxVelocity) : Math.min(accumY, maxVelocity);

The flaw here is that if your velocity in the X direction exceeds the maxVelocity it is changed equal maxVelocity and the same for the Y. But, that means that if we are going at 20° angle and at a speed of 200, and our maxVelocity is 20. Our velocity is changed to be 20*sqrt(2) at a 45° angle. The correct answer is to scale the mXVelocity and mYVeloicity by the ratio of the actual velocity and maxVelocity.

mXVelocity = accumX;
mYVelocity = accumY;
double actualVelocitySq = mXVelocity * mXVelocity + mYVelocity * mYVelocity;
double maxSpeedSq = maxVelocity * maxVelocity;
if (actualVelocitySq > maxSpeedSq) {
    double excessFactor = Math.sqrt(maxSpeedSq)/Math.sqrt(actualVelocitySq);
    mXVelocity *= excessFactor;
    mYVelocity *= excessFactor;