9

According to the definition of Polygon, If a Poly-line's first and last points are connected then it is called Polygon. See the image below. I have P1, .... P5 Polyline. If I draw a line from P5 to P1 then it will be called polygon or not? I am confused here.

A series of points (P1 to P5) arranged in a line

  • 7
    That's not actually a line; that's a line segment. A line segment can be a (degenerate) polygon, a line can't. For a bit more weirdness, this line segment is also the convex hull of the five points. It is also an ellipse. – Martin Sojka Aug 15 '12 at 07:37
  • 1
    Isn't this more suited for Math SE? – jcora Aug 15 '12 at 13:31
  • Imagine that this started off as a pentagon, and was rotated and skewed so that all of the vertices wound up appearing colinear in your view plane. It would still be a pentagon. – 3Dave Aug 15 '12 at 13:35
  • Note, that Math is made up by people. People create theories and definitions, and then they prove theorems inside the theory. You can define polygon as you wish, there is no "absolute truth" about what is and what is not some thing (in Math). – Ivan Kuckir Jan 29 '13 at 21:38
  • 1
    I'm voting to close this question as off-topic because it is not about game development. – Philipp Mar 15 '18 at 18:39

5 Answers5

7

Technically? Yes. It's no different to, say, a polygon with the shape of a D with 5 points viewed edge-on.

A polygon is just a closed shape which has 3 or more vertices and edges. A shape with only two vertices is just a line. Meanwhile a shape with 3 vertices and only 2 edges cannot be a closed shape: most libraries would just join the first and last vertices and make it a closed shape then fill it in; otherwise it's just a series of lines!

As far as your graphics library is concerned, yes it's probably a polygon, but that depends on the library.

doppelgreener
  • 7,184
  • 7
  • 42
  • 68
0

more sides there are in a polygon the angle is larger, nearing 180 deg. a Googolgon ( a polygon with 10 to the power 100 sides) has an angle of ~180 degrees.

so.. if you keep drawing a straight line, with infinite number of sides, this line will meet the starting point at infinity, right?

I am not a math guy, was trying to teach my 9yr old about a plygon and started reading. Am I wrong?

Indika
  • 1
  • The question is not about an endless line (ray), but about a line of limited length (segment). – Kromster Nov 16 '12 at 06:29
  • 1
    @Indika Are you trying to answer the original question or ask a whole new one? GameDev.SE doesn't work like a forum with individual posts: there is a question and you respond to it with an answer. That said: there's no guarantee those lines will meet. If you want some resources for learning maths, I suggest you look through Khan Academy - it's free (as in Wikipedia, because they can afford it) and it covers the entire American public school curriculum with some exceptional lessons (the guy is incredibly good at explaining stuff). – doppelgreener Nov 16 '12 at 12:53
-1

The line is a polygon in computing, since it is composed of 3 or more points, connected by straight lines. The computer doesn't have to understand whether they are on a single line. It just "connects the dots".

But it can be discussed whether it is a polygon in terms of geometry. According to most definitions of a polygon in geometry, polygons are 2-dimensional shapes. The shape in your post is only one dimensional, so in my opinion it is not a polygon.

user1509872
  • 57
  • 1
  • 5
-2

A line does not make a closed boundary, so a line is never a polygon.

jzx
  • 3,805
  • 2
  • 23
  • 38
Mann
  • 5
  • 1
-3

A line is not a shape, a shape is an enclosed figure, and if a regular line counts as a shape, its not, because the line would be opened, and not enclosed, which IS a shape if the figure is enclosed. Many lines can make a shape, and for a circle, a bent line, is not a line, its a curve.