Subtraction of two points should not equate to a size. That's would be 
unexpected behavior for anyone used to working in 2D space. Mathematically 
speaking point - point equates to a vector. When writing a vector math library 
there typically isn't a differentiation made between a point and a vector, 
mainly because there's a lot of code overlap between the two. However when they 
do for 3D values a point is x, y, z, 1 while a vector is x, y, z, 0.

On a somewhat unrelated note is there any interest in getting a SIMD 
implementation of these classes?

From: webkit-dev-boun...@lists.webkit.org 
[mailto:webkit-dev-boun...@lists.webkit.org] On Behalf Of Ryosuke Niwa
Sent: Friday, January 04, 2013 12:19 AM
To: Steve Block
Cc: WebKit-Dev Development
Subject: Re: [webkit-dev] Int/FloatPoint and Int/FloatSize

On Thu, Jan 3, 2013 at 10:32 PM, Steve Block 
<stevebl...@chromium.org<mailto:stevebl...@chromium.org>> wrote:
> 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?

I don't think "Relative" adds any value here.

Also, the word "position" is used to represent a tree-position in DOM in WebKit 
so please don't use that to represent a point in a screen or a layout 
coordinate system.

I don't like "offset" either because it's such an overloaded word. e.g. 
"offset" is often used to mean a child node index in DOM.

- R. Niwa

_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to