MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Moving an outsider to the closest point on the boundary

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63695] Re: Moving an outsider to the closest point on the boundary
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 10 Jan 2006 01:48:49 -0500 (EST)
  • Organization: Uni Leipzig
  • References: <dogkjg$pui$1@smc.vnet.net> <dptd2u$a4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

and computing the signed distance transform of the
contour and move the points into the gradient direction
of the signed distance function does not help ??

Regards
  Jens

"Peter Pein" <petsie at dordos.net> schrieb im 
Newsbeitrag news:dptd2u$a4$1 at smc.vnet.net...
| Borut Levart schrieb:
| > Respected subscribers of 
comp.soft-sys.math.mathematica,
| >
| > I have bumped into a problem which I cannot 
solve.
| > I have defined a distance function d(x,y) that 
says True in the inside
| > of the closed geometry of interest and False 
outside. Initially there
| > are some points inside the geometry. My 
iterating algorithm moves those
| > points. Some stay inside while others may 
drift away over the boundary
| > to the outside. I would like to select those 
outsiders and move them
| > back in, however, not in any way: I want to 
move them back to the
| > closest point on the boundary. (This 
corresponds to the physical
| > analogy of my work.)
| > Here is an example of a unit circle as defined 
geometry and two points:
| >
| > In[1]:=
| > d[x_, y_] := x^2 + y^2 = 1
| > p1 = {0, 0};
| > p2 = {.8, .5};
| > dp1 = {-.1, -.1};
| > dp2 = {.3, -.3};
| >
| > In[2]:=
| > DensityPlot[
| >   If[d[x, y], 1, -1],
| >   {x, -2, 2}, {y, -2, 2},
| >   PlotPoints -> 100,
| >   Mesh -> False,
| >   Epilog -> {
| >       Hue[0], PointSize[.02],
| >       Point /@ {p1, p2},
| >       Hue[.6], Point /@ {p1 + dp1, p2 + dp2}
| >       }
| >   ]
| >
| > After each iteration I would like to correct 
the set of points by doing
| > something like this:
| >
| > In[3]:=
| > If[! d @@ #, bringBack[#, d2 @@ #], #] & /@ 
{p1 + dp1, p2 + dp2}
| >
| > Out[3]:=
| > {{-0.1, -0.1}, bringBack[{1.1, 0.2}, d2[1.1, 
0.2]]}
| >
| > But, bringBack?
| >
| > Thank you for your time and suggestions,
| > Borut Levart
| >
|
| Hello,
|
| I'm sure you found a solution in the meantime, 
but here are my 2 cent:
|
| In[9]:=
| bringBack[{x_, y_}] := 
ComplexExpand[(#1[Exp[I*Arg[x + I*y]]] & ) /@ {Re, 
Im}]
|
| In[10]:=
| bringBack[p2 + dp2]
| d @@ %
|
| Out[10]=
| {0.9838699100999074, 0.17888543819998318}
| Out[11]=
| True
|
| Peter
| 



  • Prev by Date: Re: Puzzle Challenge
  • Next by Date: Re: Re: Re: Re: Taking either a sequence or a list
  • Previous by thread: Re: Moving an outsider to the closest point on the boundary
  • Next by thread: Re: Getting the value of the independent var from the dep.var using NDSolve