curve

Find bezier control-points for curve passing through N points

前提是你 提交于 2019-12-03 11:45:02
问题 Considering the following nice solution for finding cubic Bézier control points for a curve passing through 4 points: How to find control points for a BezierSegment given Start, End, and 2 Intersection Pts in C# - AKA Cubic Bezier 4-point Interpolation I wonder, if there is a straightforward extension to this for making the Bézier curve pass through N points, for N > 2 and maybe N ≤ 20? 回答1: This is a really old question, but I'm leaving this here for people who have the same question in the

How to generate this kind of random curves?

落爺英雄遲暮 提交于 2019-12-03 07:50:53
问题 Is it possible to generate this kind of random curves? I've tried IMagick bezier curves (see http://www.php.net/manual/en/function.imagickdraw-bezier.php), but even with 20-30 points they do not look like this. Here is my sample http://mechanicalzilla.com/sandbox/imagick/curve.php Thank you. 回答1: I bet you could write an algorithm which would basically take x number of random twists before going straight to the exit coordinates. This also assumes that algorithm is smart enough to check the

How to find out Y coordinate of specific point in bezier curve in canvas?

烈酒焚心 提交于 2019-12-03 07:28:16
问题 I need to find out Y coordinate of specific point of bezier curve in canvas. Do you know, how to find it out? Thank you 回答1: Using de Casteljau's algorithm you can find the coordinates x and y of a bezier curve for any t, the percentage or interpolation step. So a t of .1 would give you the x and y at 10% of the curve from the beginning. A t of .9 would be 90% from the beginning, and so on. In our cubic bezier we have p0 (point 0), cp0 (control point 0), cp1 (control point 1), and p1 (point 1

iOS how to calculate number of pixels/area enclosed by a curve?

做~自己de王妃 提交于 2019-12-03 03:13:55
I got an arbitrary shaped curve, enclosing some area. I would like to approximate the number of pixels that the curve is enclosing on an iPhone/iPad screen. How can I do so? A curve is defined as a successive x/y coordinates of points. A curve is closed. A curve is drawn by a user's touches (touchesMoved method), and I have no knowledge of what it looks like I was thinking of somehow filling the closed curve with color, then calculating the number of pixels of this color in a screenshot of a screen. This means I need to know how to programmatically fill a closed curve with color. Is there some

Find bezier control-points for curve passing through N points

一个人想着一个人 提交于 2019-12-03 02:09:29
Considering the following nice solution for finding cubic Bézier control points for a curve passing through 4 points: How to find control points for a BezierSegment given Start, End, and 2 Intersection Pts in C# - AKA Cubic Bezier 4-point Interpolation I wonder, if there is a straightforward extension to this for making the Bézier curve pass through N points, for N > 2 and maybe N ≤ 20? This is a really old question, but I'm leaving this here for people who have the same question in the future. @divanov has mentioned that there's no Bezier curve passing through N arbitrary points for N >4. I

How to find out Y coordinate of specific point in bezier curve in canvas?

依然范特西╮ 提交于 2019-12-02 21:04:13
I need to find out Y coordinate of specific point of bezier curve in canvas. Do you know, how to find it out? Thank you Using de Casteljau's algorithm you can find the coordinates x and y of a bezier curve for any t, the percentage or interpolation step. So a t of .1 would give you the x and y at 10% of the curve from the beginning. A t of .9 would be 90% from the beginning, and so on. In our cubic bezier we have p0 (point 0), cp0 (control point 0), cp1 (control point 1), and p1 (point 1). In the first step of the algorithm we draw a line connecting p0 and cp0, another line connecting cp0 and

Animated curve line in Swift 3

给你一囗甜甜゛ 提交于 2019-12-02 18:55:47
I want to draw some bezier lines and I want to animate them with a wave effect, Example Do you have some ideas about how I can do this ? Bezier line is it the best method to do it ? I found only 2 libs for this, but they are not really useful for what I need, I try to modify the code of one lib, unfortunately without success https://github.com/yourtion/YXWaveView I found this lib, https://antiguab.github.io/bafluidview/ which does the work, but it written in obj-c, maybe you know something like this in swift You can use a display link , a special kind of timer optimized for screen refresh

iPhone: draw the objects along the curve

荒凉一梦 提交于 2019-12-02 18:34:43
问题 Good day, friends. There is a task: to draw repeating objects (UIImageView and UILabel) along the curve (if more exactly, it's an arc). What classes should be used for it? 回答1: As an alternative to Android's Path , you can use either UIBezierPath or CGPath. The former is Objective-C, the later pure C. I recommend going with UIBezierPath as it's easier to use. To rotate a view, use the transform property of UIView (see this question for an example on how to use it). But note that you then need

Compute the 'elbow' for a curve automatically and mathematically

空扰寡人 提交于 2019-12-02 16:46:40
One example for curve is shown as below. The elbow point might be x=3 or 4. How to compute the elbow for a curve automatically and mathematically? You might want to look for the point with the maximum absolute second derivative which, for a set of discrete points x[i] as you have there, can be approximated with a central difference: secondDerivative[i] = x[i+1] + x[i-1] - 2 * x[i] As noted above, what you really want is the point with maximum curvature, but the second derivative will do, and this central difference is a good proxy for the second derivative. I created a Python package that

iPhone: draw the objects along the curve

大兔子大兔子 提交于 2019-12-02 10:50:24
Good day, friends. There is a task: to draw repeating objects (UIImageView and UILabel) along the curve (if more exactly, it's an arc). What classes should be used for it? DarkDust As an alternative to Android's Path , you can use either UIBezierPath or CGPath . The former is Objective-C, the later pure C. I recommend going with UIBezierPath as it's easier to use. To rotate a view, use the transform property of UIView (see this question for an example on how to use it). But note that you then need to ignore the frame (it's undefined) and need to move the view by modifying the center instead.