help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help drawing a polygon using drawPolygon


From: James Sherman Jr.
Subject: Re: help drawing a polygon using drawPolygon
Date: Tue, 21 Feb 2017 09:34:49 -0500

On Tue, Feb 21, 2017 at 7:47 AM, Anthony Andriano
<address@hidden> 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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
>

Hi Anthony,

I can't check right now, but my guess is, for the second way to call
drawPolygon, PX stands for the x coordinates of your polygon, and PY
stands for the y coordinates of the polygon, so, try something like:
PX = [-1 0 1];
PY = [-2 2 -2];
drawPolygon(PX, PY);

Hope this helps.

James Sherman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]