473,569 Members | 2,834 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Polygons, Shapes

Whats the easiest way of defining a shape
and knowing if a point is with in it?

parden the crude pseduocode...
i want something like:

Shape1 = p1,p2,p3,p4,p5, p6,p7,p8,p9,p10

pnt = x,y

if (shape1 containes(pnt)) {

}

Anyone know of something like this?

Pete
Jul 19 '05 #1
2 2427
On Wed, 27 Aug 2003 23:04:32 GMT, "Pete" <p_*********@co mcast.net> wrote:
Whats the easiest way of defining a shape
Try using a std::vector for the points.

and knowing if a point is with in it?

parden the crude pseduocode...
i want something like:

Shape1 = p1,p2,p3,p4,p5, p6,p7,p8,p9,p10

pnt = x,y

if (shape1 containes(pnt)) {

}

Anyone know of something like this?


What's the C++ question?

<ot>
E.g. count the number of crossing for a line through the point, or
walk the perimeter of the shape and check the direction to the point.
</ot>
Jul 19 '05 #2
Pete wrote:
Whats the easiest way of defining a shape
and knowing if a point is with in it?

parden the crude pseduocode...
i want something like:

Shape1 = p1,p2,p3,p4,p5, p6,p7,p8,p9,p10

pnt = x,y

if (shape1 containes(pnt)) {

}

Anyone know of something like this?

Pete


This is question 2.03 of the comp.graphics.a lgorithms FAQ.

http://www.exaflop.org/docs/cgafaq/ind.html

-Peter

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2048
by: David | last post by:
i am using the imagepolygon function to create a shape on an image i have, however i want to put more than just one polygon onto this image, i have no idea how to do this. Do i have to call the imageploygon function each time i want to add something to the image? All help is appreciated. Thanks Dave
1
3336
by: smjmitchell | last post by:
Hi All, I am developing a application in VB 6.0. I need to plot a 3D mesh of quadrilateral and triangular polygons. I have this working OK in wireframe. The question I have is what is the easiest way to shade the polygons so that I can render the surface. Each polygon is defined by the coordinates in space of its corners. Initially I would...
6
5156
by: Kristian Frost | last post by:
Hi, I'm trying to add, as you might guess, mouseclick listeners to the shapes I am drawing using the GDI+ commands in a similar sort of way as could be done with the old VB "shapes". Problem is, I'm really not sure of the best way to go about it. I was hoping I could do it directly like the old shape_onclick events, but that doesn't seem to...
0
1320
by: alwayssmiling | last post by:
Hi, Im drawing some shapes on the image surface (i.e when im displaying the image ) with the help of graphics. Since i want to move thsese shapes from one place to other place in the image surface. I want to erase the previous shapes at the previous positions. But how can i erase shapes in the image any ideas. Thank u.
1
2613
by: weberwhennner | last post by:
Hi All, Since two days Ive been trying to draw lines and polygons interactively (using mouse clicks), but all ive found is some libraries that draw shapes using predefined cooredinates. Ive also been trying to search for books on amazon that would help me learn more about this, but looks like I'm not using the right search terms... Any...
6
1372
by: Number 11950 - GPEMC! Replace number with 11950 | last post by:
Are polygonal buttons or perhaps polygons with tooltips and and click events available in VS8 or is it too early yet? Thanks in advance... -- Timothy Casey GPEMC! >11950 is the number@fieldcraft.com.au 2email Terms & conditions apply. See www.fieldcraft.biz/GPEMC Discover valid interoperable web menus, IE security, TSR Control, & the...
8
2714
by: Hypnotik | last post by:
Hey everyone. I'm writing a program which allows the user to enter information about 2 shapes, either a square, triangle, or rectangle, then 'adds' the shaps together. The resulting shape is a polygon. I understand how this is done, just not sure about the code. I need to overload the + operator to add the shapes. Also I know that I need to make a...
0
2190
by: weird0 | last post by:
i have successfully emebedded visio drawing tool in my application. Infinite number of shapes can be added to the drawing. How can i write double click event handler for the the shapes added to my diagram? Other than that, how can i loop through all the shapes in the diagram, to get their information? Visio Guy Amir Diwan
4
1870
by: Sunny | last post by:
Hi I have a div called shape on my page. When I try to get its length using javascript in IE, everything works fine. But When I try it in Firefox it has element has no properties. Here is the code that I am using. var shps = document.getElementsByTagName("shape"); lastshp = shps.length
1
4990
by: nttamdn | last post by:
Anyone help me please. I want anytime mousemove to one polygon, it's opacity becomes 0.3, and mouseout polygon, i'ts opacity return to 0 again. I means mousemove to show the polygon and hiding it when mouseout. I parsed points from XML and then add polygons to the map. But my problem that I can't addListener (mousemove) and (mouseout) for each...
0
7693
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7917
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.