geassign.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // DESCRIPTION:
  12. //
  13. // Useful macros for converting from various C-struct definitions
  14. // of points and vectors to their equivalent acgelib definitions.
  15. //
  16. // This header file should ONLY be included in source files,
  17. // never headers as it is only intended to be an internal utility
  18. // for interfacing to old AutoCad C-code and other 3rd party libraries.
  19. #ifndef AC_GEASSIGN_H
  20. #define AC_GEASSIGN_H
  21. #pragma pack (push, 8)
  22. class AcGePoint2d;
  23. class AcGeVector2d;
  24. class AcGePoint3d;
  25. class AcGeVector3d;
  26. inline AcGePoint2d&
  27. asPnt2d(const double* pnt)
  28. {
  29. return *((AcGePoint2d*)pnt);
  30. }
  31. inline AcGeVector2d&
  32. asVec2d(const double* vec)
  33. {
  34. return *((AcGeVector2d*)vec);
  35. }
  36. inline double*
  37. asDblArray(const AcGePoint2d& pnt)
  38. {
  39. return (double*)&pnt;
  40. }
  41. inline double*
  42. asDblArray(const AcGeVector2d& vec)
  43. {
  44. return (double*)&vec;
  45. }
  46. inline AcGePoint3d&
  47. asPnt3d(const double* pnt)
  48. {
  49. return *((AcGePoint3d*)pnt);
  50. }
  51. inline AcGeVector3d&
  52. asVec3d(const double* vec)
  53. {
  54. return *((AcGeVector3d*)vec);
  55. }
  56. inline double*
  57. asDblArray(const AcGePoint3d& pnt)
  58. {
  59. return (double*)&pnt;
  60. }
  61. inline double*
  62. asDblArray(const AcGeVector3d& vec)
  63. {
  64. return (double*)&vec;
  65. }
  66. #pragma pack (pop)
  67. #endif