good way to subdivide line segments? [message #40012] |
Wed, 07 July 2004 07:13  |
boncat41
Messages: 2 Registered: June 2004
|
Junior Member |
|
|
right now i have sensor plates defined by 6 pts connected by line segments
(7 pts, so it closes on itself--rectangle). what i'd like to do is
'segmetize' the line segments to get a better resolution and to simplify
future calculations. any ideas? Thanks in advance.
cat
|
|
|
Re: good way to subdivide line segments? [message #40082 is a reply to message #40012] |
Fri, 09 July 2004 06:55  |
btt
Messages: 345 Registered: December 2000
|
Senior Member |
|
|
boncat41 wrote:
> right now i have sensor plates defined by 6 pts connected by line segments
> (7 pts, so it closes on itself--rectangle). what i'd like to do is
> 'segmetize' the line segments to get a better resolution and to simplify
> future calculations. any ideas? Thanks in advance.
Hi,
I think you mean subdividing each line into smaller line segments. Any
straight line can be subdivided by using a trick that David Fanning
describes for interpolating along an image profile.
http://www.dfanning.com/ip_tips/image_profile.html
The following starts with just 2 points and finds interpolates between
the pair.
Ben
x = [8.0, 10.0]
y = [3.0, 15.0]
Plot, x,y, psym = -6
;y = a + bx
b = (y[1] - y[0]) / (x[1] - x[0])
a = (y[0]) - (b * x[0])
print, 'a = ', a
print, 'b = ', b
nInterps = 4
xx = (FindGen(nInterps)/(nInterps-1) * (x[1]-x[0]) )+ x[0]
yy = a + b * xx
oPlot, xx, yy, psym = 4, symsize = 2
|
|
|