- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
You also can calculate fewer points where pixels are plotted adjacent to each other. By stepping in the direction of most change, you can get the most return for the least amount of computation (i.e. if you step x by 1px and y doesn't change, that was a waste of a computation; you should've stepped y by 1px instead).
If you just want a plain vanilla circle, you only have to compute 1/8 of the circle; each point you compute can be plotted a total of 8 times due to symmetry (of course, it would be slightly more complicated to plot an ellipse or an arc).
In all, to plot a circle you only need to call square root about (1-sin(45º))radius times (about 0.3radius; to plot a circle with a radius of 100, the square root function is called 30 times).
Someone posted a comment mentioning a Bresenham algorithm and saying that it requires no floating-point operations. Since I'm not familiar with it, here's my go at an optimized circle-plotting algorithm that uses square root (much faster if it was implemented in assembly rather than this HTML5 demo, obviously).
Admin
Google for "Bresenham" which will get you to the Bresenham circle drawing algorithm. Works just fine with integer add, subtract, and compare only, so it is perfectly suited to any 1990's computer that is probably a bit weak in the floating-point department.
Admin
Basically, I meant to show that some simple algebra can yield a much more efficient solution than stepping an angle and computing x and y coordinates with slow trig functions.
Note that with slight modification, the code I posted could be modified to use only integers, including a fast integer square root function (since a fractional result isn't needed anyway):
I might try implementing the Bresenham circle drawing algorithm, too. HTML5 wouldn't be a very good way to compare the two, though... the pset() method is too slow.Admin
are you sure you mean german city of dresden and not us city of dresden? because i happen to live some time of the year in german dresden and i was curious and started googling, but i've found only us plant...
Admin
You have not experienced the pipes screen saver on Windows NT?
Admin
Please let me know if you find any other numbers ending with 0 that need the "st" suffix. Up until now, I was certain they all should have "th". Your obvious superiority in this area has convinced me to rethink my ways :-)
Admin
Admin
Admin
Ah, the LEO.
While the Yanks built ENIAC to aim bombs, the Poms built LEO to run tearooms.
Admin
Admin
I'll just leave this here:
https://www.youtube.com/watch?v=rp8hvyjZWHs
Admin
"The technique had been around for 20 years and there were many people in the world who knew who to do it" is not at all the same as "this particular person here knew how to do it".
Smart as I like to think I am, I'm sure there are many many things that other people know that I don't. I'm sure that there are many things that I do a hard way because I not only don't know how the easy way, but because it just doesn't occur to me that there might be an easier way, and so I blunder ahead.
Admin
Bad example. "Texas" is just a myth invented by Tea Party folks to scare liberals.
Admin
The operative word being "should".
In any cases, a key point in the story was that the Czech company was NOT supporting the computer any more, they dumped him off on another customer.
Admin
Thanks for making me laugh. Now for the reality check - it's nice that you've done something or your mother did, but you've both still done it on computers. Real computers, working ones, worthy the name "computer". Russian copies of s/360 and subsequent IBM mainframes were completely different beasts, impossible to imagine for a lowly Westerner whose Capitalism-opressed mind simply can't fathom the advanced reality of Socialist industrial production. Simple payroll programs were always run twice and if the results were the same, the run was correct. If they differed, than you had to run it for the third time and if the result was equal to one of the previous ones, those were correct. Not sure what was the procedure for three different outputs but I guess something along the lines of drinking lethal amount of tetrachlorine based cleaning liquid (alcohol based was originally used, but the techs and programmers drowned too much sorrows with it).
Admin
Four of the space shuttle's computers, based on IBM 360 with modifications, produced the same result but it was wrong. One computer, programmed by a different team, produced a different result and it was right. The Americans didn't even let the majority rule but they scrubbed the mission until they figured out what happened.
Admin
Aah, thats why some company+ today uses circles!
Admin
"Oh Dresden 2 why can't you be more like Dresden 1?"
captcha: duis "duis quoting from the Simpsons."
Admin
And here's my x86 assembly code version of the midpoint circle algorithm, using the optimized algorithm from Wikipedia.
Admin
Here's my optimized version:
//it's in the library makeCircle(x, y, radius);
Admin
Admin
Admin
Boom - headshot!
Captcha - haero - a chocolate bar with bubbles and a hair in
Admin
To be fair, they did use the Bresenham algorithm for their lines.
Admin
Admin
Seriously, it's like you didn't read the story at all.
Admin
Where in the story did it say that it referenced a library?
Admin
I can't say with 100% certainty that he didn't write the circle function himself, but I'd put very high odds on him not. He read the documentation, found the part that said "to draw a circle:", and said "ooh pretty" and proceeded to use the function provided, which blew up.
Admin
Possibly, even likely. But we don't have that info. So I'm fine with just making a sarcastic comment.
Admin
The computer's behaviour was perfectly logical. Circular logic caused an infinite loop.
Admin
And the infinite loop caused circular logic.
Admin
Admin
Isn't that photo from Slovakia? From Jaslovske Bohunice?
Admin
TRWTF is changing the UI from what's familiar to the engineers to "fancy cool circles" and assuming that it will be an improvement, when his job was to fix Y2K bugs. At worst, it'll confuse the engineers enough so they'll start making mistakes.
Sure, there's a lot to say about testing in production, and no rollback plan, and having an undergraduate mess about the control room software. This is inexcusable but there's no reason it couldn't have happened in countries with low level of regulatory enforcement (US, France, etc). Either way, "Ulrich" doesn't mean the story happened in Germany - this could be Belgium, Spain, Switzerland or it could even be in Argentina. Romania has a plant designed in the 80s, and the equipment could be delivered way back then. Slovenia has a reactor that would fit the picture. Slovakia as well.
The country of origin for the reactor design doesn't matter, since the I&C might have been bought from another supplier, or lowest bidder. Anyway, my money's on Hungary.
However I can guarantee you, even without knowing which plant is in question, that the actual control of the plant is elsewhere, and given the setting implemented by hard controls. Besides, the protection system will have been relay based and completely separated. Relay automation is still widely used anyway in 2013.
Too bad that with some current designs, everything is networked so the scenario in the story has potential to screw up all the systems in one fell swoop.
Admin
Circle of WANK!
Admin
this reminded me of a quote in a magazine: "how many nuclear power plant employees does it take to change a light bulb? 53." that is NOT A JOKE! when replacing the bulbs in the warning lights on the main console, they are required by FEDERAL LAW to use a ridiculously complicated procedure that takes 53 people to perform. (in the USA)