379 |
so as to make the movement of $A$ look natural. |
so as to make the movement of $A$ look natural. |
380 |
|
|
381 |
There should be some maximum radius $r$ of distortion such that |
There should be some maximum radius $r$ of distortion such that |
382 |
whether a point $y$ is in $B$ depends only on the set $A \cap B(\q, r)$, |
whether a point $\q$ is in $B$ depends only on the set $A \cap B(\q,r)$, |
383 |
where $B(\q, r)$ is a ball of radius $r$ centered at $\q \in \mathbf{R}^2$. |
where $B(\q,r)$ is a ball of radius $r$ centered at $\q \in \mathbf{R}^2$. |
384 |
$A \cap B(\q, r) = \emptyset$ should imply $\q \notin B$ and |
$A \cap B(\q,r) = \emptyset$ should imply $\q \notin B$ and |
385 |
$A \cap B(\q, r) = B(y,r)$ should imply $\q \in B$. |
$A \cap B(\q,r) = B(\q,r)$ should imply $\q \in B$. |
386 |
Additionally, the mapping from $A$'s to $B$'s should be continuous |
Additionally, the mapping from $A$'s to $B$'s should be continuous |
387 |
so that slow movement of $A$ results into smooth ``rippling'' in $B$. |
so that slow movement of $A$ results into smooth ``rippling'' in $B$. |
388 |
Furthermore, the rippling should not be too fast. |
Furthermore, the rippling should not be too fast. |
497 |
--- |
--- |
498 |
|
|
499 |
To start off, assume that we are drawing the torn edge inside a |
To start off, assume that we are drawing the torn edge inside a |
500 |
given \emph{envelope}. |
given smooth \emph{envelope}. |
501 |
The envelope is parametrized as a mapping $E(x,y)$ to canvas coordinates |
The envelope is parametrized as a mapping $E(x,y)$ to canvas coordinates |
502 |
so that $E(x,0)$ and $E(x,1)$ are the inner and outer edges of the |
so that $E(x,0)$ and $E(x,1)$ are the inner and outer edges of the |
503 |
envelope, respectively, and the ripples are contained between these two curves. |
envelope, respectively, and the ripples are contained between these two |
504 |
|
smooth curves. |
505 |
An envelope can be defined with a \emph{spine} $E(x,1/2)$ and a normal vector |
An envelope can be defined with a \emph{spine} $E(x,1/2)$ and a normal vector |
506 |
$N(x)$ so that $E(x,y) = E(x,1/2) + (y-1/2) N(x)$. |
$N(x)$ so that $E(x,y) = E(x,1/2) + (y-1/2) N(x)$. |
507 |
The envelope should not intersect itself. |
The envelope should not intersect itself. |
508 |
|
|
509 |
|
This formulation allows us to consider the distortion only |
510 |
|
in the normal ($y$) direction for each point $x$ in the edge. |
511 |
|
On the other hand, we will need to specifically consider the corners |
512 |
|
later. |
513 |
|
|
514 |
The edge curve $C(x)$ of a conneccted shape can be obtained by simply |
The edge curve $C(x)$ of a conneccted shape can be obtained by simply |
515 |
displacing the edge in the normal direction of the envelope by a function |
displacing the edge in the normal direction by a function |
516 |
$0\le f(\p)\le 1$ which only depends on the location $\p$ of the spine: |
$0\le f(\p)\le 1$ which only depends on the location $\p$ of the spine: |
517 |
$C(x) = E(x, f(E(x,1/2)))$. |
$C(x) = E(x, f(E(x,1/2)))$. |
518 |
|
|
527 |
|
|
528 |
These two algorithms correspond to one-dimensional displacement |
These two algorithms correspond to one-dimensional displacement |
529 |
and offset distortions, where the one dimension is in the normal direction. |
and offset distortions, where the one dimension is in the normal direction. |
530 |
The corresponding function and inverse function are |
In the relation formulation, the corresponding forward and inverse functions |
531 |
|
are |
532 |
\begin{eqnarray} |
\begin{eqnarray} |
533 |
G_n(\p) &=& \p + (r N) (2f(\p) - 1), \\ |
G_n(\p) &=& \p + (r N) (2f(\p) - 1), \\ |
534 |
F_n(\q) &=& \q - (r N) (2f(\q) - 1), |
F_n(\q) &=& \q - (r N) (2f(\q) - 1), |