[webkit-dev] Int/FloatPoint and Int/FloatSize

Steve Block steveblock at chromium.org
Thu Jan 3 22:32:51 PST 2013


> I find point - point = size quite useful in general, and it seems to make logical sense.
I agree that it makes logical sense, but I think that 'point - point =
point' also makes sense, and is perhaps more frequently the right
choice.

> What would you call this type, avoiding confusion with Vector<>?
I guess 'Offset' is an obvious candidate, but that is probably already
too overloaded. Perhaps RelativePosition or RelativePoint?


On 4 January 2013 16:15, Simon Fraser <simon.fraser at apple.com> wrote:
> On Jan 3, 2013, at 7:43 PM, Steve Block wrote:
>
>> Thanks all for the detailed replies.
>>
>> I wasn't aware of the distinction made between points and vectors for
>> the purposes transforms. However, if I understand things correctly,
>> introducing a vector type could be considered separately from the
>> issue I initially raised.
>>
>> It seems that everyone is agreed that xxxSize should be used only when
>> you really want to represent a size. A good first step would be trying
>> to enforce this, such that all points and vectors are represented with
>> xxxPoint. As Shawn points out, when doing this, we need to make sure
>> that we continue to use the correct homogeneous coordinate for
>> transforms. Removing the existing subtraction operator (xxxPoint minus
>> xxxPoint returns xxxSize) might be a good place to start.
>
> I find point - point = size quite useful in general, and it seems to make logical sense.
>
>>
>> Introducing the concept of a vector could then be done in a second phase.
>
> What would you call this type, avoiding confusion with Vector<>?
>
> Simon
>


More information about the webkit-dev mailing list