help-octave
[Top][All Lists]

Re: help drawing a polygon using drawPolygon

 From: Anthony Andriano Subject: Re: help drawing a polygon using drawPolygon Date: Tue, 21 Feb 2017 08:41:09 -0700

Thanks for the help everyone. I was close it seems, but I didn't understand the syntax of any of the options, so none of them worked quite right. Now everything looks perfect.

On Tue, Feb 21, 2017 at 8:06 AM, Doug Stewart wrote:

On Tue, Feb 21, 2017 at 7:47 AM, Anthony Andriano wrote:
Hello,

I've been looking at the documentation for a while and I can't figure out what I'm doing wrong. There doesn't seem to be an example to help guide a beginner in this process and the terms aren't exactly clear.

I'm trying to draw a triangle with the coordinates (-1, -2), (0, -2), and (1, -2). The documentation for drawPolygon suggests it can take a list of coordinates or some type of array, but I can't find any examples or explanations for how the data should be entered and nothing I've tried has worked.

drawPolygon(COORD) - what does it mean to 'pack' coords into a single array? How does one accomplish this?

drawPolygon(PX, PY) - how do you specify the coordinates in different arrays? I tried passing in [-1 -2], [0 2], [1 -2] as well as [-1; -2], [0; 2], [1; -2] to no avail.

drawPolygon(POLYS) - I looked up cell arrays, but none of the notation I've tried has worked here.

My goal is to draw a triangle at the given coordinates and then draw it again on the same plot using a different color after applying a linear transformation to rotate it. Any help or guidance anyone can offer would be greatly appreciated.

Thanks,
Tony

_______________________________________________
Help-octave mailing list
https://lists.gnu.org/mailman/listinfo/help-octave

a= [ 1 1 ; 2 3; 4 2]
drawPolygon(a)

px=[-1 2 6 -1]
py=[-3 4 -1 -3]
drawPolygon(px',py')
--
DAS