AsdkCoordSamp::viewportDraw(AcGiViewportDraw* pV) { pV->subEntityTraits().setFillType(kAcGiFillAlways); const int count = 3; AcGePoint3d verts[count]; verts[0] = AcGePoint3d(0.0, 0.0, 0.0); verts[1] = AcGePoint3d(1.0, 0.0, 0.0); verts[2] = AcGePoint3d(1.0, 1.0, 0.0); // Draw model space line segment. // pV->subEntityTraits().setColor(kBlue); pV->geometry().polygon(count, verts); // Compute its representation in eye space. // AcGeMatrix3d mat; pV->viewport().getModelToEyeTransform(mat); for (int i = 0; i < count; i++) { verts.x += 0.01; verts.y += 0.01; verts.z += 0.01; verts.transformBy(mat); } // Display the eye coordinate equivalent of the // model space polygon. // pV->subEntityTraits().setColor(kGreen); pV->geometry().polygonEye(count, verts); // Convert from eye to display coordinates. // for (int i = 0; i < count; i++) { verts.x += 0.01; verts.y += 0.01; verts.z += 0.01; //verts.transformBy(mat); } // Draw the display space equivalent of the // model space polygon. // pV->subEntityTraits().setColor(kRed); pV->geometry().polygonDc(count, verts); } 在这个函数中 pV->viewport().getModelToEyeTransform(mat); for (int i = 0; i < count; i++) { verts.x += 0.01; verts.y += 0.01; verts.z += 0.01; verts.transformBy(mat); } 有getModelToEyeTransform(mat);和verts.transformBy(mat) 起的什么作用啊? 有人给详细解释一下吗? 如何控制视图的?
|