Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

03-intro-3 : Degenerate cases make this very difficult... #84

Merged
merged 1 commit into from
Aug 18, 2014

Conversation

mdda
Copy link

@mdda mdda commented Aug 18, 2014

The README hint file (with the ascii-art diagram) is kind of misleading : the beautiful (and concise) answer that you're looking for doesn't follow directly from the rubric. Moreover, because your VERIFY field covers the whole of the xy plane, it includes degenerate cases where A is collinear with B (and pointing in the opposite direction). This prevents the following from working (which is more directly derivable from your diagram, etc) :

  highp float pct = length(a) / (length(a)+length(b));
  vec2 c = a + pct * (b-a);
  return normalize(c);

The attached patch fixes the degenerate case area where A is pointing almost in opposite direction to B. Reasonable solutions will now work. My guess is that was the original intention, since your existing code includes a 0.01 error ball around the expected solution anyway.

Hope this makes sense
Martin
:-)

@mikolalysenko
Copy link
Member

Thanks for the fix! I've been meaning to get around to this, and totally agree.

mikolalysenko added a commit that referenced this pull request Aug 18, 2014
03-intro-3 : Degenerate cases make this very difficult...
@mikolalysenko mikolalysenko merged commit f4bceff into stackgl:master Aug 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants