The Alien wanted to know, so I trotted out a potted version of humanity's time on this planet. How we'd evolved and spread out over the world to become the various groups and races here now.
How some were rich, well fed and comfortable, and some were poor, starving and in constant pain.
'Why are some of you starving and in pain?' he asked.
While I wondered how to answer, I woke up.
Anarchy on the Allotment
Home grown memes. Not one of your five a day.
Thursday, 4 April 2013
Flummoxed by Why
Labels:
alien,
awkward question
| Reactions: |
Monday, 24 September 2012
Android OpenGL picking in Java - win a prize!
Forgive me while I get my geek on ...
I came across some posts about picking 3D objects - generated using OpenGL ES - by touching an Android's screen. They recommended using ray tracing, with up to a thousand iterations if it missed. It seemed wasteful. Here's my solution: ...
A = vertex at the Near Plane
B = vertex projected to the Far Plane
C = vertex: centre of object
We can calculate the distances a, b and c using Mr Pythagoras' splendid theorem in glorious 3D.
Then, we can use the cosine rule to calculate angA and angB (in radians).
Then the basic trig rule to calculate the distance from the center of our object to the ray cast from A to B.
So, as long as d (distance from center to ray) is less than or equal to the radius of the object and angles angA and angB are less then or equal to 90 degrees .. we have a hit.
(90 degrees is, of course, wrong! As angA and angB have their own maximum values. But the margin for errors was so slight with my view angle of 54.8 degrees - a Galaxy Ace - I ignored it. What did you find? As I type this I realise how to get the correct angles .. a prize of a signed copy of The Ardly Effect to the first correct answer.)
Here's an image (showing a miss), which I hope helps you visualise the scene ..
//
// this is an extract from some test code - a modified version of code I found ..
// .. umm .. can't remember. But it had a thousand iterations in it which
// I thought I may improve on (you tell me)
// the model view and projection matrix can be loaded using the matrixgrabber()
// which is well documented about the net
//
private boolean checkCollision(GL10 gl, float x, float y,
float[] ocentre, float radius)
{
y = mViewport[3] - y;
float [] nearPoint = {0f, 0f, 0f, 0f};
float [] farPoint = {0f, 0f, 0f, 0f};
// get vertex on near plane
GLU.gluUnProject(x, y, 0, mg.mModelView, 0, mg.mProjection, 0, mViewport, 0,
nearPoint, 0);
// get vertex projected on far plane
GLU.gluUnProject(x, y, 1, mg.mModelView, 0, mg.mProjection, 0, mViewport, 0,
farPoint, 0);
// extract and fixup
nearPoint = fixW(nearPoint);
farPoint = fixW(farPoint);
// will ray intersect sphere of radius?
//
// use cosin rule to get cosA
// then trig sine rule to calc distance
float a = distanceV(ocentre, farPoint);
float b = distanceV(nearPoint, ocentre);
float c = distanceV(nearPoint, farPoint);
float angA = (float) Math.acos(((b*b)+(c*c)-(a*a)) / ( 2*b*c ) );//cosine rule
float angB = (float) Math.acos(((c*c)+(a*a)-(b*b)) / ( 2*c*a ) );//cosine rule
float opp = b * FloatMath.sin(angA); // trig
float maxang = (float) ( Math.PI / 2d); // 90 degrees in radians Prize
// for correct mod :)
// angles A and B are <= 90 degrees and
// distance from centre of object to ray is less than ...
if (opp<= radius && angA<= maxang && angB<= maxang)
return true;
return false;
}
//
// a couple of helper functions
Exit geek mode ...
I came across some posts about picking 3D objects - generated using OpenGL ES - by touching an Android's screen. They recommended using ray tracing, with up to a thousand iterations if it missed. It seemed wasteful. Here's my solution: ...
A = vertex at the Near Plane
B = vertex projected to the Far Plane
C = vertex: centre of object
We can calculate the distances a, b and c using Mr Pythagoras' splendid theorem in glorious 3D.
Then, we can use the cosine rule to calculate angA and angB (in radians).
Then the basic trig rule to calculate the distance from the center of our object to the ray cast from A to B.
So, as long as d (distance from center to ray) is less than or equal to the radius of the object and angles angA and angB are less then or equal to 90 degrees .. we have a hit.
(90 degrees is, of course, wrong! As angA and angB have their own maximum values. But the margin for errors was so slight with my view angle of 54.8 degrees - a Galaxy Ace - I ignored it. What did you find? As I type this I realise how to get the correct angles .. a prize of a signed copy of The Ardly Effect to the first correct answer.)
Here's an image (showing a miss), which I hope helps you visualise the scene ..
//
// this is an extract from some test code - a modified version of code I found ..
// .. umm .. can't remember. But it had a thousand iterations in it which
// I thought I may improve on (you tell me)
// the model view and projection matrix can be loaded using the matrixgrabber()
// which is well documented about the net
//
private boolean checkCollision(GL10 gl, float x, float y,
float[] ocentre, float radius)
{
y = mViewport[3] - y;
float [] nearPoint = {0f, 0f, 0f, 0f};
float [] farPoint = {0f, 0f, 0f, 0f};
// get vertex on near plane
GLU.gluUnProject(x, y, 0, mg.mModelView, 0, mg.mProjection, 0, mViewport, 0,
nearPoint, 0);
// get vertex projected on far plane
GLU.gluUnProject(x, y, 1, mg.mModelView, 0, mg.mProjection, 0, mViewport, 0,
farPoint, 0);
// extract and fixup
nearPoint = fixW(nearPoint);
farPoint = fixW(farPoint);
// will ray intersect sphere of radius?
//
// use cosin rule to get cosA
// then trig sine rule to calc distance
float a = distanceV(ocentre, farPoint);
float b = distanceV(nearPoint, ocentre);
float c = distanceV(nearPoint, farPoint);
float angA = (float) Math.acos(((b*b)+(c*c)-(a*a)) / ( 2*b*c ) );//cosine rule
float angB = (float) Math.acos(((c*c)+(a*a)-(b*b)) / ( 2*c*a ) );//cosine rule
float opp = b * FloatMath.sin(angA); // trig
float maxang = (float) ( Math.PI / 2d); // 90 degrees in radians Prize
// for correct mod :)
// angles A and B are <= 90 degrees and
// distance from centre of object to ray is less than ...
if (opp<= radius && angA<= maxang && angB<= maxang)
return true;
return false;
}
//
// a couple of helper functions
//
// calc distance tween 2 vertex
//
float distanceV(float[] a, float[] b)
{
float xd, yd, zd, d;
xd = a[0] - b[0];
yd = a[1] - b[1];
zd = a[2] - b[2];
d = FloatMath.sqrt((xd * xd) + (yd * yd) + (zd * zd));
return d;
}
//
//
private static float[] fixW(float[] v)
{
float w = v[3];
for(int i = 0; i < 4; i++)
v[i] = v[i] / w;
return v;
}
Exit geek mode ...
Labels:
Android,
competition,
Java,
OpenGL,
picking,
prize,
ray tracing,
source code example
| Reactions: |
Sunday, 15 July 2012
Amazon recommends ..
Today I received an email from Amazon. They recommend I read "Buffy the Vampire Slayer".
This is how I reacted:
This is how I reacted:
Labels:
amazon,
recommends,
unimpressed
| Reactions: |
Wednesday, 25 April 2012
Mmmmm .. cookies
EU Cookie Law - are you ready?
A quote from heart internet's blog -"Last May a law was passed stating that all websites dropping non-essential cookies on visitors’ devices have to declare it publicly and ensure visitors acknowledge and agree with them to continue browsing the website. If you/your business resides within the EU, you have until the 26th May 2012 to implement your solution on your website(s). The most important thing to know is that if your website doesn’t comply with the new law, you can potentially be fined up to £500,000."
The blog is here:
http://www.heartinternet.co.uk/blog/2012/04/what-to-do-about-the-new-eu-cookie-law/
Forgive me if you're already up to speed, but as I'm fielding a lot of questions about "cookie legislation" recently (in my other life as IT Consultant and Business Mentor) I thought heart internet's blog a good place to start for anyone seeking more information on the subject.
Google's position on use of it's Analytics' Cookies (many blogging sites, including this one, use them) is still not clear. Anyone who can shed light on what they propose please get in touch.
Monday, 14 November 2011
Wrong room
I knew instantly I was in the wrong room.
My room shouldn’t have contained a perspiring middle-aged woman pointing at a flip chart in front of six assorted adults who stared blankly at .. well, me.
“Take a seat,” she said. “I’m Anita.”
Guess what I did. I sat down.
Clearly my appointment was left at the top of the stairs, not right. And I was fifteen minutes early. And Anita’s damp finger was pointing at an email address written on the flip chart which started PsychoBitch69@ … Shoot me, but I had time and I was intrigued.
“I’ve just been explaining,” said Anita for my benefit, “that your name and address should appear centered at the top of your CV.”
I nodded appreciatively. Anita looked like she needed all the encouragement she could get.
She continued, “Remember to use a normal email address. Employers aren’t going to employ someone with this kind of email address are they. And this is a genuine one I came across just the other day.”
“That was me,” said a burly woman at the other end of the little group of desks.
Anita’s mouth moved but nothing emerged.
“What’s wrong with it?” Burly woman demanded.
“Well,” Anita cleared a throat that didn’t need clearing, “imagine if you were the employer. What would you think of a person with that email address?”
“I’ve been diagnosed as psychotic,” Ms Burly explained. “I have a psychotic personality disorder. The doctor said.” Ms Burly sat back and placed a green Wellington boot on her desk. Her foot was still in it. “Shouldn’t I put that on my CV, like?”
Anita looked at each person in turn, finally stopping at me.
“I think I’m in the wrong room,” I said, and stood to leave.
The desperate look on Anita’s face will haunt me forever. Don’t leave me... it seemed to plead.
I left.
Labels:
psychotic,
wrong room
| Reactions: |
Monday, 11 July 2011
Reviewlettelette: Carrie Fisher - Wishful Drinking
It's short - you'll read it in an hour. The chapter headings are ludicrously big.
It's sometimes funny if a little repetitive. You'll smile and come away with a lot of unanswered questions.
The photos will intrigue you.
It's her one woman show edited and written down. It is not a detailed autobiography.
I suspect most women will want her as a BFF.
I was a little disappointed it was so short, but came away having enjoyed my hour with her.
It's sometimes funny if a little repetitive. You'll smile and come away with a lot of unanswered questions.
The photos will intrigue you.
It's her one woman show edited and written down. It is not a detailed autobiography.
I suspect most women will want her as a BFF.
I was a little disappointed it was so short, but came away having enjoyed my hour with her.
Labels:
Carrie Fisher,
Wishful Drinking
| Reactions: |
Tuesday, 5 July 2011
Embassytown by China Mieville
I grabbed this book as soon as it was available from Richmond Library, checked it out and skulked away like Fagin jealously hoarding a newly pilfered watch.
This is the blurb:
The back cover also spoke in glowing terms of CM's impressive intellect and originality.
Sadly, I didn't think so.
As I read, I felt two things:
This is the blurb:
Embassytown: a city of contradictions on the outskirts of the universe.
Avice is an immerser, a traveller on the immer, the sea of space and time below the everyday, now returned to her birth planet. Here on Arieka, humans are not the only intelligent life, and Avice has a rare bond with the natives, the enigmatic Hosts – who cannot lie.
Only a tiny cadre of unique human Ambassadors can speak Language, and connect the two communities. But an unimaginable new arrival has come to Embassytown. And when this Ambassador speaks, everything changes.
Catastrophe looms. Avice knows the only hope is for her to speak directly to the alien Hosts.
And that is impossible.
The back cover also spoke in glowing terms of CM's impressive intellect and originality.
Sadly, I didn't think so.
As I read, I felt two things:
- I've heard this all before,
- The Emperor's New Clothes. ie Was there really anything there?
The 'Immer': sub-space, hyper-space, whatever, it's been done.
Growing machines etc.: Videodrome or Warhammer 20K anyone?
Doppelgangers talking and acting as one: how about the two headed dragon in Quest for Camelot, or Paul Merton's Ian and Duncan Smith?
The whole 'language' thing brought Jack Vance's The Languages of Pao (first published in 1958, cripes!) to mind
Not exactly the same, granted, but close enough for me to want to tear off the 'original' tag.
Despite this - plus some strange inconsistencies I wont nitpick about - I liked the story. It had a beginning, a middle and a satisfying conclusion. [Strained metaphor alert!] It was a tasty fajita: a spicy filling wrapped in a tortilla made from flour ground by hand, over a shoe shop in Bradford, by Inuit cobblers high on marmalade. Unusual, yes. But it still tasted very familiar.
I've loved most of CM's work: King Rat, Perdido Street Station, The Scar (up until the end anyway), Looking for Jake and Other Stories etc., and will continue to be excited as each new work is released, but this one did not live up to the hype for me.
Can you see the Emperor's Clothes?
Read it. Tell me what you think.
Labels:
China Mieville,
Embassytown
| Reactions: |
Friday, 24 June 2011
Tomatoes, buses, cancer and loss
![]() |
| Richmond's Obelisk |
With the car parked close by there’s no … gap. A simple step into a mobile cubicle, a cozy journey, and I’m outside the static pile of rooms I call home.
Car-less, there’s a gap. A distance. Independence. Freedom. A sense of isolation that only the wild adventurer in me can overcome. Will I find the return bus stop? Will I get on the right bus? Will I have the correct change? The correct change … even now, crouching here in my sun-drenched conservatory, I shudder at the thought of standing before ‘the fierce gatekeeper’ - Charon, if you will - with only … notes.
Anyway ...
I’m in Richmond, free of car. Sat on the warm worn sandstone steps surrounding the Obelisk. Eyes closed, basking in the sun. My hair’s now so thin on top I can feel the rays bouncing off my dome. It feels good and I smile.
“I’m ninety-three you know.”
The voice comes from a bent old man leaning on walking sticks. His heaving chest tells me he’s out of breath.
“Are you Okay,” I ask in the loud-but-definitely-not-patronising voice I reserve for potentially aurally challenged wrinklies.
“I’m under Doctor Bagshaw. Cancer,” he tells me.
“I ... I’m ...” I’m speechless. Behind those rheumy eyes is a person. Under that concave chest beats a heart that has thumped away since the end of World War One. It was thumping when Hitler invaded Poland. Thumping when Churchill roused a nation. Thumping when my own heart first lurched into life. Thumping when I stopped other men’s hearts in Angola. Thumping now.
“You have to smile,” he says.
And off he goes - the length of his stride wouldn’t challenge an arthritic hamster - left stick, right stick, left foot, right foot … slow and steady.
It occurs to me I must have been sat quite a while for the old gentleman to have sneaked up on me like that.
The skin on my face and head is hot, dry and tight. I’ve caught the sun.
Here’s that feeling again - will the bus arrive in time to save me? Or will my dry bones be discovered crumbling onto the stone steps, one day prompting archaeologists to wonder if Obelisk worship was common around these parts.
As for prepacked tomatoes: there’s something too corporate, commercial, convenient, you must-have-this-six about them. Picking loose ones is more dangerous, free thinking, closer to nature, independent.
There: they’re out. A curtain of words drawn to hide away the thoughts of my brother’s death from cancer.
People. What are we like? You have to smile.
| Reactions: |
Tuesday, 21 June 2011
Plan to straighten Earth’s tilt meets opposition from druids
The renowned physicist Professor Apex’s annoyance at having to adjust his clock every spring and autumn led to the, by now, well known plan to straighten the Earth on its axis.After months of negotiating with the ‘Russians’, Saturn V rockets, one at each pole, were last night finally moved into place and secured horizontally, pointing, of course, in opposite directions.
A Super injunction, served on behalf of the Solstice Druids Souvenir Stonehenge Co-operative, halted Prof. Apex’s plans seconds before he was about to ‘push the button’.
“Don’t they realise,” Prof. Apex fumed at this reporter, “that the tilt of the Earth on its axis is causing all kinds of problems? Clocks have to be put back and forth every year, summer is winter in the southern hemisphere, birds are contributing to global warming with all that unnecessary migrating. It’s costing the world billions.”
A pro-tilt spokesman stopped playing his bongos long enough to say, “We like the tilt. Jobs rely on it. Sublime summer solstice. Oh, yeah baby.”
A police spokesman confirmed, “They’ll all f*cking bonkers. If that daft tw*t gets his way and straightens the f*cking Earth, who’s to say we wont all fall the f*ck off?! And if that gormless f*ck-wit wearing bed-sheets doesn’t stop playing his f*cking bongos I’ll shove ‘em right up his f*cking henge.”
An anti-tilt rally is being organised to coincide with the winter solstice in Rochdale at which Prof. Apex has vowed to continue his fight.
Tilt supporters remain unmoved.
Labels:
madness,
stonehenge,
summer solstice
| Reactions: |
Subscribe to:
Posts (Atom)





