Subject: Re: [boost] Geometry and spatial indexes, my opinion
From: Simonson, Lucanus J (lucanus.j.simonson_at_[hidden])
Date: 2008-10-09 14:06:45
>> In VLSI layout we sometimes represent the layer as the z axis of a 3D
>> coordinate system. Because there are only tens of layers we can use
>> something smaller than int to store it. However, the compiler will
>> often pad it back to word aligned addressing and insert padding bytes
>> into a data structure, reducing the memory savings. Also,
>> all arithmetic is 32 bit or greater, so there is no advantage in
>> smaller data types for local operations. I think it is perfectly
>> reasonable to allow point classes to have heterogeneous coordinate
>> types, but require them to cast to and from a homogeneous coordinate
>> type at the interface between that object and the geometry library.
>> all three examples, we would make the coordinate type of the
>> between the point and the library int and allow the 16 bit value to
>> up to 32 bits when it is read into an algorithm and back down to 16
>> when it is written out.
--Michael Fawcett wrote:
>I don't understand why the interface or algorithm cares whether it's
>homogeneous or heterogeneous.
The interface or the algorithm must necessarily be much more complex to
accommodate heterogeneous coordinates. Moreover, you have a real
problem with casting when you do arithmetic between heterogeneous
coordinates in an algorithm.
?_coordinate_type result = x+y;
You would probably have to register a type for casting to:
general_coordinate_type result = (general_coordinate_type)x +
Which is exactly what you do if you cast to the general coordinate type
in the interface between the algorithm and the data type.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk