math: sline lope

This is a discussion on math: sline lope within the Game Programming forums, part of the General Programming Boards category; i need to draw an imaginary line in a 3D world using the slope method. (terminology is off. been a ...

  1. #1
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299

    math: line slope

    i need to draw an imaginary line in a 3D world using the slope
    method. (terminology is off. been a few years since math class)

    if i remember right its the difference of x over the difference of y.
    (X1 - X2 ) / (y1 -y2) used to calculate any point on a straight line.

    in short im trying to find a way to use this in a 3d world for collision detection(GuNs path of the bullets/projectiles).
    any links would be a big help.
    thx
    Last edited by Nor; 09-30-2003 at 09:18 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    if i remember right its the difference of x over the difference of y.
    (X1 - X2 ) / (y1 -y2) used to calculate any point on a straight line.
    its y's over x's

    (y2-y1)/(x2-x1)

    at least thats how ive been doing it on all my homework hehe...
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    y2-y1/x2-x1
    thats the slope formula

  4. #4
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    y2-y1/x2-x1
    (y2 - y1) / (x2 - x1)
    is more accurate. Remember the order of operations

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    ....

  6. #6
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    Code:
     ∆Y
    ----
     ∆X

  7. #7
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    what is ∆ ?
    Last edited by Nor; 10-01-2003 at 10:00 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  8. #8
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    ∆ means delta. Delta means difference. Therefore, ∆y means difference in y.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #9
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299
    anyone know where i can squeeze 'z' into this equation?
    googles doesnt have much on the subject

    http://www.univie.ac.at/future.media...om1/geom1.html
    is the only place that has what i want but they dont show the math
    Last edited by Nor; 10-01-2003 at 10:07 PM.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  10. #10
    Visionary Philosopher Sayeh's Avatar
    Join Date
    Aug 2002
    Posts
    212
    If you're working in 3D, you need to be using a plane equation, not just slope intercept.
    It is not the spoon that bends, it is you who bends around the spoon.

  11. #11
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    so does an equivalent of 'slope' exist for 3d? I kind of thought it would be:
    deltaz/(deltay/deltax)

    but it seems pretty much useless anyway, if it exists.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Math
    By knightjp in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 04-01-2009, 06:36 PM
  2. how to use operator+() in this code?
    By barlas in forum C++ Programming
    Replies: 10
    Last Post: 07-09-2005, 08:22 PM
  3. Help with C++ Math
    By aonic in forum C++ Programming
    Replies: 4
    Last Post: 01-29-2005, 04:40 AM
  4. Math Header?
    By Rune Hunter in forum C++ Programming
    Replies: 26
    Last Post: 09-17-2004, 07:39 AM
  5. toughest math course
    By axon in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 10-28-2003, 10:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21