|
|
Hi!
Don't even know how to put this! So just try to guess what I mean!
In VC++ you can include this line exit(100); etc. And force the program to exit to OS with VC++ reporting, in the EXIT window: programm....exited with code (100) or something like that.
My question is this: Is there a way to tell VC++ to report 100 as say wrong argument for myFuntion(int); instead of just reporting error number?
I only want to know how to make VC report the error with description not the program itself (ie. via a dialog window).
--------------------------------------------------------
DEBUGING IS A BITCH :smiley whith brains blown out:
--------------------------------------------------------
|
|
|
|
|
CreepingFeature wrote:
Is there a way to tell VC++ to report 100 as say wrong argument for myFuntion(int); instead of just reporting error number
No, not a far as I know of.
These so called return code is some sort of the lowest common demnominator of error reporting. They are designed to work on every OS.
All you know is that '0' means 'No Error'. Other codes have to be documented (on Unix, man pages do this, but windows is deficient in this way, too) to be used in eg. batch scripts.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hello everybody,
I have a big problem, I'm looking for a function on C++, and I can't find it (I'm depressed...I nearly killed my self yesterday...)
Well, here's my problem...I'm looking for a function that will give me the smalest box that contains a set of points...
To be clear, I have a set of point in 3D....and I want the smallest box that contains all the points....
The functiuon has to be the more simple possible....because I will have to change some things...
Please help me PLEASE
Thanks in advance...
|
|
|
|
|
I don't think such a function exists... but why don't you write it yourself ??
You just have to search the minimum and maximum of all the x coordinates and the minimum and maximum of all the y coordinates. This will give you the 4 boundaries of your box. (Of course, you can apply this for 3d so search also the min & max of the z coordinates).
Hope this helps
|
|
|
|
|
You just have to....
thanks cedric, but I need this function during the next 24 hours...so I'm a little bit in a hurry....
|
|
|
|
|
god, it takes ONLY 5 minutes to write ...
one big loop and some comparisons ....
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
typedef struct<br />
{<br />
float X;<br />
float Y;<br />
float Z;<br />
} 3DPOINT;<br />
<br />
void Boundary(3DPoint* pPointsArray, int Count, int &XLow, int &XHigh, int &YLow, int &YHigh, int &ZLow, int &ZHigh)<br />
{<br />
XLow = XHigh = pPointsArray[0].X;<br />
YLow = YHigh = pPointsArray[0].Y;<br />
ZLow = ZHigh = pPointsArray[0].Z;<br />
<br />
for (int i=0;i<Count;i++)<br />
{<br />
if (pPointsArray[i].X < XLow)<br />
XLow = pPointsArray[i].X;<br />
if (pPointsArray[i].X > XHigh)<br />
XHigh = pPointsArray[i].X;<br />
<br />
}<br />
<br />
}
Anonymous wrote:
thanks cedric, but I need this function during the next 24 hours...so I'm a little bit in a hurry....
I don't think this takes sooooooooooo much time to do something like that
|
|
|
|
|
ok i see now what you wanted to do....thanks a lot cedric...but I think that your technic is not optimal...
With your technique the bounding box will change if you work in an another reference, do you understand ???
I want a function that will minimize the volume and enclosing the different points .....
|
|
|
|
|
it will never be really optimal, unless the points are already partially sorted.
reference ? what do you mean ? orientation and POV ?
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
the reference that you use for the coordinates of your points....
|
|
|
|
|
Anonymous wrote:
With your technique the bounding box will change if you work in an another reference, do you understand ???
Errrrr... Nope, not really . If you change your reference, just modify the boundings so this will follow your new reference...
Anonymous wrote:
I want a function that will minimize the volume and enclosing the different points .....
But that's what it's doing: including ALL the points with the MINIMUM volume. Or did you want something else ?? Then ask a more specific question because for me that is exactly what you asked for... If you want to include all the points this is really the only solution to have the minimum volume !!
|
|
|
|
|
I'm not sure that you alwalys obtain the minimum volume....just try to imagine with a specific example...with points which are the corners of a rotate box...if you try to enclose the 8 corners with your technic, you don't obtain the same box...
|
|
|
|
|
if your points coordinates change, you need to update the bounding box.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Ok I understand now better what you want ! Sorry for my misunderstanding .
Ok, but your box has to be a cube, or the faces can be rectangles (don't know how to say this in english ), or can it be a complex polygon (in 3D)?
I think this is a really complex problem . I don't have the solution but perhaps try something like this: (here is the explanation in 2D, this will be more complex in 3D) choose 2 points and join them by a line. Now for each other point try to draw a perpedicular to this line that join the point. From all these lines, just keep the two that will 'enclose' the rest of the points. And now try to find the last line that will close your rectangle..
You'll have to do this for every couple of points and calculate the resulting area of each rectangle and then keep the minimum one... Ufff, already very complex in 2D, in 3D it will be much more complex !!
I don't know this is just a suggestion...
|
|
|
|
|
If you are really getting so depressed with programming then perhaps a new line of work would be a better solution. Life is too precious
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Perhaps this may help
http://citeseer.ist.psu.edu/context/342141/0[^]
or a look on Google with "Finding minimal enclosing boxes" as the subject.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hello Everybody here is my problem...
-> inside header file:
...
CHexEdit HexEdit;
...
-> inside cpp file: i read hex data from a file and add it to HexEdit
...
HexEdit.SetData(arr, 0);
...
->up to now i have no problem. I can view or edit the hex code and I can save it to another file without any problem.
---> my question is how can i find hex characters inside this HexEdit. for example i write "EE" to an edit box and a find button sets HexEdit scroll to first "EE" than second etc. or highlight the first "EE"...
---->İs there a CHexEdit method to find that character in data(like string.find(string)), or something else???
thanks...
BYE&SMILE EvrenPredator;)
|
|
|
|
|
Question, what is CHexEdit?
Is it a control you created or a third party control that you bought?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
evrenpredator wrote:
CHexEdit HexEdit;
Are you referring to this class? If so, the author's profile is here. Try sending him an e-mail to see if the class will do what you require.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes exactly that class, I have seen that before it is very usefull and it gives me an idea for doing it in another way and solve my problem. but still I look for getting the data in Hex Edit.
Previous question: CHexEdit is the activeX control on MFC Dialog Based application. (by left click dialog box than insert activeX control than hexEdit Control)
thanks for your replies...
|
|
|
|
|
Nothing remotely related to CHexEdit shows up in that list for me.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Actually i want my programm to collect files in special directory, for example "c:\MyProgramm\Data", and my exe is in "c:\MyProgramm". But if someone canges the full path, where my programm placed?? For example:"c:\Program Files\MyProgramm\\"??? How to alway know where is the Application?
|
|
|
|
|
CString strApplicationDir;
char szPath[_MAX_PATH];
GetModuleFileName(NULL, szPath, _MAX_PATH);
strApplicationDir = szPath;
int nPos = strApplicationDir.ReverseFind('\\');
if (nPos != -1)
strApplicationDir = strApplicationDir.Left(nPos);
Michael
CP Blog [^]
|
|
|
|
|