MathGroup Archive 2011

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

Search the Archive

Re: Spacing of group of Line[]-s -- any simple way?

  • To: mathgroup at
  • Subject: [mg117026] Re: Spacing of group of Line[]-s -- any simple way?
  • From: Daniel Lichtblau <danl at>
  • Date: Tue, 8 Mar 2011 05:34:00 -0500 (EST)

Peter Sisak wrote:
> Assume two Graphics[]s, consisting of Line[]s only.
> 1. Them being in the same coordinate system, what would be the most straightforward way to calculate the minimum separation of the two Graphics[]s?
> 2. How do you quickly get them to a given "s" separation, utilizing the function Translate[[],{x,0}] on one of the Graphics[]?
> 3. How do you graph the separation as a function of "x"?
> Thanks in advance
> Peter Sisak 		 	   		  

Not clear to me what this means. Do you want to know the closest 
vertical distance between them? Or the closest they get to one another 
in any direction?

The first can be handled by splitting segments so that that all x 
endpoints are listed. Then just iterate over segment pairs in one graph 
vs the other, checking only the distances at the endpoints (where said 
distances are closest or furthest). For m segments in one and n in the 
other, this becomes m+n or so comparisons.

The second can be handled by linear programming. In general this could 
involve m*n minimizations, for m segments in one graph and n in the 
other. If they form convex bodies it is much easier: only one LP call 

Another related possibility is to find, in effect, a middle curve, that 
is, the locus of points midway between the two. This is related to 
"shape offsetting" and can be done by a method called "fast marching". 
Would take some work, though.

Daniel Lichtblau
Wolfram Research

  • Prev by Date: Re: FindFit power law problem
  • Next by Date: Re: Alternative to DumpSave
  • Previous by thread: Re: mathematica 6 saves notebook to an "empy" file
  • Next by thread: Royalty free runtime for Mathematica