Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: read coordinates from text files.

  1. #1
    Join Date
    Jul 2005
    Posts
    93
    Rep Power
    0

    Default read coordinates from text files.

    how can i read from a text files and use the coordinates to draw lines on a picture.

    in the text files values are like thsi

    34343
    676.4545
    343.343434
    434.33434
    676.6767

    in that the first value would be x second value y third valus x1 and fort y1, i use use a loop to get it but my program keep crashing

    read files

    loop statement

    picture1.line(x,y)-(x1-y2)

    end loop

    the file is attached
    please help me

  2. #2
    Join Date
    Jul 2006
    Posts
    239
    Rep Power
    0

    Default

    Still
    Are you using VB6 or VB.Net

  3. #3
    Join Date
    Jan 2007
    Posts
    164
    Rep Power
    18

    Default

    Quote Originally Posted by Dj Still View Post
    how can i read from a text files and use the coordinates to draw lines on a picture.

    in the text files values are like thsi

    34343
    676.4545
    343.343434
    434.33434
    676.6767

    in that the first value would be x second value y third valus x1 and fort y1, i use use a loop to get it but my program keep crashing

    read files

    loop statement

    picture1.line(x,y)-(x1-y2)

    end loop

    the file is attached
    please help me
    Where is your code?
    -------------------

  4. #4
    Join Date
    Jan 2007
    Posts
    164
    Rep Power
    18

    Default

    Why did I put a line under my post above...this forum software telling me my message too short that it have to be 20 characters or more...why we promoting inefficiencies?

  5. #5
    Join Date
    Jul 2006
    Posts
    239
    Rep Power
    0

    Default

    Why do you need the code hassanvoyeau. All you need to know is what technology he is running and then you could provide your code that is best fit with it.

    What i want to know is if he is doing this in .Net or VB6 so i could send him the best code effecient code.

  6. #6
    Join Date
    Oct 2005
    Posts
    745
    Rep Power
    0

    Default

    How are single values used as coordinates,
    Is it
    x
    y
    x2
    y2
    ??
    Otherwise I'm not sure what you are trying to do.
    3.14159265358979323846264338327950288
    4197169399375105820974944592307816406
    28620899862803482534211706798 pi 101

  7. #7
    Join Date
    May 2006
    Posts
    196
    Rep Power
    0

    Default

    Recursion - It looks like that's how the file is set up. Each part of the coordinate is on different lines.

    I hope he has plans of putting error checks in the code in case the file doesn't have all the needed coordinates.
    I went to a bookstore and asked the saleswoman, "Where's the self-help section?" She said if she told me, it would defeat the purpose.
    Windows 7 Pro, Gigabyte MA785GM-US2H, AMD Athlon II 245, OCZ Reaper 2X2GB DDR2 1066, WD 500GB+WD 200GB, Cosair 400W, 23" eMachine 1080p Monitor

  8. #8
    Join Date
    Jan 2007
    Posts
    164
    Rep Power
    18

    Default

    Quote Originally Posted by redbwoy View Post
    Why do you need the code hassanvoyeau. All you need to know is what technology he is running and then you could provide your code that is best fit with it.

    What i want to know is if he is doing this in .Net or VB6 so i could send him the best code effecient code.
    I not going to spoon feed he. I prefer to show him what wrong with what he doing. Better to teach a man to fish than to give him a fish.

  9. #9
    Join Date
    Oct 2005
    Posts
    745
    Rep Power
    0

    Default

    Well the file contains an even number of inputs so I guess that assumption could hold. His sample contains an odd number though, hmmmmmmm
    3.14159265358979323846264338327950288
    4197169399375105820974944592307816406
    28620899862803482534211706798 pi 101

  10. #10
    Join Date
    Dec 2002
    Posts
    500
    Rep Power
    0

    Default

    Quote Originally Posted by Ghionw View Post
    Recursion -
    I hope he has plans of putting error checks in the code in case the file doesn't have all the needed coordinates.
    that may very well be the problem there are 26 lines in the file...not a multiple of 4

    unless u going to assume usage of the last point to join each line segment

    Code:
    x
    y
    x2
    y2
    x3
    y3
    x4
    y4
    ...
    to draw
    Code:
    (x,y)-(x2,y2)
    (x2,y2)-(x3,y3)
    (x3,y3)-(x4,y4)
    (x4,y4)-...
    Quote Originally Posted by hassanvoyeau View Post
    I not going to spoon feed he. I prefer to show him what wrong with what he doing. Better to teach a man to fish than to give him a fish.
    totally agree!
    Code:
    read data points
    
    last point <- snag out first point
    
    loop for points existing
    	next point <- snag out another point
    
    	line from last point to next point
    
    	last point = next point 
    end loop
    Last edited by icymint3; Apr 19, 2007 at 03:32 PM.
    Cultured in Aggression and Koding like a Warrior!!
    “Common sense is instinct. Enough of it is genius.” - George Bernard Shaw.
    "The significant problems we face cannot be solved by the same level of thinking that created them." - Albert Einstein

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •