Looking for an algorithm (GIS) [text only] 
Author Message
 Looking for an algorithm (GIS) [text only]

Hello !

I'm working with a GIS and I have a pointer to structures (X,Y) that are
nodes coordinates that define an Arc:

parray[0] = (X1,Y1) (node 1)
parray[1] = (X2,Y2) (node 2)
parray[2] = (X3,Y3) (node 3)
.........

And I have the couple (from,to) that define a new "Arc".
"from" and "to" are in percent and define the beginning and the end of
the new Arc. Note that "from" can be greater than "to"

Of course, It is possible that a new node has to be defined.

How can I dynamically generate a new "parray" with these criteria ?

More generally, is there a web site where I can find these kinds of
algorithms ?

Help would be very appreciated.

PS: please send your reply to my email adress too.

--
Jean-Paul Dzisiak

CEME - Universit de Lige
Centre d'Etude et de Modlisation de l'Environnement
Sart-Tilman B5
B-4000 Lige
BELGIQUE

Tl +32 (0) 4 366 23 56
Fax +32 (0) 4 366 23 55



Mon, 04 Apr 2005 16:50:13 GMT  
 Looking for an algorithm (GIS) [text only]

Quote:
> Hello !

> I'm working with a GIS and I have a pointer to structures (X,Y) that are
> nodes coordinates that define an Arc:

> parray[0] = (X1,Y1) (node 1)
> parray[1] = (X2,Y2) (node 2)
> parray[2] = (X3,Y3) (node 3)
> .........

> And I have the couple (from,to) that define a new "Arc".
> "from" and "to" are in percent and define the beginning and the end of
> the new Arc. Note that "from" can be greater than "to"

I'm a bit confused about this. If I understand it correctly you
have:

struct point {
  double x;
  double y;

Quote:
} parray[] = {

  {X1, Y1},    /* where Xi and Yi are some constants */
  {X2, Y2},
  {X3, Y3}

Quote:
};

which describes an arc in some sort of coordinate system.
What you want to have is an arc derived from the given
that starts at n% of the total length and ends at m% of the total
length of the original arc. Is that correct?

But you are not asking us how to perform the math to do this, are
you? CLC will probably only help you with the implementation
but not with the algorithm itself.

Quote:

> Of course, It is possible that a new node has to be defined.

A new node, for what?

Quote:

> How can I dynamically generate a new "parray" with these

criteria ?

with malloc():

struct point *parrayp;

parrayp = malloc(3 * sizeof *parrayp);  /* enough to describe an
                                           arc */

Quote:

> More generally, is there a web site where I can find these kinds of
> algorithms ?

> Help would be very appreciated.

> PS: please send your reply to my email adress too.

You post here, you read here.
--

"LISP  is worth learning for  the profound enlightenment  experience
you will have when you finally get it; that experience will make you
a better programmer for the rest of your days."   -- Eric S. Raymond


Tue, 05 Apr 2005 00:22:51 GMT  
 Looking for an algorithm (GIS) [text only]

Quote:

>> Hello !

>> I'm working with a GIS and I have a pointer to structures (X,Y) that are
>> nodes coordinates that define an Arc:

>> parray[0] = (X1,Y1) (node 1)
>> parray[1] = (X2,Y2) (node 2)
>> parray[2] = (X3,Y3) (node 3)
>> .........

>> And I have the couple (from,to) that define a new "Arc".
>> "from" and "to" are in percent and define the beginning and the end of
>> the new Arc. Note that "from" can be greater than "to"

> I'm a bit confused about this. If I understand it correctly you
> have:

> struct point {
>   double x;
>   double y;
> } parray[] = {
>   {X1, Y1},    /* where Xi and Yi are some constants */
>   {X2, Y2},
>   {X3, Y3}
> };

> which describes an arc in some sort of coordinate system.
> What you want to have is an arc derived from the given
> that starts at n% of the total length and ends at m% of the total
> length of the original arc. Is that correct?

Yes, this sort of thing is fairly common in GIS, but the OP's
terminology is a little confusing (s/vertex/node/ in most instances).
And these probably aren't "arcs" in the normal mathematical sense, but
chains of line segments.

Quote:
> But you are not asking us how to perform the math to do this, are
> you? CLC will probably only help you with the implementation
> but not with the algorithm itself.

OP posted this in a number of groups...

Algorithm is theoretically straight forward:
  Compute the length of each segment.
  Sum the lengths.
  Find the segments for the start and the end.
  Compute the start and end vertices along each of the respective
     segments (i.e. arraynew[0] -> 10% (parray[n] <-> parray[n+1])).
  Abra Cadabra: Create resulting chain...

Hardest part is finding the new start/end vertices when from/to not
0 && 100 (or vice versa).



Tue, 05 Apr 2005 11:14:25 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Looking for an algorithm (GIS)

2. Looking for C freeware libraries for image processing/gis applic

3. Text Editor Algorithm - looking for

4. Looking for an algorithm

5. Looking for simple DIFF algorithm

6. Looking for an algorithm to schedule tasks

7. looking for book which teaches to code numerical algorithms (C)

8. Looking for Registration Code Algorithm

9. Looking for a good CRC algorithm.

10. looking for water algorithm

11. Looking for an implementation in C of Dijkstra's algorithm

12. Looking for implementation in C of Dijkstra's algorithm

 

 
Powered by phpBB® Forum Software