|
|
Special code 00B (11) draws an arc that doesn't necessarily start and end on an octant boundary. The definition uses five specification bytes.
11,start_offset,end_offset,high_radius,radius,(-)0SC
The start_offset and end_offset represent how far from an octant boundary the arc begins or ends. The high_radius represents the most significant eight bits of the radius; the high radius will be 0 unless the radius is greater than 255 units. Multiply the high_radius value by 256 and add that value to the radius value to generate an arc radius greater than 255. The radius and ending specification byte are the same as for the octant arc specification (code 00A, described previously).
You determine the startoffset by calculating the difference in degrees between the starting octant's boundary (a multiple of 45 degrees) and the start of the arc. Then, you multiply this difference by 256 and divide by 45. If the arc starts on an octant boundary, its start offset is 0.
The end offset is calculated in a similar fashion, but you use the number of degrees from the last octant boundary crossed to the end of the arc. If the arc ends on an octant boundary, its end offset is 0.
For example, a fractional arc from 55 degrees to 95 degrees with a 3 unit radius would be coded as follows:
11,(56,28,0,3,012)
start_offset = 56 because ((55 - 45) * 256 / 45) = 56
end_offset = 28 because ((95 - 90) * 256 / 45) = 28
high_radius = 0 because (radius < 255)
radius = 3
starting octant = 1 because arc starts in the 45 degree octant
ending octant = 2 because arc ends in the 90 degree octant