bezier

Cubic bezier curves - get Y for given X - special case where X of control points is increasing

蹲街弑〆低调 提交于 2019-12-07 16:52:11
问题 I've read a few discussions regarding finding Y at X for a cubic Bezier curve, and have also read this article regarding the matter. My case is more constrained than the general one, and I wonder if there's a better solution than the general ones mentioned in the above discussions. My case: The X value of the different control points is increasing. Ie: X3 > X2 > X1 > X0 . Also, as a result of above, X(t) is strictly monotonically increasing as well. Is there any efficient algorithm that takes

Quadratic bezier curve: Y coordinate for a given X?

て烟熏妆下的殇ゞ 提交于 2019-12-07 13:55:00
问题 I have a quadratic bezier curve and I need the Y coordinate of a point on the bezier curve for a given X coordinate. I know that in pure maths this can be easily done, but I'm wondering is there's a simple / another way for this in C# / WPF? Is it possible to get the single points used by C# / WPF for drawing the bezier curve and then maybe just loop them and compare the X coordinate of each point with the given X coordinate? BTW for the mathematical way it would be good to know which step

How can I create a simple 2D NURBS using XAML?

拥有回忆 提交于 2019-12-07 12:12:58
问题 I need to create a spline with two endpoints and 'n' control points. As far as I am aware, a Bezier curve allows for only one control point, and a Bezier spline allows for two control points. However, I need to be able to add as many control points as I see fit, not limited to one or two. Here is an example of what I want to achieve, with 4 control points: (Source: Wikipedia article on NURBS) So far I've only been able to combine a series of BezierSegments together like this: http://img297

Find the intersection(s) of a pair of QuadCurve2Ds

江枫思渺然 提交于 2019-12-07 08:16:59
问题 Is there an easy way to approximate the points (if any) where two instances of QuadCurve2D intersect? That is, how could I compute the coordinates of the red dots in this diagram? There is no obvious method in QuadCurve2D to do this. (note: the points are not exact as I have tweaked them manually for the diagram. Also note the "missing" fourth point which does not lie on the curve segment even though it lies on the (infinite) parabola.) These two curve segments were created with the following

Quadratic Bezier Curve: Calculate Tangent

别说谁变了你拦得住时间么 提交于 2019-12-07 05:21:01
问题 I have a quadratic bezier curve and I want to calculate the slope of the tangent in a given point. For example, let it be the middlepoint of the quadratic bezier curve, therefore t=0.5 (please see the link below for a picture of this). I've calculated the first derivative of the formula for the quadratic bezier curve; however I get 400 as value for the slope, though it should be 0. Maybe I'm using the first derivative in a wrong way? I know I could also calculate the tangents using

How to smooth the blocks of a 3D voxel world?

痞子三分冷 提交于 2019-12-06 21:18:27
问题 In my (Minecraft-like) 3D voxel world, I want to smooth the shapes for more natural visuals. Let's look at this example in 2D first. Left is how the world looks without any smoothing. The terrain data is binary and each voxel is rendered as a unit size cube. In the center you can see a naive circular smoothing. It only takes the four directly adjacent blocks into account. It is still not very natural looking. Moreover, I'd like to have flat 45-degree slopes emerge. On the right you can see a

Create a UIView with rounded top edge

牧云@^-^@ 提交于 2019-12-06 14:37:54
I would like to create an UIView with rounded top edge like this image, how can I do it please? Wanted result Not wanted result To repost an answer I posted on a different thread: I can now confirm that this is a bug introduced after iOS 6. I have an old 4s running iOS 6.1. On that machine, this code: path = [UIBezierPath bezierPathWithRoundedRect: bounds byRoundingCorners: UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii: CGSizeMake(bounds.size.width/2, bounds.size.width/6) ]; Creates a rounded rectangle with the corners oval-shaped. The curve is much more gradual on the top part of the

Find all points along a path AS3

霸气de小男生 提交于 2019-12-06 14:36:08
Basically, I want to randomly add a movie clip to any point along a bezier curve. Is there a way to find all points along a path? Or maybe there's a way to find the equation (it's a quadratic curve)? If all else fails, is there a way to find the points along a straight line (that isn't perfectly horizontal or vertical)? If you are using the pen tool, this is creating a Shape . You can access the path of this shape by reading the result from Shape.graphics.readGraphicsData() See the reference for readGraphicsData . 来源: https://stackoverflow.com/questions/15482618/find-all-points-along-a-path

iOS - Change color channels levels programmatically

我们两清 提交于 2019-12-06 13:26:46
Is it possible to adjust color levels using Core Graphics? I would like to adjust channels using parametrized curves in the Gimp or other graphic editor style. You can use this: ios-image-filters (like photoshop) if you want to manipulate levels, here's your method, built straight onto the UIImage class: - (UIImage*) levels:(NSInteger)black mid:(NSInteger)mid white:(NSInteger)white 来源: https://stackoverflow.com/questions/7567934/ios-change-color-channels-levels-programmatically

How to simplify cubic bezier curve?

六眼飞鱼酱① 提交于 2019-12-06 11:25:40
I have a Cubic Bezier curve comprises of a number of segments (left image). It has some rough curvature and I need to make it smoother like the right image. This problem is somewhat like "noise reduction", how do I achieve this? There's similar thread here , but the input is a set of point and fitting a bezier curve on it using least square, but in my problem the input is already cubic bezier. On image above I don't draw the segments and control points but I hope you get the idea. Do you want to keep the same number of segments? Do you need to keep continuity between Bezier segments? Are you