C++ Problem
#1
Hi Guys,
I have a problem in C++ and I was wondering if any of you had any ideas please.
I have to allow the user to click points on the screen the points join up to form a polygon of any size. The program then needs to store the co-ordinates of the points and prints out a list. It also needs to store the lengths of the lines between the co-ordinates and print them out in a list.
Any thoughts welcome.
Cheers,
Steve
I have a problem in C++ and I was wondering if any of you had any ideas please.
I have to allow the user to click points on the screen the points join up to form a polygon of any size. The program then needs to store the co-ordinates of the points and prints out a list. It also needs to store the lengths of the lines between the co-ordinates and print them out in a list.
Any thoughts welcome.
Cheers,
Steve
#5
Scooby Regular
Join Date: Sep 1999
Location: Bedfordshire
Posts: 4,037
Likes: 0
Received 0 Likes
on
0 Posts
Sub,
what IDE do you use? Ask cos if its BC++B theres a **** load of components for Delphi/BCB and I found something that would do most of what you want in 5 mins flat but no good if your a VC++ man!
Gary
what IDE do you use? Ask cos if its BC++B theres a **** load of components for Delphi/BCB and I found something that would do most of what you want in 5 mins flat but no good if your a VC++ man!
Gary
#6
I had a test at an interview on something like that a few years back.
I can't remember the details, but the answer involved doing something clever with the area under each pair of points and checking if the imaginary line between each pair of points crossed the drawn line.
It was quite complicated and the guy explaining it was a mathematician!
I can't remember the details, but the answer involved doing something clever with the area under each pair of points and checking if the imaginary line between each pair of points crossed the drawn line.
It was quite complicated and the guy explaining it was a mathematician!
#7
MarkO is bang on.
The easiest way is to butcher something like Scribble. Use the mouse coordinates from OnMouseDown (or whatever the event is) normalise them to the client window and store them in an array of Points (either MFC or cut your own). Then the rest is Pythagoras.
If you can't use MFC, however, then you may have difficulties using Scribble.
What's giving the trouble?
The easiest way is to butcher something like Scribble. Use the mouse coordinates from OnMouseDown (or whatever the event is) normalise them to the client window and store them in an array of Points (either MFC or cut your own). Then the rest is Pythagoras.
If you can't use MFC, however, then you may have difficulties using Scribble.
What's giving the trouble?
Trending Topics
#8
Scooby Regular
Join Date: Oct 1998
Location: London
Posts: 4,891
Likes: 0
Received 0 Likes
on
0 Posts
I actually did this in my algorithms course at Uni, but that was over 10 years ago, so I can't remember the name of the "is a point inside a region" algorithm.
However, as usual, a quick and simple web search came across this which seems to be a good and simple way of determining if a point is within a polygonal region.
However, as usual, a quick and simple web search came across this which seems to be a good and simple way of determining if a point is within a polygonal region.
#9
Thanks for all the help guys.
Its for my brothers misses, shes doing C++ at uni and wanted my help, I do VB and C mainly at work, so I didnt know exactly how to help her.
GaryK - she is using Borland C++. I had a quick look at it today and I think I should be able to sort it all out for her know.
Thanks again.
Steve
Its for my brothers misses, shes doing C++ at uni and wanted my help, I do VB and C mainly at work, so I didnt know exactly how to help her.
GaryK - she is using Borland C++. I had a quick look at it today and I think I should be able to sort it all out for her know.
Thanks again.
Steve
Thread
Thread Starter
Forum
Replies
Last Post