Page 2 of 2
Re: Points in a regular polygon
Posted: Mon Jan 27, 2014 6:19 am
by capellan
Notice that a regular polygon of 100 sides
looks very similar to a circle or oval.
So the effective points of such polygon
would be really useful, too.
Al
Re: Points in a regular polygon
Posted: Tue Jan 28, 2014 8:02 pm
by BvG
mwieder wrote: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.
Obviously i'd be interested in the actual points that draw the oval. So basically a full fledged freehand polygon, using whatever resolution LC uses itself.
Wait... are you saying that you don't actually give the necessary points to create a rounded polygon? So only the corner points of the polygon, as if it'd be a rectangle? if yes, i'd rater not to have anything, because that's what the various positioning properties of objects already sufficiently deliver, and there's no need to replicate it in a confusing manner. Of course the points of a rectangle
are the topleft & the bottomRight, so that makes sense, but only for that type of graphic.
Re: Points in a regular polygon
Posted: Sun Jun 22, 2014 5:19 am
by mwieder
My pull request was accepted, and now you soon can have the effective points of rectangles, rounded rectangles, regular polygons, and ovals. This will allow you to, for example, set the points of a polygon or curve to the effective points of a rounded rectangle. Or to iteratively move an image along the points of an oval. Or whatever.
Re: Points in a regular polygon
Posted: Sun Jun 22, 2014 1:45 pm
by [-hh]
..........
Re: Points in a regular polygon
Posted: Mon Jun 23, 2014 8:06 pm
by mwieder
In the IDE object inspector get the points filled with the points of current graphic whenever one switches the type of the graphic
from "roundRect" or "rectangle" or "oval" or "regular"
to "polygon" or "curve" or "line" (e.g. line 1 of current points for last)?
The property inspector is part of the ide, not the engine. It has a mind of its own as to what to display, and it's ripe for updating or replacing. There are third-party replacements that work much better.
Are the relativePoints also 'directly' available?
yes.
How will revRotatePoly work in connection to this new function?
I've only updated the engine code. The revRotatePoly command is also part of the ide (the code is in the revCommon button). I think the code should be rewritten, as it has the tendency to mangle polygons when it rotates them: case in point, try rotating a polygon or curve through 90 degrees four times and see if you end up with your original image. Someone with better math than mine should probably take a look at the code and submit a FIX: bug report.
Re: Points in a regular polygon
Posted: Mon Jun 23, 2014 11:35 pm
by [-hh]
..........
Re: Points in a regular polygon
Posted: Mon Jun 23, 2014 11:51 pm
by mwieder
! Many thanks for a quick reply. Actually truncating or rounding of the calculated points is no longer necessary - points of a graphic no longer need to be integers. I did a test that removes this restriction and it properly rotates graphics and returns to the original shape and size. But I'll also look over your stack later tonight when I get the chance. I'd also love to move this code into the engine for speed. Someday. Always a work in progress.
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 12:22 am
by [-hh]
..........
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 1:04 am
by FourthWorld
[-hh] wrote:mwieder wrote:Points of a graphic no longer need to be integers.
In the last months I often saw here this optimistic view. Where does it come from?
I think it comes from Skia. This works in v6.6.2:
Code: Select all
set the rect of grc 1 to 100.1,200.2,164.43,400.56
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 3:15 am
by mwieder
Actually, non-integer points for graphics is a change I submitted to the engine code last year.
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 11:14 am
by [-hh]
..........
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 5:39 pm
by mwieder
Ah. I see what you mean now.
What I implemented last year was a change so that setting non-integer points would no longer crash the engine.
I'll have a look at how the engine actually applies points, but I think actually using non-integer values may take a more sweeping structural change, something like what you suggested with zeropoints, i.e., storing the actual as well as the applied values.
Re: Points in a regular polygon
Posted: Tue Jun 24, 2014 8:26 pm
by [-hh]
..........
Re: Points in a regular polygon
Posted: Wed Jun 25, 2014 8:46 pm
by mwieder
I submitted a "FIX:" request based on what we've been doing here. The rounding functions are not necessary, as the engine does its own rounding for the display, and saving the actual floating-point values to work with internally solves the problem of distorting the graphics. After the next build of LC 6.7 this will work with the other graphics styles as well.
http://quality.runrev.com/show_bug.cgi?id=12692