Any math guru's out there?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JAS

    #1

    Any math guru's out there?

    * I originally intended to cross post to comp.lang.php as well as
    alt.php and alt.comp.lang.p hp. I wound up entering alt.comp.lang.p hp
    twice instad -- apologees for the seperate entries *

    I am not good at math, if you can find a dumbed down tutorial on this
    I'd appreciate it. I am trying to come up with a function that will
    find the distance between two points within a cube.

    The function eventually will be fed three co-ordinates, x y & z.

    Point 1 could be 290 : 195 : 132
    Point 2 could be 136 : 201 : 8

    Has anybody done this before? If so can you throw this poor dog a bone,
    I can code PHP and anything just fine, alas my poor math is letting me
    down on this one. (I've checked out the math functions in PHP hoping
    this had already been done to no avail).

    J
  • neur0maniak

    #2
    Re: Any math guru's out there?

    I think pythagorean theorem applies to 3D as well as 2D

    distance = root ( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) )


    JAS wrote:[color=blue]
    > * I originally intended to cross post to comp.lang.php as well as
    > alt.php and alt.comp.lang.p hp. I wound up entering alt.comp.lang.p hp
    > twice instad -- apologees for the seperate entries *
    >
    > I am not good at math, if you can find a dumbed down tutorial on this
    > I'd appreciate it. I am trying to come up with a function that will
    > find the distance between two points within a cube.
    >
    > The function eventually will be fed three co-ordinates, x y & z.
    >
    > Point 1 could be 290 : 195 : 132
    > Point 2 could be 136 : 201 : 8
    >
    > Has anybody done this before? If so can you throw this poor dog a bone,
    > I can code PHP and anything just fine, alas my poor math is letting me
    > down on this one. (I've checked out the math functions in PHP hoping
    > this had already been done to no avail).
    >
    > J[/color]

    Comment

    • JAS

      #3
      Re: Any math guru's out there?

      neur0maniak wrote:[color=blue]
      > I think pythagorean theorem applies to 3D as well as 2D
      >
      > distance = root ( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) )
      >
      >[/color]

      And it all comes flooding back ..... I feel old, school seems such a
      long time ago.

      I'll check it out,

      Thanks

      J

      Comment

      • Theo

        #4
        Re: Any math guru's out there?

        neur0maniak <usenet@neur0ma niak.co.uk> wrote in news:41a046ae$0 $43587
        $ed2e19e4@ptn-nntp-reader04.plus.n et:
        [color=blue]
        >
        > I think pythagorean theorem applies to 3D as well as 2D
        >
        > distance = root ( (x2-x1)^2 + (y2-y1)^2 + (z2-z1)^2) )[/color]

        yes, it does.

        Comment

        Working...