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
    • Login

    Distance between two points

    Scheduled Pinned Locked Moved SDK Help
    9 Posts 0 Posters 829 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 15/05/2010 at 13:20, xxxxxxxx wrote:

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

      ---------
      Does anyone know how I would find the distance between two points.

      Let's say that one point is  p1 = Vector(12, 34, 90);

      And the other point is p2 = Vector(46, 766, 90);

      How would I find the distance between p1 & p2?

      Thanks in advance,

      ~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 15/05/2010 at 14:32, xxxxxxxx wrote:

        Len(p2-p1)

        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 15/05/2010 at 14:48, xxxxxxxx wrote:

          Great 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 15/05/2010 at 15:45, xxxxxxxx wrote:

            You're stealing my thunder, Samir.
            This was eventually a question that I'd have known the answer for 😛

            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 16/05/2010 at 01:15, xxxxxxxx wrote:

              Well, that happens when you move away to turkey Jack. There´s a delay now as I am still nearer to the us now. 😉

              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 16/05/2010 at 11:00, xxxxxxxx wrote:

                Actually if you are using the length for an often called comparision routine, it might be wiser to avoid len or any sqrt related routine. They are relatively slow.

                Kabe

                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 16/05/2010 at 14:50, xxxxxxxx wrote:

                  how would you do it without using those functions?

                  ~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 17/05/2010 at 03:54, xxxxxxxx wrote:

                    Well, just use the squared distances.

                    The squared distance ist (x1-x2)^2+(y1-y2)^2+(z1-z2)^2.

                    Instead of applying root to get length, you square the distance which you use for comparision.

                    Cheers

                    Kabe

                    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 28/07/2010 at 13:05, xxxxxxxx wrote:

                      That's what I do when it is simply a distance comparison.  Sqrt() is expensive!

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