|
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 [^]
|
|
|
|
|
|
Hi All,
How can I write to a file with random access, ie- be able to change data at any point in the file, not just append new data at the end?
I'm sure this must be possible, if you could give me a starter point / keyword i'm sure i'll be able to find the rest myself!
I don't want to "simulate" this by read/modify/write the whole file, because the files i need to modify will be in the 100's of megabytes!.
Thanks
Jon
#include <beer.h>
|
|
|
|
|
This may do what you want (http://www.codeproject.com/system/cfile64.asp)
In particular look at the Seek() function.
If you're not interested in files this big, have a look at the CFile class in MFC and in particular the Seek() function.
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
OK, I've now figured this out.
Is there a way to insert data into the middle of a file? rather than overwrite it?
Thanks
#include <beer.h>
|
|
|
|
|
Not easily I'm afraid.
You need to get a copy of the data from the insertion point to the end of the file, insert your new data and then put back the rest of the file.
store your internet favourites online - www.my-faves.co.uk
|
|
|
|
|
Hi,
I'm writing a dialog by MFC.
I have several tabs, and every tab has some control items on it. I creat classes for every tab.
I want to send out status thru RS-232, such as when the user click one spin, and the spin value will be sent out thru RS-232.
My problem is I've got the tab class and a serial class ready. But how to confige a serial port that can be used by "all" tabs.
If I create the port in one tab's cpp, other tabs will not be able to use the port, of course.
However, it doesn't work if I configure a port in the project's main cpp, either.
Forthermore, if I call the functions in the CSerailPort class, like:
CSerialPort::Openport("com4");
The compiler says another error: illegal call of non-static member function.
Thanx your help.
Chauteen
|
|
|
|
|
Buddy,
if you are comfortable with pointer,then declare the pointer in base of CSerialPort like this is you class.
sorry i didn't work on tab control but i worked on property pages.i think you taleneted enough to understand this.
here is little solution,
you base class
CSerialPort *BasePort;
in your tabbed dialog classes as there can be many
CSerialPort *DerPort;
inbase class contructor or initdialog
BasePort=new CSerialPort;
//
function regrading insilization of port
///
now you are creating tab contral,
just pass the pointer to every derived tab classes
like this.
Let One of tab class is Ctab1;
now,
Ctab1.DerPort=this->BasePort;
andthis way you can access teh serial port in nay class.
ps,don't forget to delete the pointer before closing the application
-----------------------------
"I Think It will Work"
Formerly Known As "Alok The Programmer" at CP
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Creating library ReleaseMinSize/ezrename.lib and object ReleaseMinSize/ezrename.exp
LIBCMT.lib(wwincrt0.obj) : error LNK2001: unresolved external symbol _wWinMain@16
I get this error message when I build in anything other than debug...it's an ATL COM object.
I figure it's a general C++ type question so I posted in here...
How to I fix this 'particular' linker error?
My local MSDN docs say check out MSKB article: Q125750
But it appears this is for dot net...not vc6 cuz I tried it and didn't get it to work...?
WTF...
TIA
How do I print my voice mail?
|
|
|
|
|
PRB: Error LNK2001: '_WinMain@16': Unresolved External Symbol
Si applica a
This article was previously published under Q125750
NOTE: Microsoft Visual C++ NET (2002) supported both the managed code model that is provided by the .NET Framework and the unmanaged native Windows code model. The information in this article applies to unmanaged Visual C++ code only.
SYMPTOMS
The linker generates the following error, when you build an MFC application with UNICODE support using the Microsoft products listed at the beginning of this article:
msvcrt.lib(crtexew.obj) : error LNK2001: unresolved external
symbol "_WinMain@16"
Visual C++ .NET:
error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
fatal error LNK1120: 1 unresolved externals
CAUSE
MFC UNICODE applications use wWinMainCRTStartup as the entry point.
RESOLUTION
In the Output category of the Link tab in the Project Settings dialog box, set the Entry Point Symbol to wWinMainCRTStartup.
For Visual C++ .NET: In the Advanced category of the Linker folder in the Project Properties dialog box, set the Entry Point to wWinMainCRTStartup.
STATUS
This behavior is by design.
REFERENCES
The above information is documented in Books Online under this structure: - C/C++
- Programming Techniques
- Chapter 12 Developing for International Markets
- Support for Unicode
- Unicode Programming: Summary
This reference also lists the additional steps that you need to consider to take advantage of the MFC and C run-time support for Unicode.
|
|
|
|
|
I want to remove Close button "X" from the right corner of Dialog, but still want to keep the system menu at the left corner. Unchecking the system menu option from dialog properties also removes the menu at left.
Plz Help.
kriaz.
|
|
|
|
|
If you can't figure out that it's an non-trivial task to "remove" the close button entirely, your probably best just giving up.
Check CS_NOCLOSE in the WNDCLASS structure...I think that's as close as you'll get without some serious hacking (probably have to draw your own caption bar, non-client area, etc...lots of work!!!
p.s-I personally can't say I appreciate you announcing the fact he wasn't able to give you the answer you wanted. If you did that to me...i'd be choked!!!
How do I print my voice mail?
|
|
|
|
|
well, you posted your message on friday ... kind of a bad timing ...
and I don't know either.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Bad form. David is a very knowledgable man. He has helped many people on this forum. And yes I include myself in the list.
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)
|
|
|
|