CompuServe Messages

#kxp_get_xform

    28-May-94 12:20:19
Sb: #kxp_get_xform
Fm: Dave Swift 72640,370
To: Jonas Ruikis [ADESK] 73172,1351
I found my problem with kxp_get_xform. If you look at the macro definition in exprtn.h, and work all of the definitions backwards. The KC variable is defined as an extern _far pointer to a KXPComm structure. The final transfer of the 12 element xform matrix from the KC structure to the users variable in the kxp_get_xform macro is accomplished with the memcpy function. I expanded the macro manually in my program and traced the crash down to the memcpy function. When I replaced the memcpy with an element by element copy, things worked fine. I think the problem is that the Watcom version of memcpy does not like the _far modifier. You said the xform.c code I sent you compiled fine under Metaware. Watcom users should beware of this. I grep'ed all the .h files for other uses of memcpy and found none – only kxp_get_xform uses it. With kxp_get_xform working, I could finally try out the xform.c code (a fragment from a larger kxp IPAS routine) and found that it didn't work. I incorrectly assumed that kxp_get_xform returned a relative transformation matrix (relative to the parent) so I traversed the link tree back to the root and collected all the xforms. To correctly determine the world position, you only need to find the xform of the immidiate parent which is in line with the code fragment of Dan's that you showed me. Next time I'll read the manual more closely. You may want to remove the xform.zip file from the library if you posted it since it is incorrect.