[webkit-dev] Complex and Vector3 classes in WTF?
Chris Marrin
cmarrin at apple.com
Tue Aug 31 15:39:07 PDT 2010
On Aug 31, 2010, at 3:25 PM, Maciej Stachowiak wrote:
>
> On Aug 31, 2010, at 2:06 PM, Chris Marrin wrote:
>
>>
>> On Aug 31, 2010, at 11:48 AM, Kenneth Russell wrote:
>>
>>> On Tue, Aug 31, 2010 at 11:05 AM, David Hyatt <hyatt at apple.com> wrote:
>>>> On Aug 31, 2010, at 10:36 AM, Chris Marrin wrote:
>>>>
>>>>> Or should we get rid of Vector3, added the functionality it needs to FloatPoint3D and use that? Ken Russell already has plans to do add the functions to FloatPoint3D, so I would vote for that.
>>>>
>>>> I would vote for this. I don't think the geometry classes should move to wtf.
>>>
>>> I'd like to unify the math, geometry, and linear algebra classes that
>>> are scattered around the WebKit tree -- for example, FloatPoint,
>>> FloatPoint3D, FloatRect, FloatSize, the classes under
>>> WebCore/platform/graphics/transforms/, these Complex and Vector3
>>> types, ... -- under a directory like WebCore/math, remove duplicate
>>> functionality, and provide a cohesive set of interfaces that can be
>>> easily used by other modules like graphics and audio.
>>
>> It would be nice if we could do this unification and then later on we can enhance it so the classes play nice together. For instance, TransformationMatrix deals with many, but not all of the other geometric classes. You can't cast between FloatPoint and FloatPoint3D, etc. Maybe we could also use this opportunity to change TransformationMatrix to Matrix. The current name is such a mouthful. And we might also want to think about changing FloatPoint3D to FloatPoint3. That would make it more natural if and when we want to add a FloatPoint4. We should also change AffineTransform to AffineMatrix so it matches Matrix.
>
> Mathematically, you can have an affine transform, or a matrix that represents an affine transform. And there's such a thing as an affine space (in fact IntPoint and IntSize form an affine space). But there's no such thing as an affine matrix.
Sure there is. It's a matrix that performs affine transformations. Mathematically it's represented as a 3x3 matrix, but like others, we just represent it as a linear transformation matrix (2x2) plus a 2D translation value. I think the name AffineMatrix is descriptive because, unlike a general 3x3 matrix, our truncated representation can only handle affine transformations.
-----
~Chris
cmarrin at apple.com
More information about the webkit-dev
mailing list