Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2004-12-16 05:38:58

"John Torjo" <john.lists_at_[hidden]> wrote

> As a side-node, I'm moderately against having float coordinates. Why would
> you think int is not enough?

I would have thought that both types would be required dependent on the type
of 'space' you are in. When working in pixels or 'device units', integers
are an obvious choice ie at very low level. Each pixel is then visualised as
a rectangular tile in a grid. The object (eg a window) is closely
associated with the grid and the 'gridness' may well be taken into account
when manipulating the object , which is specifically designed to 'live'
only within the grid. However there are obvious cases (drawing a circle)
where an analogue space is a better choice to represent the object.
Scrolling and scaling are other factors

A more complete framework would have UDT's rather than ints, representing
pixels, as well as other types representing inches, millimetres as used in
(say) CSS and (I think) SVG etc, which would allow automatic conversion
(runtime for pixels) of one measure to another. It would also allow precise
control over the semantics of converting.

I have been using united types in this way for some time ( from my physical
quantities library) and find it much more convenient and pleasant ( I make
very little use of device units directly. There is always a transform to get
to the device layer) and certainly dont miss the terseness of ints or
reals, especially when reviewing the code. I have not implemented a pixel
type as yet but I think it would be well worth while., although it would all
need to be part of a cohesive 'space' system, probably with transforms for
moving from one type of space to another. The type of unit would play a
part in representing a particular view of space, either device space or
logical space) A 'C compatible' alternative to units as types is an enum
parameter representing the units in functions using units. (In both units
and in transforms MS GDI+ is worth looking at. I think it takes the enum
approach to units).

Together with the point/size issue coordinate systems are in the set of
primitives that are the building blocks of a 'space system'. like ints,
doubles and maths are the building blocks a numeric system.

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at