Issues with Curves and Polygons
-
While making some UI drawing functions earlier, I've noticed some issues with with
createCurve
,bezier
, andcreatePoly
.First, with
createCurve
, certain point positions don't result in a visible image when the shape is drawn. Specifically, this happens when using 3 points where point2 is to the left and in-between point1 and point3 while point3 above and to the right of both point1 and point2.
This happens even when you set the shape's line style to ensure it has a visible thickness and color.The second problem is when calculating points with
bezier
, results falling between the first and second supplied point will be incorrect when those points form a ")" shape (with point1 at top, point2 equidistant between 1 and 2 and to the left, and point3 directly below point1).
Points falling between point2 and point3 are calculated correctly, and all points are calculated correctly if point2 is instead to the left of points 1 and 3.Lastly, creation of polygons requires additional unnecessary overhead and memory usage, i.e. you must supply an array of vectors or each vector as an individual argument. This means that unless you already have an array of the appropriate size lying around, you will always need to create an array of n vectors for any polygon with n vertices, even if you have no use for the array.
So if for example you want to create a long rectangle that has semi-circles on the left and right ends, and you want the curves on the left and right ends to have, say 20 vertices each, you would need to create an array of 40 vectors and pass it to thecreatePoly
function, but then that array is useless because it's not a reference to the resultant shape's vertices (and unless you need a buffer, such an array would be pointless because you can use theget
andset
functions for vertices anyway)I don't know if any of this is remedied by any upcoming patch, Nintendo say's I'm up to date, and I don't know what exactly is covered in the new patch, but I thought I would post it just in case.
I'm away from my Switch (and i don't have a twitter to post to yet either), so I won't have example code yet, but I'll add some in later today or tomorrow when I can.
-
@IANRASE I don't think that this has been reported before. If you can supply sample code that would be great I can test it against the latest patch and raise an issue if necessary
-
Well, as I was typing in my code demonstrating the
bezier
bug for the forum here I realized I screwed up while scaling the interpolation fact which caused it to be ~0.5 for the first half of my loop. That's what I get for trying to debug things without sleep, but good news anyway.I created a twitter account to share the
createCurve
bug since I didn't feel like retyping it here after having made a demo for it and also retyping my entirebezier
program then erasing it because it wasn't actually a bugThe demo program draws a few curves via
createCurve
then plots the points supplied during the creation in the order they were supplied to illustrate where the points are supposed to be.It appears that the given vertices aren't being drawn at their assigned locations, although using
getVertex
returns the same points that were supplied upon creation