Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you don't want to convert to implicit surfaces (as described by @ananthonline), you can just tweak all the vertices based on the "magnet" strength and location. Note that the following will not create any new vertices, just attract existing ones; this could be an advantage or a disadvantage, depending on your application.</p> <p>Given a magnet location <code>M</code>, you can tweak each vertex <code>V</code> to a new location <code>V'</code> as follows:</p> <pre><code>point V = [incoming vertex] point M = [magnet location] float range = [chosen nominal range for the magnetic effect] float range2 = range * range [range squared, for comparison with squared distance] vector MV = V - M [vector from M to V] float alpha = range2 / (range2 + dot(MV, MV)) [weighting factor] point V' = alpha * M + (1-alpha) * V [new, "magnetized" position] </code></pre> <p>Vertices several times the <code>range</code> distance from <code>M</code> will be only minimally affected. Vertices within the <code>range</code> will be strongly attracted, but they won't go crazy. Each magnetized vertex will be somewhere on the line between <code>M</code> and its original position, which will create a "pucker" effect: the magnetized locations will be denser near the magnet, at the expense of the region they were attracted from.</p> <p>If you don't like the exact shape of the magnetic effect (e.g., if you want to make sure that vertices beyond a certain distance don't move at all), you can tweak the formula for <code>alpha</code>. Just make sure that <code>alpha</code> doesn't exceed <code>1</code>, and approaches <code>0</code> as the <code>dot(MV, MV)</code> becomes large.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload