
Hi Anis,
This is internally. Of course the user can use the point directly, so can state: pnt p; p.x = 3; box1 b; b.left = 3;
Yeah, but my rationale was that you don't want to do this. My initial goal was to make my code independent of the underlying geometric primitives frameworks provide. It seems that you don't address this, do you?
Sure we address this, it was in the piece that you snipped :-) The code is independant on the underlying geometries. We provide them but you can use your own.
Currently our library can be found at: http://geometrylibrary.geodan.nl
I've taken a quick look, and here are some my impressions (correct me if I'm wrong):
- You provide your own implementation of points, boxes, circles...
Those are not the only ones possible. For the version published, users can use their own , custom, points as well. For the new version, that applies for all geometries. The new version doesn't include them by default. So you're encouraged to use your own. So this works, for example: int a[2] = {1,1}; int b[2] = {2,2}; double d = geometry::distance(a, b); No wrapper at all. That is implemented through metafunctions somewhere else.
- Through some template specializations it is possible to use (say) QPoints with your algorithms. BUT I would still be manipulating QPoints directly in the rest of my code.
Don't know exactly what you mean. It is possible to use QPoints, yes. And you can manipulate them directly, yes. Or you can manipulate them indirectly, whatever you prefer. If you're building a library piece you probably want the indirect approach. If you've a piece of user code, you probably find the direct approach more readable.
- Is a box implemented always as two points?
No. It can be left,right,top,bottom as well. Or left,right,top,bottom,front,back for a 3D box. There is a traits version giving access to the individual coordinates. However, that cannot yet be seen, it will be there soon. So this works as well: int box[4] = {1,1,10,10}; int c[2] = {5, 5}; bool is_inside = geometry::within(c, box); Regards, Barend