[ocaml-opengl] [Caml-list] standard 3d vector library in OCaml

Daniel Bünzli daniel.buenzli at erratique.ch
Fri May 10 18:01:38 BST 2013



Le vendredi, 10 mai 2013 à 16:48, Florent Monnier a écrit :

> A very good link, thanks a lot!
> There's a huge amount of content, could you share which you think
> would be the more interesting for reuse in OCaml?

I think each of them serve different purpose (e.g. computational trade-offs on embedded platforms) that's the reason why these things are best left outside gg for now.  

> It seems logic to me to do it the way you've made it.
> I would only comment that if you add Sizes, BBoxes, then why not also
> bounding-cirlces / bounding-spheres, complete math for geometry with
> points, lines, planes, etc. (distances, intersections, projections,
> etc.)

I don't plan to integrate these things, no pull requests please. At a certain point I was planning to but it was becoming unwieldy -- remnant of these ideas can be seen in the tmp/ directory of the first commit. Gg provides you with the essentials to do 2D or 3D computer graphics. Sizes and rectangles are ubiquitous: viewports, image extents, etc. and that's the reason they are in. More general computational geometry tools are best left to another dedicated library.
  
> The internal representations for vectors and points are not public,
> which would imply to integrate these inside your module.

Regarding the internal representation I still have to think about what I will do. Gg is designed to interoperate with C so that means that the representation will be cast in stone anyways.

> Maybe a compromise could be found,
> between one letter function names:
>  
> Size3.w
> Size3.h
> Size3.d
>  
> and complete names:
>  
> Size3.width
> Size3.height
> Size3.depth
>  
> could be 3 letters abbreviations:
>  
> Size3.wid
> Size3.hei
> Size3.dep

Well, no… it's horrible to read, hard to remember and inconsistent: if you look at all the other vector types in Gg their coordinate accessors all have a single letter V2.{x,y}, P2.{x,y}, V3.{x,y,z}, P3.{x,y,z}, V4.{x,y,z,w}, Color.{r,g,b,a}, Quat.{x,y,z,w}. Having Size2.{w,h} and Size3.{w,h,d} feels natural.  

> I would recommend not to assume that everyone share the same cognition
> and tastes than you.

I certainly don't assume that. I do however program and design to my taste, not by consensus or compromise.

Best,

Daniel




More information about the OpenGL mailing list