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:
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.