leez0301 发表于 2009-2-17 14:18:00

向高手求救getModelToEyeTransform函数

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