gp_XYZ, gp_Pnt and friends.....

Hi !

Would it be possible to add an operator or method to access a gp_XYZ object as a const double* array ?

This is useful many times when Open Cascade is used outside AIS to render to OpenGL as you can use glVertex3dv( xyz); instead of glVertex3d( xyz.X(), xyz.Y(), xyz.Z());

this executes a bit faster and generates smaller code, when a large number of points are passed on to OpenGL this can speed everything up a lot.

To make this a nice clean solution it would need a change to the gp_XYZ class to use an array for the coordinates: double coord[ 3]; instead of todays: double x,y,z; but as these members are protected anyway this should not have any effect on existing applications.

Would this be possible to implement ?


Robert Boehne's picture

Yes, that would be very simple to implement, so go right ahead and do it. ;)


Mikael Aronsson's picture

Hmmmm, I thought it would be simple :o), but ok I can fix it myself, but when I have fixed it, to whom do I send the changes if I would like to have them included with the Open cascade distribution, can I just send this to the forum or is is there a better place for this ?


Robert Boehne's picture

Unfortunately there is no formal description of how to contribute on this website, but I would suggest that you do the following after you have made your improvements to the code and tested them thoroughly:

  • Generate a patch. The simplest way is to use the cvs diff command. If you would like more detail, read the GCC web page concerning contributions.
  • Email your patch as an attachment with a description of why the change is needed, what the change does, and perhaps how the changed code works.  To determine who should get your patch, see the Core Team page and find the project most relevant to your patch.

In the GNU world, there are typically three mailing lists for a project, one for general discussion, one for patches, and one for cvs commit messages (automatically sent out by the cvs server).   This format makes it easy for users to get info they need, developers to get what they need, and patches can be tested out by anyone who subscribes to the patches list.   I would also add that OCC could benefit from a similar scheme.

Yan's picture

Please send your changes to or to me as attached files or as tar.gz file if bigger. Send us a little documentation and impact description if any. We will be very happy to integrate and publish it in the current development version if it is validated. We are currently preparing stuff for publishing via CVS.

Best regards.