2014-11-20 10:13 AM - last edited on 2023-08-01 01:58 PM by Doreena Deng
2014-12-03 11:34 AM
// ----------------------------------------------------------------------------- // Dump a vertices of a body (VERT) // ----------------------------------------------------------------------------- static void DumpVertices (Int32 ibody, const API_Coord& dbOffset) { API_Component3D component; Int32 j, nVert; API_Tranmat tm; GSErrCode err; WriteReport ("BODY #%d", ibody); BNZeroMemory (&component, sizeof (component)); component.header.typeID = API_BodyID; component.header.index = ibody; err = ACAPI_3D_GetComponent (&component); if (err != NoError) { WriteReport (" ERROR"); return; } nVert = component.body.nVert; tm = component.body.tranmat; WriteReport (" VERTs"); for (j = 1; j <= nVert; j++) { component.header.typeID = API_VertID; component.header.index = j; err = ACAPI_3D_GetComponent (&component); if (err == NoError) { API_Coord3D trCoord; // world coordinates trCoord.x = tm.tmx[0]*component.vert.x + tm.tmx[1]*component.vert.y + tm.tmx[2]*component.vert.z + tm.tmx[3]; trCoord.y = tm.tmx[4]*component.vert.x + tm.tmx[5]*component.vert.y + tm.tmx[6]*component.vert.z + tm.tmx[7]; trCoord.z = tm.tmx[8]*component.vert.x + tm.tmx[9]*component.vert.y + tm.tmx[10]*component.vert.z + tm.tmx[11]; trCoord.x += dbOffset.x; trCoord.y += dbOffset.y; WriteReport (" [%2d] (%lf, %lf, %lf)", j, trCoord.x, trCoord.y, trCoord.z); } } return; } // DumpVertices //------------------------------------------------------------------------------------------ err = ACAPI_Element_Get3DInfo (elemHead, &info3D); if (err == APIERR_BADID) { WriteReport_Alert ("This element does not have 3D information."); return; } if (err != NoError) { ErrorBeep ("Error in ACAPI_Element_Get3DInfo", err); return; } for (Int32 ibody = info3D.fbody; ibody <= info3D.lbody; ibody++) DumpVertices (ibody, dbOffset);