[cairo] integer world coordinate system
M.R.
makrober at gmail.com
Wed Aug 18 01:12:14 PDT 2010
On 08/18/2010 03:35 PM, Chris Wilson wrote:
> On Wed, 18 Aug 2010 14:17:04 +0800, "M.R."<makrober at gmail.com> wrote:
>> We are evaluating options for graphics on a new project. Cairo is
>> high on the list, with one potential problem:
>>
>> The application area 2-D "world-space" is in our application in
>> "display surface scaled" integer coordinates...
>
> Right. You have to remember that you are not the first to wonder...
Hi Chris;
thank you very much for the quick response.
> Numbers talk. Converting the interface isn't a major task, so if you feel
> that it would be better to use integer-only for your code, please do try
> and tell us what difference it made.
Our application takes a multi-dimensional physical model of reality and
"flattens" it into something that can be shown on a screen or printed
page. We end up with large "poly-line" coordinate arrays. Memory
is an issue.
Some lines are the result of a complex, expensive mathematical
productions. If the application knows what pixel of the 2D graphical
space a point on a multidimensional curve will end on, it can do the
following ("Compute" in the following is something expensive"):
Get line segment multidimensional end-points (A) and (B) from stack.
Compute pixels [A] and [B] (corresponding to (A) and (B)).
Compute pixel [M] of mid-pint between (A) nad (B).
If the [M] is the same as mid-pixel of [A] and [B], connect
[A]-[M]-[B] with straight lines in display cordinate space.
Else push (M) and (B) on stack and process (A) to (M) segment.
This will yield a line that has used as few expensive computations
as possible, yet be rendered with maximum granularity the display
is capable of.
More examples could be given, but these two are in themselves enough
for us to require that the application (and not the graphical platform)
handles the "last step" in the coordinate pipeline between the
multi-dimensional physical reality and the 2D display pixel.
thanks again for your interest;
Marko R.
More information about the cairo
mailing list