Distance between two points



  • 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



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



  • 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



  • 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 :-P



  • 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. ;-)



  • 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



  • 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



  • 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



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


Log in to reply