Diagram difference with SL

Is something wrong? Do you have any suggestions? Let us know.
Post Reply
User avatar
HermanHiddema
Gosei
Posts: 2011
Joined: Tue Apr 20, 2010 10:08 am
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Location: Groningen, NL
Has thanked: 202 times
Been thanked: 1086 times

Diagram difference with SL

Post by HermanHiddema »

While developing my diagram builder, I noticed that Life in 19x19 renders handicap points differently than Sensei's Library. Some more research shows that this is related to how circles are drawn.

Here's how L19 renders

Click Here To Show Diagram Code
[go]$$B
$$.,TCSM?,|
$$OXBWAV*,|
$$--------+[/go]


Here's how SL renders:

Image

The handicap point difference is the most noticable, but actually all circle shapes, including stone outlines, are slightly different.

Handicap points, for example, are made by drawing three concentric circles with diameter 6,5 and 4.

Here's the pixels SL chooses:

Image

which are these:

Click Here To Show Diagram Code
[go]$$B
$$ . . . X . . .
$$ . X X X X X .
$$ . X X X X X .
$$ X X X . X X X
$$ . X X X X X .
$$ . X X X X X .
$$ . . . X . . .[/go]


And here's the pixels L19 chooses:

Click Here To Show Diagram Code
[go]$$B
$$ . . . . .
$$ . + + + .
$$ . + , + .
$$ . + + + .
$$ . . . . .[/go]


which are these:

Click Here To Show Diagram Code
[go]$$B
$$ . . X X X . .
$$ . X . X . X .
$$ X . X . X . X
$$ X X . . . X X
$$ X . X . X . X
$$ . X . X . X .
$$ . . X X X . .[/go]


This isn't really important, of course, either result is understandable by the readers. I like the SL result slightly better, as it seems strange to have empty space inside handicap points :)

I think this is caused by how PHP's ImageArc function decides on which pixels to draw. Whereas the SL version of PHP seems to choose the closest lower pixel by distance, L19's PHP version seems to just choose the closest. E.g. with a circle of diameter 6, so radius 3, which Y corresponds to X=1 given pythagoras' X2 + Y2 = Z2? There are two candidates: Y=2 gives sqrt(12 + 22) = sqrt(5) = 2.236. Y=3 gives sqrt(12 + 32) = sqrt(10) = 3.162. SL's version of PHP chooses Y=2 (closest value not over 3), whereas L19's PHP chooses Y=3 (closest value).

I thought I'd document it here in case people wonder why the diagrams they get here look slightly different than the ones that my diagram builder seems to promise ;)
User avatar
EdLee
Honinbo
Posts: 8859
Joined: Sat Apr 24, 2010 6:49 pm
GD Posts: 312
Location: Santa Barbara, CA
Has thanked: 349 times
Been thanked: 2070 times

Post by EdLee »

HermanHiddema wrote:sqrt(10) = 3.162. SL's version of PHP chooses Y=2 (closest value not over 3)
But 3 is the "closest value not over 3", is it not?
Unless by "not over 3" you mean "not equal to 3 or over," which means "less than 3" ?
User avatar
HermanHiddema
Gosei
Posts: 2011
Joined: Tue Apr 20, 2010 10:08 am
Rank: Dutch 4D
GD Posts: 645
Universal go server handle: herminator
Location: Groningen, NL
Has thanked: 202 times
Been thanked: 1086 times

Re:

Post by HermanHiddema »

EdLee wrote:
HermanHiddema wrote:sqrt(10) = 3.162. SL's version of PHP chooses Y=2 (closest value not over 3)
But 3 is the "closest value not over 3", is it not?
Unless by "not over 3" you mean "not equal to 3 or over," which means "less than 3" ?


I meant the closest value where the result of sqrt(X2 + Y2) is not over three.
Post Reply