几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】eye to screen - eye to world (http://www.dimcax.com/hust/showthread.php?t=16280)

yang686526 2009-05-05 10:44 AM

【转帖】eye to screen - eye to world
 
eye to screen - eye to world
eye to screen - eye to world
below is an section of code from oee of the examples
code:
void exsimpleview::update()
{
device()->setdrawcontext(drawcontext());
// comment function below to get primitives in eye coordinates.
odgematrix3d eye2screen(eyetoscreenmatrix());
odgematrix3d screen2eye(eye2screen.inverse());
seteyetooutputtransform(eye2screen);
// perform viewport clipping in eye coordinates:
m_eyeclip.m_bclippingfront = isfrontclipped();
m_eyeclip.m_bclippingback = isbackclipped();
m_eyeclip.m_dfrontclipz = frontclip();
m_eyeclip.m_dbackclipz = backclip();
m_eyeclip.m_vnormal = viewdir();
m_eyeclip.m_ptpoint = target();
m_eyeclip.m_points.clear();
odgevector2d halfdiagonal(fieldwidth() / 2.0, fieldheight() / 2.0);

if(m_nrccounts.size() == 1) // polypolygons aren't supported yet
{
// polygonal clipping
int i;
for(i = 0; i < m_nrccounts[0]; i ++)
{
odgepoint3d screenpt(m_nrcpoints[i].x, m_nrcpoints[i].y, 0.0);
screenpt.transformby(screen2eye);
m_eyeclip.m_points.append(odgepoint2d(screenpt.x, screenpt.y));
}
}
else
{
// rectangular clipping
m_eyeclip.m_points.append(odgepoint2d::korigin - halfdiagonal);
m_eyeclip.m_points.append(odgepoint2d::korigin + halfdiagonal);
}
m_eyeclip.m_xtoclipspace = getworldtoeyetransform();

pushclipboundary(&m_eyeclip);
odgsbasevectorizeview::update();
popclipboundary();
} // end exsimpleview::update()
what i want to know is has seteyetooutputtransform(eye2screen); always been called in this exmaples history
i.e. eye to screen transform
and not
eye to world transform
e.g
seteyetooutputtransform(geteyetoworldtransform());

in 1.12.06 there really were
code:
odgsview* pview0 = device()->viewat(0);
seteyetooutputtransform(pview0->worldtodevicematrix().inverse() * eye2screen);
don't know why, perhaps for some test purposes.
in 1.13 it was rolled back to what it is now.
vladimir


所有的时间均为北京时间。 现在的时间是 07:54 AM.