< July 2006 > Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Tue, 18 Jul 2006:

## Cropped Rotation

The problem with taking photos in a moving car is that it is very hard to get the baseline of the photo on the horizontal. So eventually to get a decent pic, you need to rotate the photo. But after rotation, you need to crop it back to a square. All operations which take time and is relatively annoying. So, I wrote a gimp script.

```  r = math.sqrt(x*x + y*y)/2

# as calculated for top left corner
dx = r * math.cos(phi) - r * math.cos(theta)
# -1 * because as the angle comes down, our y decreases
dy = -1 * (r * math.sin(phi) - r * math.cos(theta))
```

Basically, this python-fu script (rot-crop.py) does both operations together and gives you a cropped rectangular image.

rotated 6 odd degrees

Script-Fu is esoteric stuff, but the python plugins can actually be read, understood and written by mere mortals like me.

--
My geometry teacher was sometimes acute, and sometimes obtuse, but always,
always, he was right.
[That's an interesting angle.  I wonder if there are any parallels?]

posted at: 02:22 | path: /hacks | permalink | Tags: , ,

## The Origins of Virtue

'Ti's a tale of original sin. Is mankind selfish and evil by nature and that civilization has tamed them or did the noble savage become corrupted by the evil influence of society ? The debate is not a new one, with Hobbes holding fort for one side and Rousseau cheering on the other. Matt Ridley rides both paths deep into the subject, but to realize that neither can explain our actions completely. For the fans of Dawkins and Selfish Gene, this book will serve as a good second volume of the story, devoted to the human animal.

In the first chapter of the book, the concept of the Greater Good is dissected and laid bare. The selfishness of the individual is not a direct consequence of selfish genes and yet an individual becomes less of a well oiled machine aimed at survival and reproduction. Then we examine the myth of self-sufficiency, and the advantages division of labour brings, which can serve for the maintenance of societies. More accurately, trade and skilled labour.

But before we get too much into the territory of hawks and doves, the semantics of benevolence is put to the test. Sympathetic responses carry with them an obvious emotional reward on satisfaction. If helping somebody did make you feel better, was that an act of true altruism ? But before we destroy the whole concept of altruism, we head back towards understanding why it feels good to do good.

Duty and the Feast: Why would a hunter hunt when most of his catch is shared out to males who didn't participate in the hunt ? The sharing of meat is prevalent while plant produce is hardly ever shared out. The answer seems to be that mankind were poor hunters to start with. We were completely unequipped to be carnivores and meat was mostly a matter of luck and providence. So sharing the meat meant that the risk of going hungry was spread out among more people. It is a very good way of reducing the risk without reducing overall supply. But what's to stop the idler from exploiting the hunter and not having to work for the meat ? In other words, who'll pay for the lighthouse when everybody gets light for free ?

There's the point to redefine yet another human concept - Prestige. No man can eat a whole mammoth, but by giving it out he can exchange the perishable good into something more durable - social status. The hunter who regularly brings in meat for the tribe is likely to end up with the best women (directly or indirectly) than the idler who sat by the trail picking his nose. The social marketplace repays meat with other favours, in some sort of indirect reciprocity.

But there are other more compelling reasons to give. Hunter gatherer societies seem to have achieved the zen of comfortable living. To live comfortably, aspire for moderate means and achieve them. Rather than go further into luxury and risk jealousy, they stop. In most of these societies, to be rich is to refuse to share. An eskimo caught hoarding can be killed. The taboo paves way for equality and eliminates the class struggle, which has been the cause of economic strife for most of the modern era (count the revolutions).

Morality is drawn into the equation in the next chapter, with the rationality of most of our behaviour questioned. Often we are turned away from the rational alternative of say, taking a bribe, embezzling money or murdering your neighbour, by simple fact that we have evolved a sense of Right and Wrong. Unconsciously or even sub-consciously, we are aware that trust in us by the rest is worth preserving. Trust is the coin of trade and we are eager to prove our capacity for altruism in order to gain it.

Hypocrite's Oath: We admire selflessness. We love the Mother Theresas of the world. But we do not let altruism rule our life directly. We simply do not practise what we preach. The more other people people practise altruism, the better for us. The more we follow self-interest, the better for us. So realistically, we should follow self-interest in private, yet encourage altruism in public. And that we do.

You and what army ? : Ridley, then goes on into the root of human conflict. The group warfare of mankind is not unique among species, but only we take it to a scale of complete destruction. The extreme nature of the armies of mankind rise from the built-in conformism which lends itself well to the organization of relatively homogeneous armies of vast numbers. Face it, we're not very strong individualists.

There were wars, trade and laws before civilization took root. So what did exactly civilization bring in ? The first man who fenced off a part of pasture and said 'Mine' and found people simple enough to accept it was its true founder. If only someone had realized how much misery and horror mankind would have been spared if not for that ...

Property is one of the corner stones of civilization. Without the concept of ownership, the common turns into what is known as the Tragedy of Commons. Give a man a desert to own, it shall become a garden in nine years, but give him lease of a garden for nine, it shall become a desert. Arthur Young was spot on in saying that the magic of property turns sand into gold. But as in the fable of the man running, property meant that you could always want more and indeed own more. With that crucial step, we had broken through the taboo of hoarding and the first steps into civilization had taken mankind away from the true and narrow path of contentment.

So all in all, we were built by selfish genes who found it more convenient to make us social, trustworthy and co-operative beings. The essential paradox contained in Man remains unresolved. We are not the blank slate on which civilization has written and yet we are no more our past selves than you were the kid in your baby pictures. We have changed, but we are yet the same.

We do good and we do bad, but truly we are neither.

--
In Nature there are neither rewards nor punishments, there are consequences.
-- R.G. Ingersoll

posted at: 02:13 | path: /books | permalink | Tags: ,