Page 1 of 2 12 LastLast
Results 1 to 40 of 60

Thread: I hate trig

  1. #1
    Zaei
    Guest
    SImple, enough. If you have, say, 4 nodes, the first is at 45, the second at 90+45, the third at 180+45, and the fourth at 360-45. Now, to find the coordinates, simple multiply each angle by (pi / 180) to convert to radians, and use this formula:
    Code:
    p.x = center.x + radius * cos(radianMeasure)
    p.y = center .y + radius * sin(radianMeasure)
    Where radianMeasure is the degree angle converted to radians, p and center are POINTAPI, radius is, of course, the distance from the center to each node.

    I chose to start at 45, because you will then get a nice looking X shape. You should start the count at (angleBetween / 2).

    Z.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Hmmm well the user can do any from 1 up to n hosts. So I would have to start a spoke somewhere, and then each additional spoke is (360 / hosts) degrees away...

    uhn I really hate trig stuff. I much prefer proper coding
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    Zaei
    Guest
    That's what I am saying. Start the first host at (360 / hosts) / 2, and increase that count by (360 / hosts) each time.

    Z.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    You wanna code it for me ?
    I'll swap for the tracert+ping code
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Honestly, even the simplest of things elude you!

    What he said was:

    LengthOfSpoke = (((pi * 42)/6) * AvgNoOfBowelMvmntsThisWeek) + _

    centerpoint + ((100/maxping)*pingsize) *cos( ((360/maxnodes)*currentnode)*(pi / 180 ))

    Easy innit!
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  6. #6
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    For ease-of-use, use a different coordinate system that has your computer's centre at 0,0. Then for each computer use X = Cos((ComputerNumber / Computers) * 360 * (Pi / 180)) * (length you want it to be away from), and set Y with the Sin() function in the same way.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  7. #7
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    People, im looking for code, not comments
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  8. #8
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    nodex = centerpoint + ((100/maxping)*pingsize) *cos( ((360/maxnodes)*currentnode)*(pi / 180 ))

    nodey = centerpoint + ((100/maxping)*pingsize) *sin( ((360/maxnodes)*currentnode)*(pi / 180 ))

    there's some rough maths for you you moaning git!

    Don't know if it works - I've just come back from the pub and maths isn't my strong point anyway. If it's useless and wrong then it's useless and wrong. I don't care....
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  9. #9
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Check your email. Don't toy with me right now
    Anyway. I just need some code to copy and paste. I'm in no mood to rub brain cells together. I'm in more of a mood to wet them with a bit of bulmers...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  10. #10
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Not got an eMail yet matey, servers are running slow. Thought you hadn't bothered replying

    The best I can offer is that you put your wotsit on a server somewhere and I'll download it and have a look. I can't post code based on what you've put here...
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  11. #11
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    www.coolground.com/plenderj/4.zip

    it does a tracert to 4 addresses at the moment.
    user will be able to tracert to 1 or n hosts.
    records all the info.
    have to display.
    oasidj2sfkop3
    p
    asjfoi!
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  12. #12
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Got your mail and replied now. I'm look at the project as well.

    What happened at the bottom of you post? Bang you head against the keyboard?
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  13. #13
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    bout of rage.
    got some groove armada (at the river) on at the minute, so its all good.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  14. #14
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Ok, I've looked at that project and it seems to get in an infinite loop. The sHostIP never changes and as it's being compared at one point to get out of the loop - it never makes it.

    Is this just me being thick?
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  15. #15
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Its you being thick.
    tracert works ; trust me. its complicated.
    just do the trig
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  16. #16
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    I'm struggling with it because I can't test it because it doesn't work.

    I'll try it at home where I can look at it without being hidden behind all the complicated network ****e and I can get some ping values back.

    Speak to you in an hour or so.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  17. #17
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Holy crap jamie, you don't know euler transformation?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  18. #18
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    D*MN!!! It ate my post! I spent the last half an hour writing it

    Ok so I'm gonna post here just the code. And this one I'm sure it works

    VB Code:
    1. Angle = (Pi * 2 * Host) / NumHosts
    2. HostX = CircleX + Cos(Angle) * CircleRadius
    3. HostY = CircleY + Sin(Angle) * CircleRadius

    Let's see... Pi is obviously 3.1415926..., Host is the number of the host you're drawing, NumHosts is the number of hosts, CircleX/Y is the center of the "circle of hosts", and CircleRadius is the radius of that circle.

    Hope that helps!
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  19. #19
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    This is kinda what im after.
    Each circle on the way is each router on the route ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  20. #20
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    you can define a complex offset unit to traverse the rotation
    Cu=1*e^j2pi/n
    and for each singly likned node shown in your figure, increment by Cu*Cn
    Cn=u*ping*e^j0
    These are polar representation of complex values, the transformation to cartesian is:
    r*e^(j*theta)=cos(theta)+jsin(theta)
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  21. #21
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Christ almighty. All I want is a .frm given to me that'll do the job
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  22. #22
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    jamie, you should learn this immediately, it'll be good for you Does the routes split up?
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  23. #23
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    Sorry but I don't know much about routes and all
    Do these things branch out into others, like a tree?
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  24. #24
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Jamie,

    I fail to see what's wrong with the calculations that Jotaf and I posted. They're both pretty similar (mine's not been tested though) but in Jotaf's I guess you'd replace "radius" with the server ping.

    PS - I completely fail to see what Kedaman's on about at all. No change there then.

    I think I need to buy some more IQ.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  25. #25
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Ked; No the routes dont split. Just a straight line out at an angle with the nodes along the route along that line.

    Rest; I dont wanna do no work. I'm anti-trig. I need a .frm
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  26. #26
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    If you use complex values you avoid trigs at almost all costs, eulers formula is unavoidable though, but without it you are no programmer.
    Jamie, you learn Trigs at 7'th year or something in basic school here, how come you've avoided them so far? No, you won't survive without them further on.
    PS - I completely fail to see what Kedaman's on about at all. No change there then.
    Complex values have two faces, they are both polar and cartesian, which makes them an excellent tool You can though use trigonometry all the time for some transformation, but complex values enhance your generic thinking and makes it easier for you, when you have to do a long series you might win both runtime performance and developement time.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  27. #27
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I studied complex numbers and polar co-ordinates and all that about 3 years ago. Since then the only time I needed trig was for Craft and I finished the trig part of that ages ago
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  28. #28
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Sent you an frm with some **** in.

    Can't test it 'cos your shoddy code doesn't work properly. It may end up drawing the images completely off the screen - you'll have to step through in a debug to see what it does.

    It never gets to that point on mine, it just goes into an endless loop. Don't complain if it doesn't work, because coding trig blind is insane and is guaranteed not to work first time.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  29. #29
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well the tracert works for me
    Anyway yeah its drawing stuff all in the centre...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  30. #30
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Hmm the code kinda works. It does draw stuff (we're drawing otherNode.hdc btw). Anyway, it only draws the destination node, not the nodes inbetween...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  31. #31
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Are you pinging all the servers inbetween?

    If so, and you're storing the ping values in an array then you can easily get it to draw the ones inbetween.

    That just loops through the troute wotsit array. If there are other gubbins then just add them in.

    I'll take another look and see if I missed anything. It's rather hard, not being able to see what I'm doing and all...
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  32. #32
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    What's dis hoptime thing for?
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  33. #33
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    The hoptime is the time to that node. Thats also gonna be the distance between nodes
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  34. #34
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    right, gissa mo and I'll send you something else
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  35. #35
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Sent you some porn in your eMail.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  36. #36
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    u didnt send me natin but text
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  37. #37
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    I sent you an frm
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  38. #38
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    i only got the first one from you.

    ... keep talking, im nearly at 4096
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  39. #39
    PowerPoster Arbiter's Avatar
    Join Date
    Sep 2000
    Location
    Manchester
    Posts
    2,276
    Idiot boy!

    I sent you another .frm with different code.
    Gentile or Jew,
    O you who turn the wheel and look to windward,
    Consider Phlebas, who was once handsome and tall as you...

  40. #40
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    never got it
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

Page 1 of 2 12 LastLast

Posting Permissions

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



Click Here to Expand Forum to Full Width