|
do u mean a maths operation cannot deal with MFC???
|
|
|
|
|
There are no specific MFC classes that deal with the maths operations.
That doesn't mean you cannot use MFC in an application that uses MFC to produce the GUI for such an application.
You could try reading Sedgwick's C++ Algorithms books, or any work on computational geometry in C or C++, which might help.
Are you looking for code that will help to draw them, or calculate them, for example?
Aside:
There are a lot of people posting on CP whose idea of a good question is:
I have to do X. Please send me code.
There are several things wrong with this approach. Firstly, getting other people to do work for you isn't as helpful when learning to program. Sure, it's good to look at other people's code to see how they approached the same (or a similar) problem.
Secondly, most people here who answer posts are not employed by CP, and provide help for free, because they are generous souls, so antagonising them doesn't get you anywhere. If someone complains about my posts, for instance, I tend to ignore further posts and questions from them. Firm, but fair, in my opinion; if you cannot be bothered to retain that thin veneer of politeness towards me, why should I care what happens to you?
Thirdly, and probably most importantly, by attempting any problem yourself, you should be learning more about it; by highlighting the areas that you are having difficulty with, rather than refusing to attempt it in the first place, you are much more likely to get positive responses, which will probably help you clear up any confusion or difficulty.
Steve S
Developer for hire
|
|
|
|
|
Damn. The site lost my post, and now you beat me to it.
Steve S wrote: There are no specific MFC classes that deal with the maths operations.
*grin* I was trying to bring the OP around to that conclusion, assuming he/she has any idea what MFC is at all.
And I have to admit, you gave a better answer than I did.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
*sigh* What is MFC for ? What does it do ? What does it offer ? How would you use MFC to write maths code ?
The reason you're getting the response you are is that
1 - you're asking for someting complex
2 - you show no sign of understanding basic things and
3 - it seems probable that you've asked this without trying to do any research of your own, which means that
4 - you're hoping we will do your homework or paid work for you, for free.
We're happy to help. Helping means you do something, too. Do you know what MFC is/does ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
actually, i did two projects using C++ n MFC.
both require maths algo in it.
but i have no idea how to start my 3rd project using triangulation.
u got me wrong..i never ask people to do my homework for me..
i just ask for the idea..
maybe the idea can help me to start my program. thats it!
thanx anyway..
|
|
|
|
|
OK, perhaps you've just not made yourself clear. Either way, as has been said, MFC has nothing to do with it, standard C++ has a maths library, which you would use, and which will work in MFC.
Your first step would be to google and get info on the algorithm you want to implement. Your second step would be to write some code, based on this information. Third step is to post here when you get stuck.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Your answer like an transparent algorithm step by step
|
|
|
|
|
Do you have any code or idea?
|
|
|
|
|
Hi,
Iam trying to implement IMultiLanguage::ConverString() API.Can anyone provide a small chunk of code which implements this function to convert from one source codepage to another codepage ?
Thanks in advance.
Swetha.
|
|
|
|
|
I'm trying to read the pixels of a monochrome bitmap (1-bit per pixel). I am so close to getting it right but I just cannot produce the same results as GetPixel() . I use GetBitmapBits() to read the bits into a byte array, then loop through attemptng to read a bit at a time. My output is somewhat 'blocky'.
for (y=0;y<height;y++)
{
for (x=0;x<width;x++)
{
ULONG col = GetPixel(hBuf,x,y);
if (col)
SetPixel(hdc,width+x,y,RGB(0,0,255));
int offset = y * b.bmWidthBytes + x / 8;
BYTE pixel = *(BYTE *)(lpBits + offset) >> x%7;
if ((pixel & 0x01) == 0x01)
SetPixel(hdc,width+width+x,y,RGB(0,0,255));
}
}
This is maybe my 15th version of the loop, I'm sure I am reading it bit by bit, I can't work out whats going wrong.
|
|
|
|
|
Can you say how u load that image ?
If u can Dream... U can do it
|
|
|
|
|
I don't load the image, I create it at runtime. I don't see how loading the image has anything to do with parsing an array of bits.
|
|
|
|
|
Not sure if this makes a difference for monochrome bitmaps, but try using GetDIBits() instead.
Another thing I noticed is x%7, which I don't think can be correct since that means you're shifting 0 to 6 bits to the right, when I think it should be 0 to 7 bits. Try it with x%8. I also would have thought that the leftmost bit would be the first bit.
My current guess is (not sure though, since you mentioned you were close)
BYTE pixel = *(BYTE *)(lpBits + offset) >> (7 - x%8);
|
|
|
|
|
The x%7 was a result of me playing with the variables out of frustration, I was adjusting them hoping to get a clearer picture. Your suggestion of >> (7 - x%8); is what fixed it, that and a slight mistake I made in calculating the array size.
Thankyou )
|
|
|
|
|
Hello all
I have generated a WIN32 console app, and created a resource , and a string table which has one string. Then I copied same string to German and put the same string id there and put a German text.
After that I have done the following code
#include "stdafx.h"
#include <windows.h>
#include <winnt.h>
#include "resource.h"
int main(int argc, char* argv[])
{
TCHAR pszTest[256];
int m_lang = GetProfileInt("General","Language",0);
HMODULE hMod = GetModuleHandle(NULL);
if (m_lang == 0) {
// switch language to english
::SetThreadLocale(MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_DEFAULT),SORT_DEFAULT));
}
else {
// switch language to german
::SetThreadLocale(MAKELCID(MAKELANGID(LANG_GERMAN,SUBLANG_DEFAULT),SORT_DEFAULT));
}
LoadString(hMod,IDS_MSG, pszTest, sizeof(pszTest));
DWORD dw = GetLastError();
MessageBox(NULL,pszTest,"Message",MB_OK);
return 0;
}
I get the error 1812. Can you please help me to solve this?
Basically I am trying to write a WIN32 application to support both English and German. I dont know whether I have to make this WIN32 app a unicode application !!!
And also, it would be nice if you can gimme a link which helps me to generate a multilingual WIN32 app without MFC.
Thank you
Best Regards,
|
|
|
|
|
I vaguely recalled this had to so with getting the wrong section in the resource file. I found this:
http://www.microsoft.com/globaldev/handson/dev/muiapp.mspx[^]
(I do know you don't need to use unicode since English and German use the same code page.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Why not call GetThreadLocale() instead of reading an obsolete ini file.
|
|
|
|
|
Because the user may want to use German even though otherwise running in the English (or any non-German) locale.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
How does GetThreadLocale() prevent you from later setting the locale hence enabling you to load language resources?
|
|
|
|
|
Because he has to somehow set it first. By definition, GetThreadLocale() get's the user's default locale. If the user want to set the program locale separately, he needs to somehow obtain/remember the user's intent. (He may also be simply wanting to test various languages without changing the user's locale.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi all
Currently i am doing an 3d Graphics application , which allows to calculate the center of gravity of an object. The user can control the foreces upon the object. (stuffs like that)..
Here is my problem
-------------------
My application using perspective projection. So While creating an object (for Ex: consider a rectangle) using mouse , the objects is not correctly positoned with mouse cursor. ie when the user click and drag in the window , the object size is different than what he/she just dragged.
I am using 45 degree the angle of view and depth is from 1 to 500
Any !deas ? please give it to me
warm regards
krishnan
If u can Dream... U can do it
|
|
|
|
|
Not 100% sure, but I think you can use gluProject/gluUnProject:
double modelMatrix[16];<br />
double projMatrix[16];<br />
int viewPort[4];<br />
<br />
glGetDoublev(GL_MODELVIEW_MATRIX, modelMatrix);<br />
glGetDoublev(GL_PROJECTION_MATRIX, projMatrix);<br />
glGetIntegerv(GL_VIEWPORT, viewPort);<br />
<br />
double x, y, z;<br />
<br />
gluUnProject(viewPort[0] + mousex, viewPort[1] + mousey, 0.0f, modelMatrix, projMatrix, viewPort, &x, &y, &z);<br />
Might have to play around with the Y coordinate, it may be inverted.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Thanks for the reply & code
One more thing to clarify ( currently i am thinking about it). Pls go through this.
i think you know the function gluPersPective(...,near,Far);
For a perspective projection the coordiantes are normalised. ie (-1,0) , (1,0)is equal to left to right through the Orgin .. is it ?
I want to know the units of this near and Far parameters ?
is that also normalised coordinates ?
Thanks in advance
krishnan
If u can Dream... U can do it
|
|
|
|
|
krishnadevank wrote: For a perspective projection the coordiantes are normalised. ie (-1,0) , (1,0)is equal to left to right through the Orgin .. is it ?
Yes, if your glScale is setup normally. But because of perspective, (-1, 0, 0)- (1, 0, 0) will not visually equal (0, 0, 1)-(0, 0, -1).
krishnadevank wrote: I want to know the units of this near and Far parameters ?
is that also normalised coordinates ?
OpenGL is inherently unit-less - you define what 1 means (i.e. it could be an inch, foot, meter, or an A.U.)
The near and far planes, have to do with the z-buffer, which is non-linear. Objects up close have more precision.
Google on gluPerspective, z-fighting and the depth buffer for more info. Here's some info (not a very pretty site): http://www.sjbaker.org/steve/omniv/love_your_z_buffer.html[^] (My old computer died, otherwise I'd provide you with a better link ).
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Once again Thanks
Suppose i would setup the my projection with 45 as fov and near = 1 and far = 500.
According to my knowledge the default eye location is at Orgin and looking towards in to the screen.
so if i drawn a polygon/rectangle like this (Covering the entire screen. ) , it maynot be visible.
glBegin(GL_POLYGON);
glVertex3f(-1,1,0);
glVertex3f(1,1,0);
glVertex3f(1,-1,0);
glVertex3f(-1,-1,0);
glEnds();
For making this visible(Convering the entire screen ) how much exact translation i want to do in Z direction . ?
Here i am confused with the parameters of gluPersPective function.
What you thinks ?
If u can Dream... U can do it
|
|
|
|
|