A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: Quadratic vector extrapolation

  1. #1
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927

    Quadratic vector extrapolation

    Hi, I need to extrapolate vector v_1 from v0, v1 and v2 (see attached pic), so that if v2 is on the right/left (2D case for simplicity) of v1-v0, v_1 would also be on the right/left.

    My initial solution was like this:
    v2 - v1 = v1 - v0 + some dv,
    v1 - v0 = v0 - v_1 + dv,
    and from there
    v_1 = 3(v0 - v1) + v2.

    This, however, produces ugly results when abs (v2-v1) < abs (v1-v0) - point v_1 is placed very far from v0. So I need a better formula for this.

    Any help?
    Attached Images Attached Images
    Last edited by realMakc; 09-26-2007 at 09:38 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927

    take 2

    so I was trying another approach (see attached jpeg), it resulted into formula v_1 = 2 (v0 - v1) + v2... this works even worse, don't try it... like you would

    Update: I made test SWF for v_1 = K (v0 - v1) + v2...
    Attached Images Attached Images
    Last edited by realMakc; 08-21-2009 at 07:05 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927

    take 3

    yet another approach, K = 1 + 2 dot (v1-v2,v0-v1) / dot (v0-v1,v0-v1), this looks far better. I wonder how well is it going to work in 3D...
    Attached Images Attached Images
    Last edited by realMakc; 08-21-2009 at 07:05 AM.
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    ...but there's a problem if v0=v1 damn.
    who is this? a word of friendly advice: FFS stop using AS2

  5. #5
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927

    take 4 (and final)

    this is basically last thing re-normalized to v0-v1. I think I can handle 0 vector case, and live with this result. thanks everybody for your generous help
    Attached Files Attached Files
    who is this? a word of friendly advice: FFS stop using AS2

  6. #6
    Senior Member ozmic66's Avatar
    Join Date
    Oct 2005
    Posts
    472
    What a fruitful discussion thread
    I'd love to help, but I really don't know what you're talking about
    Pixelwave Flash-based iPhone framework
    iPhone Games: Flyloop | Freedom Run

    Twitter: Oztune

  7. #7
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    I needed to extrapolate beyond vector array endpoints, in order to pass extrapolated vector into cubic spline (which requires 4 vectors to interpolate between 2 of them).

    There is no "correct" answer to this, it is all about how much the end result looks like I had envisioned it in the start.
    who is this? a word of friendly advice: FFS stop using AS2

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center