|
|
I knew I should have listened more during maths at school! Thanks for those links, with them and the next comment, I think I have worked it all out. Appreciate the help.
|
|
|
|
|
wormer90 wrote: ' -1 IF THE POINT IS OUTSIDE OF THE POLYGON,
The above is wrong: it is a misinterpretation of the C original routine
(please read carefully the page linked in your post).
The following VBScript code (sorry no VB6 available here) works for me (though I didn't test it extensively) returning true whenever the point is inside the polygon.
dim vertx(6), verty(6)
vertx(0) = 2
verty(0) = 2
vertx(1) = 5
verty(1) = 1
vertx(2) = 8
verty(2) = 2
vertx(3) = 7
verty(3) = 4
vertx(4) = 8
verty(4) = 6
vertx(5) = 1
verty(5) = 7
testx = 3
testy = 3
nvert = 6
c = false
i = 0
j = nvert - 1
Do
if (verty(i) > testy) <> (verty(j) > testy) Then
if (testx < (vertx(j)-vertx(i)) * (testy-verty(i)) / (verty(j)-verty(i)) + vertx(i)) then
c = Not c
end if
end if
j = i
i = i + 1
Loop while i < nvert
MsgBox "result = " & c
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks very much for this, I think I expected the C code to perform the same as the Fortran code, but it obviously does not. Thats ok, its sufficient for what I need it for.
And thanks for the VBS code, its helped. I asked another developer here and he said that 'c = !c' in C (the language..) is not the same as 'c = Not c' in VB - it should be 'c = 1 - c' to get the 0,1 result. But I like your approach and making it boolean, I think my head was stuck too much in the detail, and needed the 2nd, detatched opinion. Ive been buried in trying to understand GPS and all the maths required for the last week, and it was starting to do my head in!
Really appreciate the help, thanks a lot!
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
ritz1234 wrote: Can we write program that runs on MAC OS using c++?
Yes, but depending on your need, you will probably need to use a specialized library for the UI.
Native C++ is cross-platform, but there are a lot of things that are not cross-platform in addition to the basic C++ language (win32 API, MFC, ...).
If you want to develop cross-platform code with a user interface, I suggest you take a look at wxWidgets[^].
|
|
|
|
|
i think you looked a bit too far. the question wasn't about making cross plateform programs, but only "is it possible to make a C++ program for MAC OS"... or it was badly asked
wxWidget is good though
|
|
|
|
|
toxcct wrote: i think you looked a bit too far.
Yeah I know but I didn't want to only reply 'yes', and as I started to talk about it I could't stop
|
|
|
|
|
Cedric Moonen wrote: I started to talk about it I could't stop
I don't know about Italy or Belgium, but we call that a verbal diarrhea in Mumbai.
|
|
|
|
|
Rajesh R Subramanian wrote: I don't know about Italy or Belgium
Oh, we simply call that a woman
*Ducks and hides under cover*
|
|
|
|
|
|
regarding the strict C++ programming language, nothing avoids you to code for MAC OS, Windows, Linux/Unix, Symbian or whatever else Operating System.
The only constrain is the compiler.
as long as you can find a compiler (of a Cross-Compiler) for the OS you want to target, then go for it
|
|
|
|
|
ritz1234 wrote: Can we write program that runs on MAC OS using c++?
Of course.
BTW: Why don't you try Google to find out relavant info? For instance, a quick search gave me this page [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
YES,
Xcode is Apple's premiere development environment for Mac OS X
its not automactically included in all Mac OS , to check if its installed goto Terminal application and enter g++ , if it replies application not found goto http://developer.apple.com
Vikas Amin
My First Article on CP" Virtual Serail Port "[^]
modified on Thursday, July 24, 2008 5:33 PM
|
|
|
|
|
I am calling void SearchDialog::OnSearchBtn() from a thread. The error flashes @ statement UpdateData(TRUE);
The instruction at "0x00000000" referenced memory at "0x00000000". The memory could not be "read".
Please advice
class SeachDialog
{
....
....
protected:
// Generated message map functions
//{{AFX_MSG(AssetSearchDialog)
static afx_msg void OnSearchBtn();
....
static UINT StartWorkingThread (LPVOID param);
....
typedef struct THREADSTRUCT //structure for passing to the controlling function
{
SearchDialog* _this;
} THREADSTRUCT;
.....
....
}
UINT SearchDialog::StartWorkingThread (LPVOID param)
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
ts->_this->OnSearchBtn();
...
...
}
void SearchDialog::OnSearchBtn()
{
UpdateData(TRUE); // RUN TIME ERROR...
..
}
|
|
|
|
|
You can't calls things like UpdateData from within a thread. MFC classes should not be shared across threads and you shouldn't access anything on the UI from your thread.
Instead, you should (if I understood what you are trying to do) start the thread when the user presses the 'search' button and pass all the relevant information to the thread, so that it doesn't need to query it from the UI.
|
|
|
|
|
More specifically, the dialog box window likely hasn't been initialized at the time you called OnSearchBtn().
In addition to the previous solution, you could send a user message to the dialog box from the thread. I'm doing that in an application I'm working on right now.
In OnSearchBtn(), you should wrap the function contents in if (GetSafeHwnd()) {} to ensure it's only called when the window is valid.
(As a small note; to prevent problems in my current application I don't start the worker thread until the dialog box has been created. I do this by setting a short timer in OnInitDialog().)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hello,
i wrote a sample code using MDI. I want to use dialog as mainwindow child.(CMainframe child). But when i create dialog and call it. it is not displayed as child dialog. if i change dialog properties to child then i am not able to move child dialog.
Jalsa
|
|
|
|
|
jalsa G wrote: I want to use dialog as mainwindow child
Why don't you use a CFormView [^] instead?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hi
I want to create a dialog whose upper left cornor is rounded and right lower cornor is Rounded and other Cornor is Rectangle . I do not want to create this with the help of Image(bitmap) .
So pls help me and I am very thank fulto you if you provide any link or application Example .
Thanks in advance.
dabara
|
|
|
|
|
What about using CP 's article search engine [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i already Search in Codeproject But I can not get any useful artical which is fullfil my Requirment . So i write on the forum.
dabara
|
|
|
|
|
pls check which type of Dialog Cornor I want .
http://www.codeguru.com/forum/showthread.php?p=1746588#post1746588
dabara
|
|
|
|
|
Dabara wrote: which type of Dialog Cornor I want .
http://www.codeguru.com/forum/showthread.php?p=1746588#post1746588
You don't have to use a bitmap. Paint the background of the
window however you want to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|