In extending the warping algorithm of the previous paragraph to
multiple element pairs, we adhere to the intuitive mental model of
magnetic sculpting used in [2]. Each pair of elements
defines a field that extends throughout the volume. A collection of
element pairs defines a collection of fields, all of which
influence each point in the volume. We therefore use a weighted
averaging scheme to determine the point
in
that
corresponds to each point
of
. That is, we first
compute to what point
each element pair would map
in the absence of all other pairs; then, we average the
's using a weighting function that depends on the distance
of
to the interpolated elements
.
Our weighting scheme uses an inverse square law:
is
weighted by
where d is the distance of
from the element
;
is a small
constant used to avoid division by zero.
The type of element
determines how d is calculated:
and the origin
of the local coordinate system of element
.
This definition is identical to [21].
, aligned with the local x-axis and having
length
; d is the distance of
from this line
segment. This definition is identical to [2].
along the local y-axis. d is zero if
is on
the rectangle, otherwise it is the distance of
from the
rectangle. This definition extends segments to area elements.
units along the local z-axis. d is zero if
is within the box, otherwise it is the distance of
from the
box's surface.
The reader will notice that the point, segment, and rectangle element types are redundant, as far as the mathematical formulation of our warp is concerned. However, a variety of element types maintains best the intuitive conceptual analogy to magnetic sculpting.