Transform to the Screen Coordinate



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/09/2003 at 03:00, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.200 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I want to make points transform to the Screen Coordinate like BaseView.WS().
    But my function written below returns wrong value when the point is
    at near or  at behind the Camera.
    What is wrong?
    void WorldToScreen( VolumeData* vd, RyaObject* op Vector* point )
    {
     RayCamera rc = vd->GetRayCamera();
     Matrix                    cm = rc->m;
     Vector                   v;
     cm = !cm;
     for( LONG i = 0; i < op->pcnt; i++ )
     {
      v = op->padr[i];
      v = im * v;
      v = vd->CameraToScreen( v );
      point[i] = v;
     }
    }



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 24/09/2003 at 23:47, xxxxxxxx wrote:

    My compiler fails already at RyaObject, so it's hard to tell... ;-)
    But to the point. The code for WorldToCamera() and CameraToScreen() has been posted at the old forum: http://www.plugincafe.com/forum_browse.asp?messageID=2799
    As you can see, it performs no clipping. Could this be why you get wrong results? You'd have to clip manually at z<0.0, I believe.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 25/09/2003 at 03:39, xxxxxxxx wrote:

    Thanks for your  advice.
    I forget to clip -Z point.
    Now my function work correctly.


Log in to reply