|
Yes. I have the coordinates of the polygon and I need to be able to randomly select a given number of points from within the polygon. The aim is to draw dots in the polygon randomly, something to show low and high density polygons.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Two ways you could do this:
1. Generate a mask bitmap. Make it black and draw a filled polygon in white. Then for each point you generate, check if that pixel in the mask is white
2. To find out if a point is inside the polygon, use the ratio of x2-x1/y2-y1 to find out the slope of each line. Then use that ratio to figure out if that point is inside that line, or not.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hello Christian,
Thanks for the suggestions. Currently, I am doing this
1. Get the bounding box of the polygon and use it to generate the random points.
2. Create a region CRgn out of the polygon and test if the point lies in the region PtInRegion, if not generate another till I get the required number of points.
The application, however, requires a lot of speed and it deals with many polygons. I will try your suggestions too to see which is faster and less memory consuming.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
Look at this link. Point inside a polygon is BIG deal to 3d/2d game programmers.
Point Inside Polygon
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
Thanks, it is yet another step closer to the goal.
Best regards,
Paul.
Paul Selormey, Bsc (Elect Eng), MSc (Mobile Communication) is currently Windows open source developer in Japan, and open for programming contract anywhere!
|
|
|
|
|
I suspect the mask will be fastest. If you make the mask a DIBSection it will be fastest of all, you'll have access to the underlying bits without having to call GetPixel in a DC.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
hello All,
I want to show the SaveDialog box in a button click .How is it possible??
SSN
|
|
|
|
|
Check out GetSaveFileName()
--Mike--
My really out-of-date homepage
"Why does anyone have a web page? Too much free time... not enough friends... justifying owning a computer." -- Noel Crane on Felicity
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
i need to develop a code which takes in a image .tiff file and reads the certain contains of the imagage and stores them in the .csv format file....can any one help me in how to achieve this.Actually this image is a bank cheque that is scanned and stored as .tiff file and need to read the amount, payable to and cheque number from the cheque image can anu help me out regarding this i will be much thankful to u all
waiting for reply
thanks in advance
BSR
|
|
|
|
|
How to get the path of the shell (Explorer)?
For example:
I open my C:\ using Explorer, i want get the from the Explorer Windows Handle...
|
|
|
|
|
I use a WndProc hook in my system...
use this WndProc hook, i have painted a button in the caption of every program. when press this button, i want it pop up a menu( the owenr draw menu), i failed. It is just effective in Explorer program, not effective in Visual Studio program, the menu item is disable...
why?
|
|
|
|
|
When you're in the leftmost pane of the Visual C++ IDE, with the ClassWizard, FileView, ResourceView... is there a keyboard shortcut to switch between the three? I'm really big on keyboardability but have never found a way to switch between these tabs without wasting my time grabbing the mouse.
Thanks.
-Jason
nirgle.bitdevil.com
|
|
|
|
|
|
|
Hey Guys
I was wondering if someone could tell me the function that allows you to browse through the available drives and folders on yourcomputer and select which one to use.
Cheers
Peter
|
|
|
|
|
SHBrowseForFolder()
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Merry Christmas Everyone
I hope someone can help me. I was wondering if there is an easy way to draw a line where the pixels alternate colour, I want to draw a grid over a bitmap the same way that the resource editor does, with alternating dark and light gray pixels. If I create a pen with the PS_DOT style, the dots and spaces are 4 pixels in length, and that looks like crap. Right now I am using the SetROP2() function with the R2_NOT flag. It looks good if the bitmap has light colours, but not if the bitmap has dark colours. I guess I could draw the lines one pixel at a time, but I am hoping there is an easier way. If any one knows, I would appreciate hearing from you. Thanks.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
You can create a pattern brush and then use that one pixel wide to generate a line.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Works great, thanks for the idea.
---
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Hi.
Conventionally speaking, do you declare and initialize variables at the beginning of a function or loop or right before usage.
For example:
int main()
{
char temp;
cin >> temp;
cout << "1234... & " << temp;
cin >> temp;
cout << temp;
int x;
cin >> x;
cout << temp << " & " << x;
return 0;
}
The arbitrary code above depicts declaration of variables right before usage (int x).
Which way is most convention is arguably better?
Thanks,
Kuphryn
|
|
|
|
|
|
Thanks!
As of today, I have begun to declare variable when:
1) there is something to initialize it with
int x = ...functure return, something added/subtract, etc, to other variables
2) right before its usage
int x = 3;
cout << x;
The only time I declare a variable at the top:
int x = 0;
is when it will be referenced to.
function(int &aboveX)
cout << aboveX;
So aboveX is a reference to x.
I began learning and practicing C++ about four months ago. I find something really interesting. I find that when you first learn C++ in college and reading beginner C++ books, the professor and author typically recommend declaring variables right at the top. They make it like it is imperative that we do that or the program may not work. Now, I feel that the programmer is in control of the program and that he/she can declare variables wherever is appropriate. As I mentioned, I feel it is much easier to recognize variable when the program declare them accord to the examples above.
Kuphryn
|
|
|
|
|
He folks!
I created a dialog based application and made it to a service. Not a big deal.
The service has a icon in the system tray.
If you click on the item, the dialog window pops up, so that the user can see some information about the current status of the service.
In that dialog window, i created a property sheet with two property pages in it. As fare i do NOT create that property stuff, everything works fine, but with the property stuff AND when the user loggs out, i always got a runtime error!!!!
WHY???
By the way, when i just start the service and then terminate it again, by the windows nt control manager, everything goes well, also!!??
Thanx in advance
Normen
|
|
|
|
|
He!
It's me again!
So far i found out, that the problem is neither placed in the property sheet
nor in the property pages BUT in the CListCtl, which is placed in one of my
property pages!!!!
When i take the CListCtrl out of my page, everything works fine.
So does anyone know what i shall do with that list control???
Greetings
Normen
|
|
|
|
|
- Thanks for the pals that had helped me before. Also say 'Good Luck' to the strangers.
- Hope my pals can help me next year, like before.
- Best regards,
BigMouth
|
|
|
|