curve

Curve fitting a series of line segments

放肆的年华 提交于 2019-12-18 17:32:40
问题 There are a lot of curve fitting questions on SO but I can't seem to find one that addresses what I'm looking for. The scenario is simple: I capture X/Y points on a tablet screen. I'd like to draw the resulting line segments as a smooth curve instead of a series of line segments. Many apps do this, for example: Penultimate (sketching demo at 0:36) or Autodesk Sketchbook. Bezier curve algorithms take a fixed number of points to draw a curve and don't seem to work well with numerous multiple

Three.JS Object following a spline path - rotation / tanget issues & constant speed issue

随声附和 提交于 2019-12-17 18:31:57
问题 I think my issue is similar to: Orient object's rotation to a spline point tangent in THREE.JS but I can't access the jsfiddle's properly and I struggled with the second part of the explanation. Basically, I have created this jsfiddle: http://jsfiddle.net/jayfield1979/qGPTT/2/ which demonstrates a simple cube following the path created by a spline using SplineCurve3 . Use standard TrackBall mouse interaction to navigate. Positioning the cube along the path is simple. However I have two

JavaFX line/curve with arrow head

百般思念 提交于 2019-12-17 18:27:13
问题 I'm creating a graph in JavaFX which is supposed to be connected by directed edges. Best would be a bicubic curve. Does anyone know how to do add the arrow heads? The arrow heads should of course be rotated depending on the end of the curve. Here's a simple example without the arrows: import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.scene.shape.CubicCurve; import javafx.scene.shape.Rectangle; import

Fitting a curve to specific data

纵饮孤独 提交于 2019-12-17 17:54:08
问题 I have the following data in my thesis: 28 45 91 14 102 11 393 5 4492 1.77 I need to fit a curve into this. If I plot it, then this is what I get. I think some kind of exponential curve should fit this data. I am using GNUplot. Can someone tell me what kind of curve will fit this and what initial parameters I can use? 回答1: Just in case R is an option, here's a sketch of two methods you might use. First method: evaluate the goodness of fit of a set of candidate models This is probably the best

Catmull-rom curve with no cusps and no self-intersections

眉间皱痕 提交于 2019-12-17 03:49:56
问题 I have the following code to calculate points between four control points to generate a catmull-rom curve: CGPoint interpolatedPosition(CGPoint p0, CGPoint p1, CGPoint p2, CGPoint p3, float t) { float t3 = t * t * t; float t2 = t * t; float f1 = -0.5 * t3 + t2 - 0.5 * t; float f2 = 1.5 * t3 - 2.5 * t2 + 1.0; float f3 = -1.5 * t3 + 2.0 * t2 + 0.5 * t; float f4 = 0.5 * t3 - 0.5 * t2; float x = p0.x * f1 + p1.x * f2 + p2.x * f3 + p3.x * f4; float y = p0.y * f1 + p1.y * f2 + p2.y * f3 + p3.y * f4

2d density plot from curves

烂漫一生 提交于 2019-12-14 03:58:17
问题 I have a multi-parameter function on which I infer the parameters using MCMC. This means that I have many samples of the parameters, and I can plot the functions: # Simulate some parameters. Really, I get these from MCMC sampling. first = rnorm(1000) # a second = rnorm(1000) # b # The function (geometric) geometric = function(x, a, b) b*(1 - a^(x + 1)/a) # Plot curves. Perhaps not the most efficient way, but it works. curve(geometric(x, first[1], second[1]), ylim=c(-3, 3)) # first curve for(i

Shade and calculate specific area

谁说我不能喝 提交于 2019-12-13 15:38:15
问题 I tried to change the code in a way so that only the first area is shaded grey. How can I set the horizontal line in a way that it only appears under the area I want to shade? Furthermore I want to calculate the area of ONE region. How do I achieve that? I know it is trapz but I am not sure how to set the boundaries. Thanks! x = 0:.01:4*pi; %// x data y = sin(x); %// y data level = 0.5; %// level plot(x, y) hold on area(x, max(y, level), level, 'EdgeColor', 'none', 'FaceColor', [.7 .7 .7])

HTML5 Canvas: get curve's coordinates

蓝咒 提交于 2019-12-13 15:33:12
问题 I have a quadratic curve in canvas (defined by start, end and control point). What I need is to get more of the curve's coordinates (eg. the middle, quarters etc.). With that, I'd be able (after a few iterations of finding coordinates) to animate an object based on this curve (I know it can be done easily with SVG, but that's not an option). image taken from http://www.html5canvastutorials.com/tutorials/html5-canvas-quadratic-curves/ Is there an easy way to do this? When I checked for

Finding the intersection point between line and piecewise linear curves

耗尽温柔 提交于 2019-12-13 07:43:05
问题 I have two curves, one is a line, for example y = x/4 and another one is the set of points which I connect with line segments (for example : x = [1, 2.5, 3.4, 5.8, 6] , y = [2, 4, 5.8, 4.3, 4] which forms 5 points in 2D plane that forms a piecewise linear curve), and I should find the intersecting point between this two curves. I should first form this piecewise linear curve and then find the intersection point. Fortunately, I found that I could use numpy.polyfit to find the polynomial

Fitting a curve in the points

∥☆過路亽.° 提交于 2019-12-13 03:39:33
问题 This is my data: y<-c(1.8, 2, 2.8, 2.9, 2.46, 1.8,0.3,1.1,0.664,0.86,1,1.9) x<- c(1:12) data<-as.data.frame(cbind(y,x)) plot(data$y ~ data$x) I want to fit a curve through these points so that I can generate the intermediate predicted values. I need a curve that goes through the points. I don't care what function it fits. I consulted this link. Fitting a curve to specific data install.packages("rgp") library(rgp) result <- symbolicRegression(y ~ x,data=data,functionSet=mathFunctionSet,