bool test_Matrix() { Matrixd a = { {1, 4, 9}, {6, 4, 2}, {8, 0, 3}, {3, 3, 8} }; Matrixd b = {{6.0000, 7.0000, 12.5000, -88.3423}, {2.0000, -8.1100, 3.1415, 4.7000}, {0.1250, -2.3390, 3.5820, 98.3810} }; Matrixd a_t_b = {{15.125, -46.491, 57.304, 815.88666}, {44.25, 4.882, 94.73, -314.49204}, {48.375, 48.983, 110.746, -411.59572}, {25, -22.042, 75.5805, 536.12098} }; Matrixd a_t_777 = {{7.7700, 31.0800, 69.9300}, {46.6200, 31.0800, 15.5400}, {62.1600, 0, 23.3100}, {23.3100, 23.3100, 62.1600}}; Matrixd b_t_a = {{-117.0270, -213.0270, -601.2387}, {-7.4280, -10.3400, 48.8045}, {309.8900, 286.2870, 794.2410}}; // (a*b).ShowMatrix(); assert((a * b) == a_t_b); assert((a * 7.77) == a_t_777); assert((b * a) == b_t_a); assert((-a * 1.0) == a * -1.0); assert(-(-(a * 1.0)) == a); assert(a * -1.0 == -1.0 * a); assert(Matrixd::Identity(4) * a_t_b == a_t_b); assert(Matrixd::Zeros(3, 4) * a == Matrixd::Zeros(3, 3)); cout<<"Matrixd passed Test!"<<endl; Matrix4d m = { { 1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16} }; assert(m.Transpose().Transpose() == m); assert(!(m.Transpose() == m)); return true; }
void ModelDisplayState::RenderStaticModels(RenderOptions& options) const { const std::vector<CompositeModel3d::StaticModelData>& vecStaticModels = m_spModel->StaticList(); ATLASSERT(m_vecStaticModelTextures.size() == vecStaticModels.size()); for (size_t i=0, iMax = vecStaticModels.size(); i<iMax; i++) { // enable model texture, if loaded if (m_vecStaticModelTextures[i] != NULL) m_vecStaticModelTextures[i]->Bind(); // find mount point and matrix const CompositeModel3d::StaticModelData& data = vecStaticModels[i]; ATLASSERT(data.m_iJointIndex >= 0); ATLASSERT(size_t(data.m_iJointIndex) < m_vecJointRenderData.size()); size_t uiMountIndex = static_cast<size_t>(data.m_iJointIndex); Matrix4d matGlobal = m_vecJointRenderData[uiMountIndex].GlobalMatrix(); matGlobal.Transpose(); // transform current modelview matrix glPushMatrix(); glMultMatrixd(matGlobal.Data()); // render model data.m_spStatic->Render(options); // render mount point if (options.Get(RenderOptions::optionModelJoints)) RenderMountPoint(); glPopMatrix(); } }