| |
Current Topic: Miscellaneous |
|
Bresenham's line algorithm |
|
|
Topic: Miscellaneous |
5:08 am EST, Feb 18, 2008 |
DrawingSpace.prototype.drawLine = function(x0,y0,x1,y1) {
var steep = Math.abs(y1 - y0) > Math.abs(x1 - x0);
var tmp = 0;
if(steep) {
//swap(x0, y0)
tmp = y0;
y0 = x0;
x0 = tmp;
//swap(x1, y1)
tmp = y1;
y1 = x1;
x1 = tmp;
}
if(x0 > x1) {
//swap(x0, x1)
tmp = x1;
x1 = x0;
x0 = tmp;
//swap(y0, y1)
tmp = y0;
y0 = y1;
y1 = tmp;
}
var deltax = x1 - x0;
var deltay = Math.abs(y1 - y0)
var error = -(deltax + 1) / 2
var ystep;
var y = y0;
if(y0 < y1) {
ystep = 1;
} else {
ystep = -1;
}
for(var x = x0; x <=x1; x++) {
if(steep) {
this.buffer.setXY(y,x);
} else {
this.buffer.setXY(x,y);
}
error += deltay;
if(error >=0) {
y += ystep;
error -=deltax;
}
}
}
Now why would you ever need an integer optimized line drawing algorithm in JavaScript? :-) Bresenham's line algorithm |
|
Topic: Miscellaneous |
9:11 am EST, Feb 15, 2008 |
Today I used the phrase "John Terrill Approved" to win an argument. Yes, it was excellent. |
|
Topic: Miscellaneous |
9:58 pm EST, Feb 14, 2008 |
Events can be set to trap when the image has finished loading and what the size of the image is. This creates a side channel for JavaScript to communicate with certain 3rd party hosts using the dimensions of the image. In practice, XBM images tend to work best because you can specify arbitrary lengths and widths up to a 15bit integer without actually needing an image of that size.
I knew I had talked about this publicly before! This was from Jan of 2007. Good to know I'm not going crazy :-) More image side channels |
|
HP Aims To Improve Software Management -- Hewlett-Packard -- InformationWeek |
|
|
Topic: Miscellaneous |
4:53 pm EST, Feb 6, 2008 |
Nine out of the world's top 11 security hackers came to HP through the SPI Dynamics acquisition, he boasts, although it's not immediately clear who ranked those top 11.
Just in case the world missed the memo. ... ... [sigh] I can't even think of what to say about this. Expressing oneself through charts is a good idea. HP Aims To Improve Software Management -- Hewlett-Packard -- InformationWeek |
|
Topic: Miscellaneous |
3:51 pm EST, Feb 6, 2008 |
There is an electric and unsettling calm after you compose certain kinds of emails and then you click "send." |
|
Pickles + FedEx = teh Awesome!!!111 |
|
|
Topic: Miscellaneous |
12:37 pm EST, Feb 5, 2008 |
After we wrote the book, Addison Wesley sent Bryan and I some pre-paid FedEx envelopes so we could send signed copies of the book to the reviewers and editors. Our pal Vinnie Liu was a reviewer but he had already come by our offices in Atlanta where he received his signed copy. This presented Caleb and I with a very interesting situation: We had a prepaid and pre-addressed FedEx envelope for Vinnie and nothing legitimate that we needed to send him. What to do, what to do? So we cut out the tracking number, cut out the return address, and we sent him a giant pickle. No message. No Explanation. Just Pickle. Beware friends beware. The pickle wars have begun! Pickles + FedEx = teh Awesome!!!111 |
|
Sorry, this page requires a crappy out of date browser |
|
|
Topic: Miscellaneous |
11:51 am EST, Feb 5, 2008 |
Sorry, this page must be viewed by Internet Explorer 3.0 or greater. Your current browser ( Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11) is not supported.
Are you kidding me? Its 2008, and you are giving me IE3+ messages? ...[grits teeth] ... ... [head explodes] Sorry, this page requires a crappy out of date browser |
|