Does anyone know...

This is a discussion on Does anyone know... within the C++ Programming forums, part of the General Programming Boards category; This is my first programming class... so... that is why I am asking a lot of questions.... If I have ...

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    19

    Does anyone know...

    This is my first programming class... so... that is why I am asking a lot of questions....

    If I have 3 forces...i, j, and k - but, I need to find the direction of just i... how do I got about doing that?

    I dont have any angles - just those three forces...

    does anyone know how to insert a C++ statement that would calculate the angle of just one force?

    Thanks again.

    MyDestiny

  2. #2
    Registered User
    Join Date
    Feb 2005
    Posts
    44
    Are we talking vector momentum?

    The C++ behind it is very simple - it's the math that could be tricky (if even that).

    I think we need a little more info. Like, what code do you have so far? What does each variable represent? Like, is i a vector, a magnitude, or what?

  3. #3
    Registered User
    Join Date
    Feb 2005
    Posts
    19
    Wait... I think I got confused... let me explain what I need...

    I have 3 components for Force F1 - i, j, and k

    I calculated the magnitude of i, j, and k

    Now, I need to calculate the direction of i, j and k.

    Did that help?

  4. #4
    Registered User
    Join Date
    Feb 2005
    Posts
    44
    So F1 is the total net force acting on an object, where i, j, and k represent the various "sub-forces" acting on it - like friction, etc?

    I'm not really sure if you mean there are three sources of the "push" such as three people pushing a block from various angles, or if the variables represent certain components of a single push coming from one source

  5. #5
    Registered User
    Join Date
    May 2003
    Posts
    82
    i, j, and k are unit vectors. Any vector can be broken down into unit vector components.

    I think you should work out some psuedo-code, and set up the problem (ie, what data type are i, j, k). It's not at all clear where the C++ problem is.

    If you're not sure how to calculate the resultant vector from components, you need to check your physics book. If you are sure, write it down in logical steps and attempt to code it.

  6. #6
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Before you can write the code, you have to know how to solve the problem (the algorithm). So at this point, it's either a math (or physics) problem. Do you have the prerequisites for this course?

    I have 3 components for Force F1 - i, j, and k... Now, I need to calculate the direction of i, j and k.
    What? Maybe you should post the actual problem.

    If i, j, & k, are "components" of a vector, then they are precisely in directions X, Y, and Z. ...All 90 degreess apart... I suspect you're supposed to calculate the direction of F1. (?) I don't remember exactly how to do that... and I've forgotton what a 3-dimensional vector expressed as magnitude and direction "looks like"... but you'll need two angles.

  7. #7
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    You mean I can't just plug numbers into C++ and come up with a unifying theory of all forces throughout the cosmos? What a jip.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21