![]() |
【转帖】geometry issue
geometry issue
geometry issue hi, in objectarx we had several very useful functions: like this one: inline double* asdblarray(const acgevector2d&); we could use it in cases where array of 3 doubles were used. is this something like these in the dwg toolkit or can someone place them for the next release? of course we can use something like (&vec.x) for array but i'm not sure how afety it is. regards chudomir best regards chudomir i'd prefer if you use your own definitions like inline double * asdblarray(odgepoint2d & pt) {return &pt.x;} if we include them into common interface we need to be sure that it works correctly on all supported platforms. sergey slezkin ok, no problem. but the classes odgepoint2d/3d etc miss the #pragma pack(n) directive as in objectarx files. can this cause problems? thanks. chudomir delchev best regards chudomir you are right that dwgdirect public headers must contain: #pragma pack(push, ...) .... #pragma pack(pop) else client project can't have alignment different from one used while compiling dwgdirect. but even without them problems with asdblarray can happen only if you use #pragma pack(16) in your project. sergey slezkin thanks for the info. and here is a sample header for these, but i have no time to test them. anyway i thinke they should work: [code] #ifndef geassign_h #define geassign_h #pragma pack (push, 8) class odgepoint2d; class odgevector2d; class odgepoint3d; class odgevector3d; inline odgepoint2d& aspnt2d(const double* pnt) { return *((odgepoint2d*)pnt); } inline odgevector2d& asvec2d(const double* vec) { return *((odgevector2d*)vec); } inline double* asdblarray(const odgepoint2d& pnt) { return (double*)&pnt; } inline double* asdblarray(const odgevector2d& vec) { return (double*)&vec; } inline odgepoint3d& aspnt3d(const double* pnt) { return *((odgepoint3d*)pnt); } inline odgevector3d& asvec3d(const double* vec) { return *((odgevector3d*)vec); } inline double* asdblarray(const odgepoint3d& pnt) { return (double*)&pnt; } inline double* asdblarray(const odgevector3d& vec) { return (double*)&vec; } #pragma pack (pop) #endif </pre><hr></blockquote> best regards chudomir not sure that #pragma pack (push, 8) would compile on all dwgdirect-supported platforms... sergey slezkin |
所有的时间均为北京时间。 现在的时间是 07:24 PM. |