此示例采用在模型坐标中定义的线段,并在眼睛和显示坐标中创建其等效线段。显示时,所有行将重叠。 void AsdkCoordSamp::subViewportDraw (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[i].x += 0.01; verts[i].y += 0.01; verts[i].z += 0.01; verts[i].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[i].x += 0.01; verts[i].y += 0.01; verts[i].z += 0.01; } // Draw the display space equivalent of the // model space polygon. // pV->subEntityTraits ().setColor(kRed); pV->geometry().polygonDc(count, verts); } void 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 the line's representation in eye space. // AcGeMatrix3d mat; pV->viewport().getModelToEyeTransform(mat); for (int i = 0; i < count; i++) { verts[i].x += 0.01; verts[i].y += 0.01; verts[i].z += 0.01; verts[i].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 (i = 0; i < count; i++) { verts[i].x += 0.01; verts[i].y += 0.01; verts[i].z += 0.01; } // Draw the display space equivalent of the // model space polygon. // pV->subEntityTraits().setColor(kRed); pV->geometry().polygonDc(count, verts); } |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:49
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.