Closed corbmanj closed 9 years ago
highp vec2 func(highp vec2 a, highp vec2 b) { //TODO: Implement the exercise here // Let length of a = |a| and length of b = |b| // and L = length of a - b // and |x| be the length of that part of the a - b where angles of equal // then // |a|/|b| = |x| / (L-|x|) (specified the by angle bisector theorem // solving for |x|/L = gives the variable s specified below. // highp float s = length(a) / (length(a) + length(b)); highp vec2 c = a - (a - b) * s; return normalize(c); }
I can get a solution to this exercise if I use the relation that the sum of two normalized vectors is the angle bisector and then normalize this for the return.
This satisfies the exercise, but it does not seem to use the suggested relation:
Can someone please explain to me how to use this relation to solve this exercise? I may just be misunderstanding how to distribute the length function. For instance, it does not seem plausible from a geometry standpoint that
length(B-C) == length(B)-length(C)
Note: I also tried solving for the equation of the line AB and trying to solve for the point C such that the ratio of the distance BC:AC was equal to the ratio of length(B):length(A), but that took me down a rabbit hole with one equation and two unknowns.