380 |
\] |
\] |
381 |
for all $A, A_1, A_2 \subset \mathbf{R}^2$ and |
for all $A, A_1, A_2 \subset \mathbf{R}^2$ and |
382 |
matching irregular shapes $B, B_1, B_2 \subset \mathbf{R}^2$. |
matching irregular shapes $B, B_1, B_2 \subset \mathbf{R}^2$. |
383 |
From this porperty, it follows that the mapping fomr $A$'s to $B$'s |
From this porperty, it follows that the mapping from $A$'s to $B$'s |
384 |
is actually defined by a point relation $R \in \mathbf{R}^2$: |
is actually defined by a point relation $R \in \mathbf{R}^2$: |
385 |
\[ |
\[ |
386 |
B = \{\, y \mid \exists x \in A: x R y \,\}. |
B = \{\, y \mid \exists x \in A: x R y \,\}. |
387 |
\] |
\] |
388 |
If $R$ is a function, i.e., $x R y \Leftrightarrow y = f(x)$, |
If $R$ is a function, i.e., $x R y \Leftrightarrow y = G(x)$, |
389 |
the irregular shapes will be connected (if the original shape is connected), |
the irregular shapes will be connected (if the original shape is connected), |
390 |
but some parts of original |
but some parts of original |
391 |
shape may map to overlapping parts in the irregular shape. |
shape may map to overlapping parts in the irregular shape. |
393 |
image of the border of $A$. |
image of the border of $A$. |
394 |
|
|
395 |
If $R$ is a function in the inverse direction, i.e., |
If $R$ is a function in the inverse direction, i.e., |
396 |
$x R y \Leftrightarrow g(y) = x$, |
$x R y \Leftrightarrow F(y) = x$, |
397 |
there will be no overlapping, but the irregular shape may be scattered. |
there will be no overlapping. |
398 |
|
Specifically, the edge of $A$ will map to the edge of $B$. |
399 |
|
However, the irregular shape may be scattered, if many points |
400 |
|
map to the same point in the original shape. |
401 |
If the function is bijection, the topology of the irregular shape |
If the function is bijection, the topology of the irregular shape |
402 |
will match the topology of the original shape. |
will match the topology of the original shape. |
|
Specifically, the edge of $A$ will map to the edge of $B$. |
|
403 |
|
|
404 |
The inverse function mapping is actually implemented in modern |
The inverse function mapping is actually implemented in modern |
405 |
texture shading hardware: |
texture shading hardware: |
406 |
the image of the undistorted shape can be stored in a texture and accessed |
the image of the undistorted shape can be stored in a texture and accessed |
407 |
with texture coordinates read from (or offset by) another texture storing the |
with texture coordinates read from (or offset by) another texture storing the |
408 |
inverse function (or $g(y) - y)$). This is called a dependent (or offset) |
inverse function (or $F(y) - y$). This is called a dependent (or offset) |
409 |
texture access. |
texture access. |
410 |
|
|
411 |
The forward function cannot be efficiently implemented on fragment level, |
The forward function cannot be efficiently implemented on fragment level, |
412 |
because each fragment may depend on multiple values of the function. |
because each fragment may depend on multiple values of the function. |
413 |
The edge of the shape could be displaced on vertex level, |
The edge of the shape could be displaced on vertex level, |
414 |
but that is likely to not yield good performance if the shape has fine detail. |
but that is likely to not yield good performance if the shape has fine detail. |
415 |
Furthermore, intersection in the edge cause additional problems. |
Furthermore, intersections in the edge may cause additional problems. |
416 |
If the function bijection, so as to avoid any intersections, we |
If the function is bijection, so as to avoid any intersections, we |
417 |
can just as well use the inverse function case by simply inverting |
can just as well use the inverse function case by simply inverting |
418 |
the function. |
the function. |
419 |
|
|
|
|
|
|
|
|
420 |
--- |
--- |
421 |
|
|
422 |
Because of implementation constraints, we further refine |
Because of implementation constraints, we further refine |
423 |
the ideal model discussed above. |
the ideal offset texture model discussed above. |
424 |
|
First of all, we want to be able to tear off many different shapes without |
425 |
|
having to render each of them to textures. |
426 |
|
And more importantly, texture shading is not implemented on low-end |
427 |
|
hardware. |
428 |
|
XXX: we want to be able to draw connected tear-out shapes. |
429 |
|
|
430 |
|
We split the edge of the original shape to multiple pieces, |
431 |
|
each assumed to be a straight line segment, and then consider |
432 |
|
the problem of distorting each one separately. |
433 |
|
|
434 |
|
Consider a half-plane shape \[ |
435 |
|
A = \{\, x \mid n \cdot (x - x_0) \le 0 \,\}, |
436 |
|
\] |
437 |
|
where $n$ is the normal of the edge line. |
438 |
|
|
439 |
|
The offset mapping yields $y \in B$, iff |
440 |
|
\[ |
441 |
|
y + F(y) \in A, |
442 |
|
\] |
443 |
|
i.e., |
444 |
|
\begin{equation} |
445 |
|
n \cdot (y - x_0) + n \cdot F(y) \le 0, |
446 |
|
\end{equation} |
447 |
|
Thus, offset has only effect in the normal direction and the problem |
448 |
|
is essentially reduced to one dimension. |
449 |
|
Simply define the ``scattered case'' as: |
450 |
|
\begin{equation} |
451 |
|
n \cdot (y - x_0) + f(y) \le 0, |
452 |
|
\end{equation} |
453 |
|
where the real function $f$ specifies offset in the normal direction. |
454 |
|
The movement is still natural. |
455 |
|
|
456 |
|
An anlogy to the forward function case can be made by |
457 |
|
limiting the displacement of the shape edge to the normal direction, i.e, |
458 |
|
by defining $G(x) = x + n d(x)$, where $d(x)$ is the normal displacement. |
459 |
|
With one-dimensional displacement, the distorted edge cannot intersect |
460 |
|
itself, and we can write |
461 |
|
\[ |
462 |
|
B = \{\, y \mid n \cdot (y - x_0) \le d( x_y )\,\}, |
463 |
|
\] |
464 |
|
where $x_y$ is the projection of $y$ to the undistorted edge. |
465 |
|
The defining equation can be written as |
466 |
|
\begin{equation} |
467 |
|
n \cdot (y - x_0) + f(x_y) \le 0, |
468 |
|
\end{equation} |
469 |
|
if we define $f(x) = -d(x)$. |
470 |
|
Thus, we have a ``connected case'' in a very similar formulation |
471 |
|
to the above ``scattered case''. |
472 |
|
|
473 |
|
|
474 |
|
- consider vector valued ripple function |
475 |
|
|
476 |
XXX: relaxing the ``natural movement'' property \dots |
XXX: relaxing the ``natural movement'' property \dots |
477 |
|
|