Page 11 of 20 FirstFirst ... 678910111213141516 ... LastLast
Results 151 to 165 of 307

Thread: Coder's Hang-out

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Silly people call it arctangent. Same thing.
    Wouldn't arctan/atan/arcustangent or some similar function exist, with one argument? And then atan(y/x). As that is only what atan2 does.

    EDIT: I am a bit slow on the refresh button, it seems.

  2. #2
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    At first I also thought that atan2 and atan(y/x) was the same thing, but apparently it isn't. Not according to the definition I found. And I just tested it a minute ago and it works great.

    Thanks for trying to help me though. I appreciate it.

  3. #3
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    I still don't see much difference. You just don't divide with zero, and check for the correct sign. Also note that atan2 is capable of returning angles on a larger interval. That might be useful if you do not stick to the strict mathematical definition.

  4. #4
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    The atan2() and the atan2f() functions compute the principal value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value.

    That's the difference...

  5. #5
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Not really.

    atan2 ...returns an angle in the range from -PI to PI expressed in radians...
    atan ...returns an angle in the range from -PI/2 to PI/2 expressed in radians...

    U C?

  6. #6
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    I'm really not sure how to respond.

    This is from the PHP online manual:

    This function calculates the arc tangent of the two variables x and y. It is similar to calculating the arc tangent of y / x, except that the signs of both arguments are used to determine the quadrant of the result.

    The function returns the result in radians, which is between -PI and PI (inclusive).
    There is a difference between the two functions but I really can't go in-depth and explain anything. I don't have the necessary skills.

  7. #7
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Okie. Arc tangent(x), as in the classic, mathemathical function, defined as the number between -PI/2 and PI/2, whose tangent equals x. So, basically the inverse function of tangent(x).
    You'd see now that tan(atan(x) ) would be x, if -PI/2<x<+PI/2. So, you're not going into the second and third quadrants, ever. So if you'd take tan(atan(3/2 PI) ) you'd get -PI/2, not quite what you'd expect. atan2 is extended so you can do this conversion back and forth with any angle from 0 to 2PI radians.

  8. #8
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Ah I see. Thanks for explaining.

    Anyway, as usual, when porting, some unexpected things are happening. Need to find the source of these evil doings!

  9. #9
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    What are you porting from and to? I'm just curious.

  10. #10
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    I made the IK arm in a language called Jamascript, used by a program called Jamagic. It's based on Javascript. I'm porting the code to Multimedia Fusion, which really isn't a language at all. But I guess you know about it...

    I would've done it in C if I knew anything about graphics programming. But I haven't got that fair yet. Still doing simple console apps.

  11. #11
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    ActionScript is good, if you know a bit of Flash. You don't have to mess with graphics, and it's very similar to C++, although obviously a lot more basic. Did an adventure game sortof thingy in it. Never got finished... well, not yet.

  12. #12
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Not very good with Flash either. Though ActionScript is pretty easy to understand. I might give it a try. Though I'd really want to learn to create everything from scratch sometime.

  13. #13
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    If "everything from scratch" means truly everything, well, that's a nice thing, but pretty dangerous in some ways. What I mean is that being a top-class low-level coder means you'll be able to ace most programs in terms of speed, but it also means your knowledge will be very limited, chained to a specific hardware/OS combination. Like how VGA graphics in DOS was insanely simple, but in OpenGL, even that became a bit problematic. Freaking slow, too, but at least it worked in WinXP.
    But, you could always just lucky and guess who'll come out as a victor from the next-gen console war, and master that architechture.

  14. #14
    crusher's Avatar
    crusher is offline ↑ ↑ ↓ ↓ ← → ← → B A START
    Join Date
    Jun 2002
    Posts
    15,697
    Thanks
    3
    Thanked 22 Times in 17 Posts
    EP Points
    35

    Default

    Hah, yeah that is the best course of action. I have to say, I actually enjoy programming hardware where the actual system is already done and all you have to do is read and write to some registers. That's why I really love GBA programming. I just need to get the hang of some common C stuff like structures and different kind of pointers. But apart from that, it's piece of cake.

    Right now I'm porting my IK exampel to GBA. I've already set up the graphics. Just need to port the code now.

  15. #15
    Join Date
    Feb 2005
    Location
    Limbo
    Posts
    3,706
    Thanks
    0
    Thanked 2 Times in 2 Posts
    EP Points
    10

    Default

    Nah, I dislike counting clock cycles and comparing the speeds of register access. Also, the concepts of AI and assembler don't really like go well together. I also found it a bit troublesome (back when I tried my hand at VGA under DOS) that if you want to do something that's not supported on the hardware level, you'll have to optimize it real hard. Scrolling was a pain, I imagine I probably wouldn't have been able to get some unfilled polygons to display in 3D there at decent speeds. And the last thing I'd want to do is optimize mathemathical routines in assembler.
    To each his own, I guess.

    I hope your stuff will work in VBAdvance.

Similar Threads

  1. Visit The Hang Out!
    By Georgyw5k in forum Free 4 All
    Replies: 5
    Last Post: 28th-November-2003, 05:18
  2. Do You Hang Up On Advertisement Callers?
    By ((KvN)) in forum Free 4 All
    Replies: 52
    Last Post: 21st-July-2003, 11:16

Posting Permissions

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

We are the oldest retro gaming forum on the internet. The goal of our community is the complete preservation of all retro video games. Started in 2001 as EmuParadise Forums, our community has grown over the past 18 years into one of the biggest gaming platforms on the internet.

Social