Lines Matching refs:r_1
33 Let two circles be $C_0, r_0$ and $C_1, r_1$ where $C$ is the center and $r$ is the radius. For any
36 $r_t = (1-t) \cdot r_0 + t \cdot r_1 > 0$ (note that radius $r_t$ has to be *positive*). If
42 2. $r_0 = r_1$ so the gradient is a single strip with bandwidth $2 r_0 = 2 r_1$.
47 \neq r_1$.
49 As $r_0 \neq r_1$, we can find a focal point $C_f = (1-f) \cdot C_0 + f \cdot C_1$ where its
50 corresponding linearly interpolated radius $r_f = (1-f) \cdot r_0 + f \cdot r_1 = 0$.
51 Solving the latter equation gets us $f = r_0 / (r_0 - r_1)$.
53 As $C_0 \neq C_1$, focal point $C_f$ is different from $C_1$ unless $r_1 = 0$. If $r_1 = 0$, we can
54 swap $C_0, r_0$ with $C_1, r_1$, compute swapped gradient $t_s$ as if $r_1 \neq 0$, and finally set
62 2. The radius $r_t$ is $x_t r_1$.
68 always the bigger one (note that $f \neq 1$, otherwise we'll swap $C_0, r_0$ with $C_1, r_1$).
74 1. $\frac{x^2 + y^2}{(1 + r_1) x} = \frac{x^2 + y^2}{2 x}$ if $r_1 = 1$
75 2. $\left(\sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)$ if $r_1 > 1$
76 3. $\left(\pm \sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)$ if $r_1 < 1$.
79 3 may have no solution at all if $(r_1^2 - 1) y^2 + r_1^2 x^2 < 0$.
81 *Proof.* Algebriacally, solving the quadratic equation $(x_t - x)^2 + y^2 = (x_t r_1)^2$ and
91 3. we still need to handle the swapped case (we swap $C_0, r_0$ with $C_1, r_1$ if $r_1 = 0$);
106 1. If $r_1 = 1$, let $x' = x/2,~ y' = y/2$, then $x_t = (x'^2 + y'^2) / x'$.
107 2. If $r_1 > 1$, let $x' = r_1 / (r_1^2 - 1) x,~ y' = \frac{\sqrt{r_1^2 - 1}}{r_1^2 - 1} y$, then
108 $x_t = \sqrt{x'^2 + y'^2} - x' / r_1$
109 3. If $r_1 < 1$, let $x' = r_1 / (r_1^2 - 1) x,~ y' = \frac{\sqrt{1 - r_1^2}}{r_1^2 - 1} y$, then
110 $x_t = \pm\sqrt{x'^2 - y'^2} - x' / r_1$
117 1. Let $C'_0, r'_0, C'_1, r'_1 = C_0, r_0, C_1, r_1$ if there is no swapping and $C'_0,
118 r'_0, C'_1, r'_1 = C_1, r_1, C_0, r_0$ if there is swapping.
120 3. Let $x' = x/2,~ y' = y/2$ if $r_1 = 1$, and
121 $x' = r_1 / (r_1^2 - 1) x,~ y' = \sqrt{|r_1^2 - 1|} / (r_1^2 - 1) y$ if $r_1 \neq 1$
123 5. If $r_1 = 1$, let $\hat x_t = (\hat x^2 + \hat y^2) / \hat x$
124 6. If $r_1 > 1$,
125 let $\hat x_t = \sqrt{\hat x^2 + \hat y^2} - \hat x / r_1$
126 7. If $r_1 < 1$
128 2. let $\hat x_t = -\sqrt{\hat x^2 - \hat y^2} - \hat x / r_1$ if we've swapped $r_0, r_1$,
131 3. let $\hat x_t = \sqrt{\hat x^2 - \hat y^2} - \hat x / r_1$ otherwise
133 8. $t$ is invalid if $\hat x_t < 0$ (this check is unnecessary if $r_1 > 1$)
147 * 1 addition, 2 multiplications, and 1 division if $r_1 = 1$
148 * 2 additions, 3 multiplications, and 1 sqrt for $r_1 \neq 1$ (count substraction as addition;
149 dividing $r_1$ is multiplying $1/r_1$)
153 In comparison, for $r_1 \neq 1$ case, our current raster pipeline shading algorithm (which shall
155 (1/a) \cdot \left(-b \pm \sqrt{b^2 - 4ac}\right)$$ It precomputes $a = 1 - (r_1 - r_0)^2, 1/a, r1 -
160 if it saves the $0.5 \cdot (1/a), 4a, r_0^2$ and $(r_1 - r_0) r_0$ multiplications, there are still
162 uniforms ($1/r_1$ and $f$).
167 intersection points $P_1$ between that ray and circle $C_1 = (1, 0), r_1$, there exists an $x_t$
177 Therefore $||P C|| = ||P_1 C_1|| \cdot (||C_f C|| / ||C_f C_1||) = r_1 x'$. Thus $x'$ is a solution
183 $P_1$ must be on circle $C_1, r_1$.
186 $||C_1 P_1|| = r_1$ and $P_1$ is on circle $C_1, r_1$. $\square$
189 number of intersections between ray $C_f P$ and circle $C_1, r_1$. Therefore
191 * when $r_1 > 1$, there's always one unique intersection/solution; we call this "well-behaved"; this
193 * when $r_1 = 1$, there's either one or zero intersection/solution (excluding $C_f$ which is always
199 * when $r_1 < 1$, there may be $0, 1$, or $2$ solutions; this was also previously as the "outside"
208 x_t = {|| C_f P || \over ||C_f P_1||} = \frac{x^2 + y^2}{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}
223 Triangle $\triangle C_1 H P_1$ is a right triangle with hypotenuse $r_1$. Hence
224 $$ ||H P_1|| = \sqrt{r_1^2 - ||C_1 H||^2} = \sqrt{r_1^2 - y^2 / (x^2 + y^2)} $$
229 &= x / \sqrt{x^2 + y^2} + \sqrt{r_1^2 - y^2 / (x^2 + y^2)} \\\\\\
230 &= \frac{x + \sqrt{r_1^2 (x^2 + y^2) - y^2}}{\sqrt{x^2 + y^2}} \\\\\\
231 &= \frac{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}{\sqrt{x^2 + y^2}}
245 $$ ||H P_1|| = \sqrt{r_1^2 - ||C_1 H||^2} = \sqrt{r_1^2 - y^2 / (x^2 + y^2)} $$
254 ||C_f P_1|| = \frac{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}{\sqrt{x^2 + y^2}}
260 = \frac{x^2 + y^2}{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}
263 **Corollary 2.** If $r_1 = 1$, then the solution $x_t = \frac{x^2 + y^2}{(1 + r_1) x}$, and
266 *Proof.* Simply plug $r_1 = 1$ into the formula of Lemma 3. $\square$
268 **Corollary 3.** If $r_1 > 1$, then the unique solution is
269 $x_t = \left(\sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)$.
274 x_t &= \frac{x^2 + y^2}{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}} \\\\\\
276 (x^2 + y^2) \left ( -x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2} \right )
278 \left (x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2} \right )
279 \left (-x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2} \right )
282 (x^2 + y^2) \left ( -x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2} \right )
284 -x^2 + (r_1^2 - 1) y^2 + r_1^2 x^2
287 (x^2 + y^2) \left ( -x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2} \right )
289 (r_1^2 - 1) (x^2 + y^2)
291 &= \left(\sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)
294 The transformation above (multiplying $-x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}$ to enumerator and
295 denomenator) is always valid because $r_1 > 1$ and it's the unique solution due to Corollary 1.
298 **Lemma 4.** If $r_1 < 1$, then
300 1. there's no solution to $x_t$ if $(r_1^2 - 1) y^2 + r_1^2 x^2 < 0$
302 $x_t = \left(\sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)$,
304 $x_t = \left(-\sqrt{(r_1^2 - 1) y ^2 + r_1^2 x^2} - x\right) / (r_1^2 - 1)$.
319 they are either $\frac{x^2 + y^2}{x + \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}$
320 or $\frac{x^2 + y^2}{x - \sqrt{(r_1^2 - 1) y^2 + r_1^2 x^2}}$.
322 As $r_1 \neq 1$, we can apply the similar transformation in Corollary 3. to get the two