Page 12 of 21 FirstFirst ... 27891011121314151617 ... LastLast
Results 166 to 180 of 307

Thread: Coder's Hang-out

  1. #166
    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

    Nope, not Arcus tangent. But it's based on that function.

    http://www.cplusplus.com/ref/cmath/atan2.html

    Language doesn't matter, as long as I can read the code.


    EDIT: Nevermind, I found out how atan2 is defined. If you are interested:

    function atan2 v,u
    if u=0 and v=0 then: not defined, but you might use 0 as answer
    if u=0 then
    if v > 0 then pi/2 else -pi/2
    if u > 0 then atan(v/u) --the normal atan function
    if u < 0 then
    if v >= 0 then atan(v/u) + pi else atan(v/u) - pi
    Last edited by crusher; 12th-January-2006 at 17:15.

  2. #167
    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.

  3. #168
    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.

  4. #169
    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.

  5. #170
    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...

  6. #171
    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?

  7. #172
    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.

  8. #173
    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.

  9. #174
    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!

  10. #175
    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.

  11. #176
    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.

  12. #177
    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.

  13. #178
    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.

  14. #179
    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.

  15. #180
    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.

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