Computer Science Canada

Four-sided polygon?

Author:  flyindevil [ Wed Feb 04, 2009 6:20 pm ]
Post subject:  Four-sided polygon?

For some reason when I want to make a parallelogram (or any four-sided polygon), all I get is what looks like two triangles put together at the point, yet I can make three-sided polygons (triangles) quite fine, except for the hypotenuse being jagged Sad.
Here's the code I have for the triangle that works:

code:
var m : array 1 .. 3 of int := init (221,221,200)
var n : array 1 .. 3 of int := init (170,186,170)
drawfillpolygon (m, n, 3, 126)


And here's the code for a parallelogram that doesn't work:
code:
var o : array 1 .. 4 of int := init (194,199,214,219)
var p : array 1 .. 4 of int := init (220,220,204,204)
drawfillpolygon (o, p, 4, 12)


Please help me!

EDIT: Well, it appears I answered my own question. I just had to put the lower value x (o) coordinates in the middle.

Author:  DemonWasp [ Wed Feb 04, 2009 11:47 pm ]
Post subject:  RE:Four-sided polygon?

Turing will draw the polygon by going from point-to-point in whatever order you give it. Two of your lines were crossing before, which is what caused you to see two triangles.


: