Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Should i use from the parametric equations?

  1. #1
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Should i use from the parametric equations?

    I want to move two objects with these equations:
    y = m*x
    y = (m^2)*x
    I want to move them with an equivalent speed. but my problem is that these equations are depend on the axes.And if i use them, i see different speeds.
    Should i use from the parametric equations?Any suggestion?
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  2. #2
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: Should i use from the parametric equations?

    Solve for the distance along the curve, you'll probably have to approximate it, but pythagoras theorem will help you get approximate distance from the last position, scale back give you a new x and iterate a bit.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,142

    Re: Should i use from the parametric equations?

    This problem is relatively easy to solve exactly when using parametric equations:

    x = t
    y = m*t (or m^2 * t for the other object)

    Both objects travel along a straight line, and the length of the line l(t) = t*sqrt(1+m^2) (for the first object, for the second l(t) = t*sqrt(1+m^4)...)

    We want both objects to travel at the same speed when using the same value of t. Let's assume t is the time in seconds, and we want both objects to travel at v units per second. That means we want l(t) = v*t. So we just have to scale the formulas accordingly:

    x = v * t / sqrt(1+m^2)
    y = v * m * t / sqrt(1+m^2)

    and for the second object:
    x = v * t / sqrt(1+m^4)
    y = v * m^2 * t / sqrt(1+m^4)

    And now the length of the curve is for both objects l(t) = v*t, so both move the same distance in the same time...

    EDIT:
    Formulas corrected. Forgot a v

  4. #4
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: Should i use from the parametric equations?

    Thank you Angus, thank you Overmind. now i should move the objects with the same velocity.

    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  5. #5
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: Should i use from the parametric equations?

    I'm a bit confused.
    we say x = t. and l(t)=v*t. So x = l(t)/v = (t*sqrt( 1+m^2 ))/v --For the first object.
    But as you have writte, x = t / sqrt(1+m^2).
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

  6. #6
    Senior Member OpenGL Pro
    Join Date
    May 2000
    Location
    Naarn, Austria
    Posts
    1,142

    Re: Should i use from the parametric equations?

    Whoops, forgot a v in the formula...

    x(t) = v * t / sqrt(1 + m^2)
    y(t) = v * m * t / sqrt(1 + m^2)

    From these formulas, it is obvious that y = m * x, and if you calculate the length with the pythagoras theorem, you get:

    l(t) = sqrt(x^2 + y^2) =
    sqrt(v^2 * t^2 / (1+m^2) + v^2 * m^2 * t^2 / (1+m^2)) =
    sqrt(v^2 * t^2 / (1+m^2) * (1 + m^2)) =
    sqrt(v^2 * t^2) = v * t

    Remember that these are new x, y different than the ones we started with. We want formulas for x and y so that y = m * x AND the length is v * t.

    The original x'(t), y'(t) have the length sqrt(1+m^2), so we have to use x(t / (1+m^2)), y(t / (1+m^2)) instead.

  7. #7
    Advanced Member Frequent Contributor Ehsan Kamrani's Avatar
    Join Date
    May 2005
    Location
    Iran
    Posts
    547

    Re: Should i use from the parametric equations?

    Well.I should say *thank you* Another question is about moving in 3D spaces.Are there any good references about moving the models in 3D space?
    -Ehsan-
    <span style="color: #006600">-Ehsan-</span>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •