Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Pixel Coordinates to Vectors

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 370 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 19/01/2006 at 16:04, xxxxxxxx wrote:

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

      ---------
      Hi guys,
      Really new to the Cinema C++ SDK so please excuse the novice question 😃 But, in the BaseDraw class the GetFrame() and GetSafeFrame() member functions only return coordinates in Pixels which are of type LONG. If I wanted to create vectors from these coordinates would I use a static_cast<Real> and input these coordinates into the respective Vector component?
      Thanks in advance for any help
      -Josh-

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 19/01/2006 at 17:41, xxxxxxxx wrote:

        You could do that, but it depends on what you want. Pixels represent the 2D screen plane and the values have no direct correlation to the 3D world space. If you want the 3D world space coordinates that match the view's 2D screen plane coordinates, use BaseView::SW() (which is also available from BaseDraw as it is derived from BaseView). For this and your original question, yes, you cast the LONG to a Real as you show.

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 19/01/2006 at 22:45, xxxxxxxx wrote:

          Thanks for the help Robert!
          I am just testing out drawing wihtin the viewport, and what I would like to do is just draw a Line2D() from the world origin to the left-top corner of the viewport. Whats confusing is the result that BaseDraw::GetFrame() returns to the pointers. For example:

              
              
              
              
              LONG *leftFramePTR;
              
              
              
              
              LONG *topFramePTR;
              
              
              
              
              LONG *rightFramePTR;
              
              
              
              
              LONG *bottomFramePTR;
              
              
              
              
              bd->GetFrame(leftFramePTR, topFramePTR, rightFramePTR, bottomFramePTR);
              
              
              
          

          Does this mean that leftFramePTR has the dimension of the left border of the viewport? Or is it just the coordinates of a single pixel in the top left corner?
          Any simple examples you could show of BaseDraw::GetFrame() would be very helpful and much appreciated.
          Thanks,
          Josh

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 20/01/2006 at 02:32, xxxxxxxx wrote:

            a simple example would be to calculate the visible view-size:

              
            LONG left, top, right, bottom;  
            Real width, height;  
            bd->GetFrame(&left;, &top;, &right;, &bottom;);  
            width = right - left + 1;  
            height = bottom - top + 1;
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post