Page 1 of 2

Points in a regular polygon

Posted: Wed Nov 27, 2013 7:07 pm
by dunbarx
Though it may make no sense to ascribe points to an oval, it ought to be possible to ascribe them to a regular polygon. Currently only irregular polygons, freehand curves and lines have a valid list of points. But a polygon certainly has well defined points, after all, the engine draws them with actual points anchoring the shape of the graphic. The issue came up with a request to have an object move along the perimeter of a circle. A regular polygon with hundreds of sides would look just like a circle, and of course moving along the points of that polygon would be simple.

Even a rectangle graphic has no points, or rather, like the others, that property returns empty. But it sure has a rect.

Craig Newman

Re: Points in a regular polygon

Posted: Sat Nov 30, 2013 1:41 am
by [-hh]
..........

Re: Points in a regular polygon

Posted: Wed Dec 11, 2013 8:38 am
by ThatOneGuy
The idea behind the regular polygons is that they don't require specifying points. Changing the points of a regular poly would cause it to no longer be regular. An oval, just like a regular poly, is not defined by points, but by its rectangle. The difference is that the oval is also defined by its arc and angle, while the regular poly is defined by its sides and angle.

If you want to use points, then use the freehand poly tool to create an irregular poly object and set the "points" or it to what you want. This is done easily enough using a repeat loop and you can have hundreds of points continually updating on multiple polygons without seeing any lag or errors. I've tested this.

Re: Points in a regular polygon

Posted: Wed Dec 11, 2013 10:05 am
by [-hh]
..........

Re: Points in a regular polygon

Posted: Thu Dec 12, 2013 12:56 am
by dunbarx
ThatOneGuy.

What Hermann said.

This is exactly how this started. In order to create a freehand graphic locked to the "points" of, say, a 50 sided regular polygon, you cannot:

set the points of grc "free" to the points of grc "regular"

You have to draw the thing by hand. Then, and only then, do you have a regular, many sided polygon with real, addressable points. This came about as one simple way to have an image track the perimeter of a circle. I wanted to create a hundred-sided regular polygon (which sure looks like a circle) and run the thing along its points. What do you know, it don't got any.

Craig

Re: Points in a regular polygon

Posted: Thu Dec 12, 2013 5:49 am
by ThatOneGuy
I see what you mean here.

You don't have an interest in seeing the points of regular graphics for the purpose of editing them, you just want a way of accessing them so that you can use them.

That may indeed be a worthwhile feature.

Re: Points in a regular polygon

Posted: Fri Jan 17, 2014 7:54 pm
by mwieder
OK - this may be one I can take on, because it will probably tie in with the work I did in allowing non-integer point values. I'll have a look at the code over the weekend and see what it looks like.

Re: Points in a regular polygon

Posted: Fri Jan 24, 2014 8:42 pm
by mwieder
Adding this feature turned out to be pretty easy.
Before submitting the pull request, though...

This will allow getting the points of regular polygons, but not setting them.
The fix does allow you to set the points of a polygon to the points of a regular polygon.

I realize that this is what was requested, but with other graphic objects you can both get and set the points, so I can see the objection being raised that this is an exception. It would have to be documented as such explicitly. It wouldn't really make sense to try to set the points of a regular polygon.

Re: Points in a regular polygon

Posted: Sat Jan 25, 2014 3:30 pm
by BvG
That's so cool to have! Now do it for rectangles, rounded rectangles, and especially ovals :P

On a slightly more serious feature creep question, It could theoretically be useful to set a single point of a regular polygon, then have LC calculate all the other points according to the settings of "the sides" and "the rotation"... but yeah, reading them is a big advantage already.

Re: Points in a regular polygon

Posted: Sat Jan 25, 2014 6:04 pm
by mwieder
Rectangles and rounded rectangles are included.
Have to check ovals... I don't remember off the top of my head.

... and yeah, I looked into setting the points of a regular polygon, but

a) the math gets pretty involved, and
b) what do you do if the points don't make a regular polygon? Regular polygons are subject to many more restrictions than freeform polygons - in addition to the points having to be in exactly the right place, they have to be symmetrical and well, regular. If the number of side changes because the number of points changes, you have to set that property as well. Etc. Probably better just to say "make me a regular polygon with this rect and this many sides" and be done with it.

Re: Points in a regular polygon

Posted: Sat Jan 25, 2014 11:07 pm
by Mark
Mark,

Could this be something like the "effective points"? In most, if not in all cases, an "effective" property can be gotten but not set and thus it wouldn't be an exception. The effective points and the points of an irregular polygon would probably be equal.

Mark

Re: Points in a regular polygon

Posted: Sun Jan 26, 2014 2:54 am
by mwieder
@Mark: That's brilliant. Let me look into what that would take. I glanced at the "effective" settings this morning, but just briefly.

Re: Points in a regular polygon

Posted: Mon Jan 27, 2014 1:14 am
by mwieder
OK...

"the points of" a rectangle, rounded rectangle, regular polygon now return nothing.
"the effective points of" any of those return a list of points.

I don't think "the points of an oval" makes much sense. It's easy to get the rect of an oval, the center, etc. But the points of an oval would depend on the resolution you wanted. I can easily return the points of an oval as the corner points of its rectangle, but that doesn't gain you anything that the rect of the oval gives you.

Re: Points in a regular polygon

Posted: Mon Jan 27, 2014 2:02 am
by dunbarx
Mark.

Have you added this to the engine? If so, where can I see it?

And I agree, as I first said, the points of an oval is pushing it...

Craig

Re: Points in a regular polygon

Posted: Mon Jan 27, 2014 3:10 am
by mwieder
I pushed the code to github and submitted a pull request.
That's my part of this.
Now it's up to the team to get around to evaluating it and either pulling it into the code base or <whatever else they decide to do>.