More fun with scary math
About 15 years ago I was in a computer shop and saw a demo for a CAD program; it ran a function called "fillet" that, for two circles already on the diagram, drew two lines between them such that the lines connected smoothly at their tangent points. I wondered immediately how to do that.
I kept wondering for years and years. It took a long time of trying to figure it out on and off, but earlier today I finally realized the piece I was missing: An equation I had never defined.
There are four possible lines that will connect the two circles at their tangent points. Two of the lines--the two I want--have both circles on the same side of the line. The other two have one circle on one side, the other circle on the other side. The first pair is what you'd get by wrapping a rubber band around the two circles. The latter two lines would cross, so they're what you'd get if you gave the rubber band a half turn.
Start with two circles. Each has a center point, C1 and C2. Each has a radius, r1 and r2. The line has two points, P1 and P2, where it touches each circle at a tangent. What was clear to me from the outset was that the line has to touch the same part of each circle; if it's at the very top of one, it's at the very top of the other. So I defined a vector v, which is a unit vector pointing from C1 to P1 or from C2 to P2.
Because v is a unit vector, it can actually be expressed as an angle, θ. From the above, P1=C1+r1v, and P2=C2+r2v. This much is easy. The equation I was missing before was this:
(P2-P1).v = 0
That is, the line from P1 to P2 is perpendicular to v. That can break down even further.
(C2-C1).v + (r2-r1)v.v = 0
And since v is a unit vector, v.v=1, and that leaves:
(C2-C1).v = r1-r2
By defining v in terms of &theta, I come up with v=<cos θ,sin θ>. So:
(C2x-C1x)(cos θ) + (C2y-C1y)(sin θ) = r1-r2
From there I made a little substitution. Since any 2D vector can be expressed as a magnitude and direction, C2-C1 could be expressed as length D and angle φ. That led to this:
D(cos φ)(cos θ) + D(sin φ)(sin θ) = r1-r2
D(cos(θ - φ)) = r1-r2
cos(θ - φ) = (r1-r2) / D
θ - φ = ±arccos((r1-r2) / D)
θ = φ ± arccos((r1-r2) / D)
And that provides the two lines. Essentially if φ is the direction from C1 to C2, θ is the angle to move along the first circle in either direction to get the tangent point.
What I learned from this math was that if one circle is completely inside the other without touching, D<|r1-r2| and no line is possible, because the arccosine can't be outside the range of -1 to 1.
With a very minor change to the original equations, where P2 = C2-r2v, this also provides the other two lines that cross. Their angles are:
θ = φ ± arccos((r1+r2) / D)
And this implies that for the crossing lines to exist, the two circles can't overlap at all (except they can touch at one point), since the calculation is only valid when D≥r1+r2.
It took me 15 years, give or take, to get the critical insight on that. Maybe by the time the bacon gets me I'll have worked out an elegant 3-page proof to FLT.
Posted by Lummox JR on Sunday, May 04, 2008 09:47PM
- 0 comments
(link)
/
Members say:
yea +1,
nay -0
DIY calzone sandwiches
What you'll need:
- Sandwich maker (for 2 sandwiches)
- 4 slices white or thin-sliced Italian bread
- 1 part ricotta cheese
- 2 parts mozzarella cheese
- Spices
Mix 1 heaping tablespoon of ricotta and double this amount of mozzarella (shredded or in chunks) in bowl. Include light seasoning in mixture; a small amount of regular black pepper and oregano works well.
Preheat sandwich maker and butter 4 slices of white or thin-sliced Italian bread. (Spray-on margarine makes this go quickly.) When ready, apply bottom pieces of bread to sandwich maker (butter side down) and spread cheese mixture on top. Cover both sandwiches with top pieces of bread (butter side up) and close sandwich maker lid. Wait standard cooking time (usually 4-6 minutes). Open lid, remove sandwiches with plastic spatula, and allow to cool slightly.
Posted by Lummox JR on Sunday, April 27, 2008 08:17PM
- 4 comments
(link)
/
Members say:
yea +1,
nay -0
Shaniqua don't live here no more
On my to-do list for tomorrow or early next week: Call Verizon and find out if I can get a phone number blocked. I'm not sure that's possible without filling out a police report for harassment, but I sure hope it is because we need it. At a rate of about one or two calls a week, since getting the new phone number back in November, we have been bombarded by a steady stream of phone calls from an elderly and possibly somewhat senile couple in Rome, NY. The phone calls at first went something like this:
"Hi, Murph."
"I'm sorry, I think you have the wrong number."
"This is the number that called me."
"You must have misdialed. Nobody called you from this number."
"Where is this?"
"This is Syracuse."
"Not Texas?"
"No ma'am, Syracuse."
"Oh."
We were confused for a while, wondering why this particular conversation happened so often. Murph, we have since learned, is the couple's son. The man rarely calls but Murph's mother has reached this number a lot. A lot. She never recognizes my voice is not Murph's, nor does she recognize that the answering machine is my wife's voice, in spite of talking to us both several times. And she keeps dialing the wrong number, over and over and over.
So why are we getting all these calls? Short answer: Even the phone numbers are bigger in Texas!
Rome and Syracuse are both in the 315 area code. Murph's area code happens to match the 3-digit exchange for North Syracuse. By coincidence, the first 7 digits of his 10-digit number exactly match our full phone number within the 315 area code. Murph's parents, however, are blissfully unaware that they have to dial a 1 before calling him. And this goes on in spite of us telling them that several times. And by several times I mean several dozen times.
As near as I can figure, their caller ID is a unit that just displays the phone number with area code but doesn't include the 1. Either it has a quick callback button that they're using--in which case the manufacturers must be killed--or they're just dialing the number by eye. Murph's dad called once and said he'd used *69 to reach us, but I find that unlikely since the phone company of all people ought to know how to connect a long-distance call; I think he just pushed a button or used caller ID and called it *69, the exact sort of semantic blunder easily attributable to an older person unfamiliar with the technology.
Those calls did have a lull a couple of months ago, where we'd get maybe one call in two or three weeks, but lately they're back with a vengeance (3-5 times per week) and they've happened at all hours, including twice in the middle of the night. One was at 12:30 when for once we'd gotten to bed at a decent time, and another was at 5:00 AM. If you do the math that's 4:00 in Texas, so Murph wouldn't have been too happy either, but screw Murph anyway. We've actually had to start turning off the ringer at night just to ensure a good night's sleep. Murph's mom leaves whole messages on our machine, still thinks I'm him when she calls here, and apparently never ever gets that not only is it vital to dial the 1, but that the phone has already started connecting her before she's hit the 8th digit.
Murph, if you're out there, I beg you to change your phone number to something with a different first four digits. Also, you need to destroy your parents' caller ID box and teach them how to use speed dial. Also, maybe disconnect their phone. No offense, man, but they've shown no signs of learning by this point and it's been five months. I'd pity the idiots who used to have this phone number, except I've gotten enough calls from their creditors to put all pity to rest.
Anyway, I need to find out if Verizon can grant us sweet relief from Murph's parents. They're not doing this out of malice, and yes I know they're just confused, but their calls are no less annoying for it. If Verizon can't help us, then I'm at a loss for how to deal with the situation. I'm not keen on changing our phone number.
Posted by Lummox JR on Thursday, April 10, 2008 09:06PM
- 10 comments
(link)
/
Members say:
yea +0,
nay -0
I still hate anime
Okay, enough with the animevangelism. You people (note the derogatory connotation) will not sway me into thinking it's good. Ever. Any of it.
Anime sucks. I'd follow that up with "in my opinion" but it's just not; it's fact. That's okay though; plenty of people like things that suck. I like some things that suck too. And plenty of people who I greatly respect like anime a lot. More power to them. But it sucks, hard and on toast.
This is the point where the animevangelists always have to step in and say: "But you just haven't seen the right anime. A lot of it is crap." I'll freely grant that there are varying levels of quality. Storylines, visual and sound idioms, and character development also have varying degrees to which they're steeped in Japanese culture, which frankly I find way too weird. But my problem is with the art. Even among the best-drawn anime, even with the ones that mostly avoid the big-eye thing and even among those that use 3 or 4 frames per second of animation instead of 2, it all falls within a certain set of traditional parameters. In other words, it all looks like anime.
I don't like the look of anime (and by extension, manga). I'm sick of seeing it. I don't want to see anything that looks like it, regardless of the quality of its story. It could be brilliant and riveting, but I just don't want to see it. It is not for me. Anyone else who wants to like it can go on liking it, but for those who do: Divest yourselves right freaking now of the delusion that anime haters can be swayed into grudgingly admitting it's not all bad, just by showing them the right anime.
"Maybe Picasso isn't for you, but there's other cubist art out there I know you'll really like."
"But you just haven't seen the right John Woo film."
"That isn't even one of Barbara Streisand's best songs; you'll like this one better."
"That nude photo of Tom Jones wasn't taken from his best angle."
"I promise, you'll love Sandra Bernhardt in this movie."
"But yesterday's Doonesbury was really funny."
I love the movie Tank Girl. You could say, with some degree of accuracy, that it sucks. It's a goofy movie, and for me it's a guilty pleasure. I'd like for more people I know to like it, but it's okay if they don't. It's not really a whole genre, but the point is there anyway. Another reason I bring it up is because there's a song in the film, a nice little punk rock ditty (2¢ by Beowülf), that sums up my feelings on the issue nicely:
You can't change my mind
You can't change my mind
You can't change my mind
You can't change my mind
So just shut up, shut up, shut up, shut up
Posted by Lummox JR on Wednesday, April 02, 2008 12:01AM
- 69 comments
(link)
/
Members say:
yea +3,
nay -2
Computer magazine atrophy: a rant
I grew up in the '80s. To say computers and their culture were different then is an understatement of titanic proportions. My favorite magazine of old was Compute!, which included several fun columns, ads for all kinds of games, articles telling you how to do such-and-such with one of a handful of different home computers, and games with code that you could type in yourself. The games were usually ported to multiple systems, so in most cases there'd be a version that could run on my family's Atari 800XL. I started programming on the Atari 400 before that, and on that machine my dad and his friends spent several long weekends typing in and playing various games that became staples in our household.
In the '90s, my love switched to PC Magazine, which featured insightful columns, reviews of programs I might end up using, regular features explaining software concepts and algorithms (I fondly remember one on diffusion dithering and another on Soundex), and most importantly, tips on how to get the most out of DOS and Windows. Today this magazine is a shell of its former self.
Around the early '90s, my uncle quipped that Computer Shopper was thick enough to stop a bullet. And it probably was; I've seen thinner phone books. Today it's not even thick enough to stop a dog from eating your slippers if you smacked him with it.
The Internet can be partly blamed for magazine atrophy, because obviously it's easier to publish content online than have to print it and line up advertisers. But I think the common thread here is not the move to online media, but the move to dumbing down the computer. Apple has always taken their OS to a level of abstraction where they don't want the user fiddling with the workings of the computer, but the PC always used to be perfect for power users. I think DOS users of the early '90s had a lot in common with Linux users of today, except for a lot less smugness, and better-looking girlfriends and more of them. But with the introduction of Windows 95, a new class of user was catered to by PCs for the first time: the lightweight user.
Lightweight users don't think about their computers as their tools, but as entertainment boxes like TVs. As a result they don't care about controlling their PCs; so their PCs end up controlling them. Windows 95 made it way, way too easy for publishers to hide info in the registry and other places. More and more internal settings and hardware issues were obscured in the name of plug-and-play. I don't count this as entirely a bad thing, because wrestling with DOS 5.0 to get your free "low" memory above 640K was never a picnic, and nobody liked having to reboot 12 times to get the exact right settings in config.sys for their sound card to work. But users who did such things understood their computers should serve them and that programs have their place.
Today, programs all come with special installers that set everything up in a certain place, and some of them will install shortcuts or even change settings willy-nilly; a bad install program will give you a partial set of options if any. In 1992 if I got a new shareware program it came in a zip file I could just stick in a directory of my own choosing, and it didn't have to look up INI files or registry crap. That ought to be true of most apps today, but shockingly few are distributed that way even when it makes perfect sense to do so. And those shareware programs, by the way, didn't time out after 30 days.
(Side note: People who use RAR religiously should be shot. People who use RAR to split a file into 500 chunks and then end up schlepping the whole thing that way over BitTorrent instead of just sending a single file in the first place should be flogged and then shot. Don't even get me started on 7-zip and Bzip users.)
Basically, Microsoft thinks we're a world of idiots. And while they may be mostly right, it's only because that's a self-fulfilling prophecy. That an everyday tool has gotten easy enough for the family dog to use is perhaps a good thing, but it also means fewer people bother to get to know their machines, and so fewer people bother to give them tips on how to use them. It's kind of like if you actively encouraged everyone in the world to own handguns and then actively discouraged them to seek any training. Or, if you don't like the gun metaphor, try SUVs. Possibly as many as 4% of SUV owners have any understanding of how to handle a vehicle that big, any need for one in the first place, or any business being on the road at all.
So... magazines. Yes. I miss the old days of magazines that didn't pander or assume I was a moron right off the bat. I miss being able to leaf through them and find info that was actually useful, like little-known commands or keyboard shortcuts that could make common tasks easier. I don't want a magazine to tell me the top 10 best new computers to buy; I want one to tell me 10 ways to punish Microsoft for inflicting Vista on the world. I'd rather be kept in the loop on useful little programs to save me time (like one my mother-in-law showed me, Taskbar Shuffle) than compare high-end graphics software. Magazines aren't fulfilling that role anymore, or at least not well. Some blogs here and there try to do that, but I've yet to find one that really interests me in that same way--and that's surprising given the sheer variety out there. There's also a lot to be said for the pleasure of simply thumbing through an actual physical magazine. But why must they all suck?
I have a beautiful vision that looks something like this: POD magazines. Individual people can create a zine, make bits or all of it available online, and produce scheduled (or semi-scheduled?) issues that are sent out to any paid subscribers. The printing company handles ads, much like Google can produce relevant ads for a website, which offsets the printing costs. Better still, this technology could be put together in a way that allows individual authors or groups to submit "building blocks" that can be put together into a master publication (with some layout restrictions or accommodations obviously), so if I found 8 different zines I partially liked I could mix them into a single magazine issue and have it sent out to me regularly. Cover art could be something the individual sub-zines vie for or perhaps something more of my own choosing, with pre-defined spaces on the sides for text on what's contained in the issue.
Because I have zero entrepreneurial spirit myself, I offer this idea freely to anyone who's willing to make it a reality. Just please, somebody let me know about it when they do.
Posted by Lummox JR on Sunday, March 30, 2008 06:36PM
- 9 comments
(link)
/
Members say:
yea +1,
nay -0