|
void acgeGetViewXform(const AcDbViewportTableRecord* pVport, AcGeMatrix3d& xform)
{
AcGePoint3d camTarg = pVport->target();
AcGeVector3d viewDir = pVport->viewDirection();
double viewTwist = pVport->viewTwist();
AcGeVector3d vZ = viewDir;
vZ.negate();
vZ.normalize();
AcGeVector3d vX = vZ.perpVector();
vX.rotateBy(viewTwist, vZ);
vX.negate();
AcGeVector3d vY = vX.crossProduct(vZ);
xform(0,0) = vX.x; xform(0,1) = vX.y; xform(0,2) = vX.z;
xform(1,0) = vY.x; xform(1,1) = vY.y; xform(1,2) = vY.z;
xform(2,0) = vZ.x; xform(2,1) = vZ.y; xform(2,2) = vZ.z;
xform(3,0) = 0; xform(3,1) = 0; xform(3,2) = 0;
AcGeVector3d targ = camTarg.asVector();
targ.transformBy(xform);
targ.negate();
xform(0,3) = targ.x;
xform(1,3) = targ.y;
xform(2,3) = targ.z;
xform(3,3) = 1;
} |
|