View Single Post
02-12-14, 11:53 AM   #28
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by Nimhfree View Post
Assuming you can plot the positions of where each action item will appear on your arbitrary curve, is the problem that you want the buttons to line up nicely next to each other and they are not in some cases based on your actual curve shape?

In other words: (1) you create this mathematic curve, (2) attempt to apply Buttons, but because the buttons are squares or whatever shape you have them they do not fit nicely together, (3) want to make the buttons look nice along the curve so want to alter the curve to attempt to fit your original curve within the limits the shape of the buttons pose, (4) need to replot the points where the buttons will go based on this curve shaping.
I don't try to alter the curve or the buttons position on the curve. I simply rasterize the position of the button by the x/y coordinates of the mathematic bezier curve.

I'm trying to fix the not perfectly matching rotation of some buttons.

Now, why is the rotation not always correct? I'll try to explain it. It's challenging, as I'm more or less a math noob and my english is not that good, but I'll try.

The rotation angle is calculated by the tangent of the curve point (1st derivate) the specific button is placed on. It's the angle of the point tangent vector and the y-axis.

But, due to it's nature, the bezier curve is not a set of homogenous points. Meaning the interval from one point to the next point on the curve path is not equal for all curve points. The points may be spaced too far apart if the curve radius is very small and there are many points in areas where the curve is close to linear.

So I have non-homogenous path points and at the same time I have to place the buttons in a fixed interval on the path. This means, in some cases (usually at a small radius) I don't have a proper tangent vector (as there is no curve point that perfectly matches the position of the button).
I'll have to use a tangent/point that is as close as possible. And this leads to a slightly incorrect rotation angle.

I could fix this by calculating much more path points, but this needs an inaceptable amount of system ressources. So just 'smoothing' the degree values later on by calculating an average was my 'noob version' of a simple way to fix that.

[e] Due to the small value range (like x/y coordinates of +/- 300 or lower for the knots/control points and small tangent vectors with some path points) I'm pretty sure that there are also rounding differences in specific scenarios. And those rounding errors transform into an angle that is like one degree to small or to big.

Last edited by Duugu : 02-12-14 at 12:48 PM.
  Reply With Quote