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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Visual Measurer

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 321 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 05/09/2012 at 09:38, xxxxxxxx wrote:

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

      ---------
      Hey everyone,

      I am playing around trying to create a visual measuring line for the viewport.  Ultimately I want to be able to click on a point on an object,  and draw a line from the object point to any other point in space and determine the length of that line.  for example,  if I click on a point of a cube,  then drag my mouse out to some arbitrary point in the viewport,  I was to be able to determine the distance between the two points.

      So to accomplish this I have been trying getting the  object point,    we'll call it (A)   and the point where the mouse is,   we'll call it (B)     and then drawing a line between the two...    so I say

      A = WS(point);
      B = Vector(x, y, 0);

      bd->DrawLine(A, B, NOCLIP_Z);

      then I want to get the length of the line to use it as a measurement.

      So I do

      Real length = Len(A - B);

      the problem is I get very wrong numbers when I do this..

      let's say I draw a line from one point in a cube to the other,   and expect that the distance between the two points is 200.      the numbers I get from my setup is like 500...

      Any thoughts on what I might be doing wrong?

      Thanks,

      Shawn

      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 06/09/2012 at 05:42, xxxxxxxx wrote:

        Howdy,

        It looks like you're converting to screen coordinates, but not converting back to world coordinates before calling the Len() function.

        Adios,
        Cactus Dan

        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 06/09/2012 at 08:12, xxxxxxxx wrote:

          Ah..   Thanks Dan!  Should've caught that.   I appreciate it!

          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 12/09/2012 at 03:16, xxxxxxxx wrote:

            Just in case you missed it, are you aware of Cinema's Measure & Construction tool? Seems to do the same.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post