Jump to content

  • Log In with Google      Sign In   
  • Create Account

ryt

Member Since 03 Sep 2005
Offline Last Active Mar 01 2014 02:38 PM

#5125968 Branching in switch statement

Posted by ryt on 23 January 2014 - 03:17 PM

That looks interesting. I did not know abaut corutines.

In FSM for states I used enums and I would switch to a new state trough case statements. But I think functions could be also part of a state so functions could have the same name as a state. So if we need to switch to another state without using while we could just call another state function.




#5111446 need an algorithm for following a path (curved line)?

Posted by ryt on 23 November 2013 - 09:10 AM

I would also go with Catmull-Rom. Its a cubic interpolation curve that is connected of more Hermite curves. I think its similar to Lagrange curve. You can get the same Lagrange curve by manipulating coefficients.

 

Bezier curve does not pass trough all of control points or nodes. But if you choose to go with it maybe it would be better to go with B-Splines instead or with NURBS (Non-Uniform Rational Splines)




#5109260 How Languages Compare?

Posted by ryt on 14 November 2013 - 02:37 PM

 

I understand what you are saying there (not really, as I lack the experience of writing large programs to claim understanding). I imagine managing any large programming project is not trivial, but I am curious about what it is that makes managing the larger programs in C++ easier? I have heard the quick answer of "classes", and perhaps this is another question that I need to experience as opposed to hear an answer to, as the quick answer does not really feel like it enhances my understanding (I often take this as a sign that I am missing some fundamental understanding that would make the quick answer more complete, if I had the knowledge). I assume that what Winfield said above is a  Edit::workable good::Edit option, so I guess I am wondering if there is something else that I am not familiar with in C++ that makes it easier to manage code for bigger projects, or if perhaps I need to write more C++ before I will really see the benefits?

Sorry if some of these questions are kind of silly (perhaps). I presume the wonderous shield of 'newb', which should be obvious from said questions, should afford me some pity, assuming that I manage to improve....eventually.

 

Edit::I felt like "workable" may have been communicating a negative or perhaps diminished appraisal of the option that I did not intend.

 

 

Without classes you will end up with a function like GetPositionOfWalkableForOutherSystem(). Where with classes this could be broken into something like this:

 

pWalkable = OutherSystem.GetWalkable();

position = pWalkable->GetPosition();

 

I think that this example is much easier and more readable. Lets say that you have 150 functions as in first example, you will start very soon to struggle to find something you want.

As Agony sad C++ saves a huge time. If you use a lot of functions as in  first example they will start to be dependant of each other and you will not be able to find this dependency very quickly. With classes you just know where the things are as classes provide that for you.

Also Agony sad that learning C might make you better at C++. Its true, and if you know assem things will be a lot more clear to you.




#5109223 How Languages Compare?

Posted by ryt on 14 November 2013 - 12:29 PM

 

This is interesting for me to see. I am sure that there are people developing in all kinds of languages that I would not expect, but I usually see people insisting that you cannot use C, and you need to use C++. I would assume that it is a "toolbox" issue, and nothing is actually quantifiably superior in all ways, with the selection being a matter of choosing which benefits are most important. I am currently kind of a fan of C, but that is probably due to familiarity, since I have spent the most time using it at this point.

Thank you, by the way, for warning me about asking this kind of question. I will either be a lot more careful with how I approach such matters, or I will avoid asking potentially inflamatory questions in the future.

 

 

I don't want to tell you to stop using C, but when your code starts to have 1 000 000 lines I think you will have a hard time to manage around.




#5109218 How Languages Compare?

Posted by ryt on 14 November 2013 - 12:16 PM

Yea, you are right. In C there wound have been needed more arguments since a class manages all that.




#5109210 How Languages Compare?

Posted by ryt on 14 November 2013 - 11:40 AM

C and C++ are really very similar to each other but with one big difference, classes. Classes are like a big new introduction to C and C++ is by miles better just because of this. I really don't know if there are any more big projects written in C since it seams pretty hard to do it without classes.

Classes just make it easier for bigger project because you just get lost in all that functions and you start to write things that you already have. With classes its much more organized and you know where each member belongs.

 

C allows functions without arguments. This is possible in C and C++, and I think all languages support that.




#5108256 C / C++ --> Need help with some text input.

Posted by ryt on 10 November 2013 - 06:21 AM

Std library supports string class so I recommend using this instead of arrays.




#5102211 How to find a rotation of another coord system ?

Posted by ryt on 17 October 2013 - 01:36 PM

I think I've got it, thank you very much, it just needs to be multiplied with inverse matrix M.

But I think I set up my matrix wrong so Ill set it up again.

 

Original matrix M, we set its columns as right, up and forward:

(0.44, 0, 0.89)

(0, 1, 0)

(-0.89, 0, 0.44)

 

Inverse of M, M(-1):

(0.44, 0, -0.89)

(0, 1, 0)

(0.89, 0, 0.44)

 

So the result of multiplying M(-1)*v = v', where v' (0.67, 0, -0.88) and its the same vector in space.




PARTNERS