I am trying to understand the Math of a Camera in Computer Graphics. Here is the question If i have a camera a point a, How do I compute the view matrix so the camera looks at point b?
joshp1217
Posts
-
3D Camera Math Question -
Newbie Camera Math QuestionI am trying to understand the Math of a Camera in Computer Graphics. Here is the question If i have a camera a point a, How do I compute the view matrix so the camera looks at point b?
-
Newbie QuestionI thought that was how it should work but when I sent it up that way, i was getting errors like the Deck class didnt recognize the Card class because when i said vector m_Cards;(this is in the deck.h with #include "card.h" at the top) it basically would say that a vector cant have any empty type. The IDE i am using is Dev-C++ I dont know if that has anything to do with it but any further help would greatly be appreciated because I could do this with ease in C# but I need to do it in C++.
-
Newbie QuestionI want to compile a project that I have created. The project has class objects separated in different files i.e. main.cpp, card.h, card.cpp, deck.h, deck.cpp. How am I able to do this so the deck class can create in instance of the card class i.e. vector x; I know this is really newbie but I got to know.
-
How can I improve this FunctionI see what you are saying, You dont want the dest == src because then you are performing a action that is not needed because they are already the same correct? Yes, That's one case of an optimisation improvement but it's questionable whether you want to pay the price of checking every time against it only saving time when the user is being daft. A tricky one. A much worse case is when src and dst are nearly the same for example when dst == src+2 but size == 10; the docs for this sort of function sometimes refer to this sort of situation and say the result will be 'undefined'. Just another way of saying it will all go Pete Tong if you ask me. Also size is an unsigned integral so it will never be less than zero True eonugh so try a test where you write size=(size_t)(-1) and then call memcpy! if size is greater than the allocated memory dest points to then basically you will be increment out of bounds which will cause an error, but how can you check to make sure the sizes match up? It will only cause an error in the sense of a reported error if some piece of code detects that it has happened otherwise it will happily go ahead and read and write memory it shouldn't and often return just as if it had worked. If you want to prevent this you might need to add extra parameters, Microsoft do in their Safe CRT functions, and use the API memory check calls like IsBadWritePtr to check whether you have access to the memory being read and written. What is an example of a src that isnt valid? Once example is where src = 0x00000002. This is never going to be a valid pointer but it will pass a NULL check. It may seem that this could never happen but if someone gets size and src swapped over, size_t will happily take a 32bit pointer value and src will happily auto cast a size_t. Ow! My point is that there is an almost endless amount of checking that you could add to a function like this but whether that 'improves' it is a matter of opinion. I think it does providing that it has no runtime cost in the Release build and that it doesn't obscure the purpose or operation of the function in such a way as to make maintenance difficult. Even such an apparently trivial function can be a major challenge if looked at the right way. Most of us knock out hundreds of such functions all the time without a second thought but as they say 'once you've started digging it's much harder to find the bottom of the hole'. :-) Matthew F.
-
[Message Deleted]Yeah they said that I didnt need to post it twice but the question basically was: What is wrong or how can I improve this function: void* memcpy( void* dest, void* src, size_t size ) { byte* pTo = (byte*)dest; byte* pFrom = (byte*)src; assert( dest != NULL && src != NULL ); while( size-- > 0 ) *pTo++ = *pFrom++; return (dest); }
-
[Message Deleted]No No this is a question I have to answer, I am just checking to make sure the function code show doesnt cause cause any problems and it is efficient code.
-
How can I improve this FunctionSo there is no way I can optimize it or make it more efficient, because when I looked at it it seemed fine to me to but I have to make sure.
-
[Message Deleted][Message Deleted]
-
How can I improve this FunctionI have to improve this code for a test, so any help you can Provide I would greatly appreciate.
-
How can I improve this FunctionI am getting back into C++(be doing C# heavey for the past few years), Can anyone give me some help on how I can improve the function so no problems dont arise when it is run? I appreciate the help you guys. void* memcpy( void* dest, void* src, size_t size ) { byte* pTo = (byte*)dest; byte* pFrom = (byte*)src; assert( dest != NULL && src != NULL ); while( size-- > 0 ) *pTo++ = *pFrom++; return (dest); } Thanks.
-
Tree View SearchWhat is a good way to implement a tree view search where using wild card is possible?
-
Stored Procedure with OutputI know this is a newbie question but I am a newbie to writing stored procedures, Ok I want to right a stored procedure that copys data from one table to another table based on a certain ID then output back to the program that executes the stored procedure the ID of the next record available in the table that was just copied into. So basically i have table x and y, y is a history table of x, whenever things are about to change in x i save certain records (based on an ID) into Y, after I save this specific data to y, I want to ouput Y next record ID that is avaible(ex. if I add rows with IDs 1-10, i want to output back either 11). So how can I do this? Any Help will be greatly appreciated.
-
Copy Stored ProcedureI need to write a stored procedure that will copy rows from one table and insert them an another table based on a unique id. Any Ideas? I am very new to writing stored procedures so any help would be greatly appreciated. Thank You
-
Tree View QuestionI have a class: class DBdata { public int id; public int name; public int email blah blah blah } This class correlates to a table in the database, as you could probably tell. I want to show this in Tree View where for example the name is the actually text of the node but the id and email are also encapsulates parts or that data, so that is to say if a drag one node from one tree to the another tree view it will cary its data with it. How can i do this because in a tree view I cant add any object unless it is of type TreeNode.
-
Sink??As I study more C# and work with it more at my job, I have read and heard the term "Sink" what exactly does that mean? I have heard it in reference with events and delegates but do not have a clear understanding of its meaning. Any help would be great appreciated.
-
Changing from an Interface to an AbstractOkay I have this Interface: interface myInterface { public void visible(bool view); } I was implementing the visible method in my other classes like this: visible(bool view) { if(view) { this.Left = -500000; blah blah blah } else { this.left = 0; blah blah blah } } Okay I need to change my interface to an abstract class, so i can just implement the visible method one time in the abstract, but i can't use "this.Left" in the abstract because it doesnt contain a method for "Left". It is probably a simple solution to this but how do I get this.Left, this.dock etc. to be available for use in my abstract class?
-
Grouped Check BoxesLMAO my bad, I'm sorry thanks for the help though sounds like a good solution
-
Grouped Check BoxesWinforms, and i can't use Radion buttons because i am looking for the sticky button look that a check box has.
-
Grouped Check BoxesCan you group together CheckBoxes so only one in a group is checked at one time and if so How?