- **C**
(*http://www.go4expert.com/forums/c/*)

- - **How to redistribute points on line..??**
(*http://www.go4expert.com/forums/redistribute-line-t18929/*)

How to redistribute points on line..??1 Attachment(s)
hello,
I dont know actually in which category this problem fits into.. i assumed this is the correct place.. If not then pls guide me as where to post it.. I have set of points which are connected with a line... This connected line may or may not be straight.. As we all know the first and last points of this connected line is called nodes.. and intermediate points are known as vertices.. Now, i need to redistribute the vertices over this line in such a way that, all the vertices are equally spaced. I mean, suppose if the user wants the vertices to be redistributed with the spacing of say 10 units.. Here i need to have new set of vertices, having distance between each pair of points(x,y) should be 10. One way i tried this is to start with the first point of the connected lines, and read each point(x,y) along the line segment and find whether the distance of these two points is 10. If it is 10, then take the new point as your reference point and repeat the process... This method works fine. But for lines of different directions, the distance is not same.. so i dont get equally spaced points. The problem is diagramatically expained in the file attached.. 1 is the first input from the user.. 2 is after redistributing... I just want to calculate new points... not to plot them.. Is there any other way out for this..?? Thanks in advance |

Re: How to redistribute points on line..??What if the spacing means the end points can't be included? For example, if we want vertices spread over every 4 units in a 10 unit line, this isn't possible:
Code:
`x--------x` So let's say for example vertex 1 is at r theta = 12 at 45 degrees, the neighbouring node is at (0,0), and we want 4 points. 12/3=4 so the new vertices will be at r=0, 4, 8 and 12; theta will be the same for all, so just convert (0,45), (4,45), (8,45) and (12,45) back to rectangular coords and that will be the solution. But if you know the spacing then the division isn't necessary; you still need theta so the r-p and p-r conversions are still both needed, but if vertex 1 isn't at an r that is evenly divisible by the spacing then you have the previously mentioned problem, what if, say, vertex 1 is at (11,45) and the spacing of 4 is requested? Would you then place the next vertex at r=1 for the next segment, i.e.: Code:
`N--------V--------V---.. // Original lines. V=vertex, N=node` |

Re: How to redistribute points on line..??HI..
Dividing into n number of points is another alternative option.. I mean user can redistribute vertices either by specifying spaces of by specifying number of points.. Anyhow, i need that also later. Thanks in advance ... Quote:
Quote:
Thanks n regards |

Re: How to redistribute points on line..??> how to find theta..??
I already said. Look up "rectangular to polar conversion" in your favourite search engine. |

Re: How to redistribute points on line..??Hi...
Thanks yaar.. It worked absolutely fine.. Check out for my new post.. Thanks and regards |

All times are GMT +5.5. The time now is 06:17. |