[webkit-dev] Complex and Vector3 classes in WTF?

Chris Marrin cmarrin at apple.com
Tue Aug 31 10:36:00 PDT 2010


I just noticed these classes, added 7 months ago as part of Chris Rogers' audio work. I think it's a mistake to have these in WTF for a few reasons:

1) Complex is just std::complex with a single added function, complexFromMagnitudePhase(), which seems pretty audio specific, so it should go with the audio code

2) Vector3 has a name very similar to Vector, but with completely different functionality. I actually opened wtf/Vector.h thinking I was going to see a 2D Vector class (because I was in that mindset), then I remembered the _other_ meaning of Vector! So I think it's pretty confusing.

3) Vector3 goes along with other classes, like 2D point, matrices and maybe even lines, planes and other geometry related things. Right now we have FloatPoint2D, FloatPoint3D and TransformationMatrix in WebCore/platform/graphics. These should all be together.

I think we should move Complex.h over to live with the rest of the Chris' audio code. Vector3 is a more complex ( ! ) issue. Should we move all the geometry related classes to WTF? If we did I think that should include all the Rect and Box classes as well. 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. 

There's one other problem. Vector3 uses doubles, while FloatPoint3D uses floats. Chris, do you need doubles for your use, or would floats suffice?

What do others think?

-----
~Chris
cmarrin at apple.com






More information about the webkit-dev mailing list