Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. need a function for c language

need a function for c language

Scheduled Pinned Locked Moved C / C++ / MFC
learning
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z zhuangfanyin

    hi, i am learning c code, and i am looking for a function 2 calculate the short way in a map, does anyone have such function, thx:-D:laugh::laugh::laugh::laugh::laugh:

    T Offline
    T Offline
    toxcct
    wrote on last edited by
    #2

    isn't the shortest way between two points the line ? :-D:laugh:;P:cool:


    TOXCCT >>> GEII power
    [toxcct][VisualCalc]

    C Z 2 Replies Last reply
    0
    • Z zhuangfanyin

      hi, i am learning c code, and i am looking for a function 2 calculate the short way in a map, does anyone have such function, thx:-D:laugh::laugh::laugh::laugh::laugh:

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #3

      I think this will depend a lot of how your map is implemented. You know, if I had to respond to your question like it is asked, the response is simple: it's the straigh line !! But I suppose it's not the solution you want to hear isn't it ;P ? So try to be a little bit more precise... You can also look for the A* pathfinding algorithm (a google search gave me these links[^] Maybe it will be helpfull...

      Z 1 Reply Last reply
      0
      • T toxcct

        isn't the shortest way between two points the line ? :-D:laugh:;P:cool:


        TOXCCT >>> GEII power
        [toxcct][VisualCalc]

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #4

        I think we were thinking the same thing :laugh:

        1 Reply Last reply
        0
        • T toxcct

          isn't the shortest way between two points the line ? :-D:laugh:;P:cool:


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          Z Offline
          Z Offline
          zhuangfanyin
          wrote on last edited by
          #5

          yep,i mean there are lotz of points, find the shortest way bewteen 2 points

          1 Reply Last reply
          0
          • C Cedric Moonen

            I think this will depend a lot of how your map is implemented. You know, if I had to respond to your question like it is asked, the response is simple: it's the straigh line !! But I suppose it's not the solution you want to hear isn't it ;P ? So try to be a little bit more precise... You can also look for the A* pathfinding algorithm (a google search gave me these links[^] Maybe it will be helpfull...

            Z Offline
            Z Offline
            zhuangfanyin
            wrote on last edited by
            #6

            first of all, i am using dos second , there a lot of points, there r different distance bewteen 2 points, and i need a function 2 calculate the shortest path bewteen 2 given points

            Z 1 Reply Last reply
            0
            • Z zhuangfanyin

              first of all, i am using dos second , there a lot of points, there r different distance bewteen 2 points, and i need a function 2 calculate the shortest path bewteen 2 given points

              Z Offline
              Z Offline
              zhuangfanyin
              wrote on last edited by
              #7

              THX FOR THE HELP!!!!!!!;);););););););););)

              Z 1 Reply Last reply
              0
              • Z zhuangfanyin

                THX FOR THE HELP!!!!!!!;);););););););););)

                Z Offline
                Z Offline
                zhuangfanyin
                wrote on last edited by
                #8

                BY THE WAY, DO U HAVE THE SOURCE CODE FOR C OR C++, THX:-O

                C 1 Reply Last reply
                0
                • Z zhuangfanyin

                  BY THE WAY, DO U HAVE THE SOURCE CODE FOR C OR C++, THX:-O

                  C Offline
                  C Offline
                  Cedric Moonen
                  wrote on last edited by
                  #9

                  I have implemented this algorithm but for a specific application (a game in fact). But I was using hexagonal cells and the distance between two 'cells' was always 1 in my case. So I think your implementation will be very different... But I can send you what I've done if you want to have an example... I don't have it here so I will send it to you when I'm back home. Just give me your e-mail adress. Also, there are plenty of examples on the web and I think once I saw an example that was describing exactly the scheme you are asking for: the distance between two points is not equidistant (and there you'll have to play with the weight of the path between the two points).

                  Z 1 Reply Last reply
                  0
                  • C Cedric Moonen

                    I have implemented this algorithm but for a specific application (a game in fact). But I was using hexagonal cells and the distance between two 'cells' was always 1 in my case. So I think your implementation will be very different... But I can send you what I've done if you want to have an example... I don't have it here so I will send it to you when I'm back home. Just give me your e-mail adress. Also, there are plenty of examples on the web and I think once I saw an example that was describing exactly the scheme you are asking for: the distance between two points is not equidistant (and there you'll have to play with the weight of the path between the two points).

                    Z Offline
                    Z Offline
                    zhuangfanyin
                    wrote on last edited by
                    #10

                    THX, MY EMAIL IS zhuangfanyin@hotmail.com:laugh:

                    N 1 Reply Last reply
                    0
                    • Z zhuangfanyin

                      THX, MY EMAIL IS zhuangfanyin@hotmail.com:laugh:

                      N Offline
                      N Offline
                      ng kok chuan
                      wrote on last edited by
                      #11

                      u might want to take a look at dijkstra's algorithm. google it and take the first link.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups