curve

How to use the D3 diagonal function to draw curved lines?

谁说我不能喝 提交于 2019-11-29 00:21:34
问题 I looked at sample http://bl.ocks.org/mbostock/raw/4063570/: It produces nice merged lines from source target from left to right. In my case I need to layout nodes manually and put x, y coordinates. In this case the lines are not merged at source nodes. Here is the test code that reproduce this problem: var data = [ {name: "p1", children: [{name: "c1"}, {name: "c2"}, {name: "c3"}, {name: "c4"}]}]; var width = 400, height = 200, radius = 10, gap = 50; // test layout var nodes = []; var links =

How to place the intercept of x and y axes at (0 , 0) and extend the x and y axes to the edge of the plot [duplicate]

為{幸葍}努か 提交于 2019-11-28 21:21:30
This question already has an answer here: Set R plots x axis to show at y=0 2 answers Suppose I want to plot x^2 . I can use curve() as follows. curve(x^2, -5, 5) However, I would like the axes to go through (0, 0). I could do something as follows: curve(x^2, -5, 5, axes=FALSE) axis(1, pos=0) axis(2, pos=0) abline(h=0) abline(v=0) And I end up getting something like below, which looks OK. But the only gripe I have is that this way of plotting axes makes the actual axes - for example the segment between -4 and 4 of the x-axis - thicker than the segments to the right side and the left side. The

Compute the 'elbow' for a curve automatically and mathematically

穿精又带淫゛_ 提交于 2019-11-28 17:58:47
问题 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? 回答1: 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,

plotting a curve around a set of points

老子叫甜甜 提交于 2019-11-28 17:53:26
I have a set of points on a plane. They are partitioned into subsets. I want to plot a closed curve around points that belong to the same subset, so that points that belong to a subset will be inside the curve, and those that aren't will be outside. Therefore simple circles, or a convex hull might not work. For a starter, let's say I just want to have a smooth curve around a set of point (without the requirement that it excludes other points) Any ideas how to do that in R? ---added later--- What I'm looking eventually, is something in the spirit of the graphics in here: https://tex

Why do I see this jagged curves?

笑着哭i 提交于 2019-11-28 13:03:35
I have a canvas and draw curve with this code: using (Graphics g = Graphics.FromImage(canvas.BackgroundImage)) { g.DrawCurve(pen, points); points is array that I fill that by mouse location points. In the result I see some jagged lines that I didn't draw. You can see them here(in red rectangles): What can i do about this? What you is see is the somewhat unlucky combination of the default for Linejoin , which is Miter and the default for MiterLimit , which is 10. Instead you have a choice of either picking one of the other LineJoin options or reducing the MiterLimit to say less than half the

How to create 2d plot of arbitrary, coplanar 3d curve

旧城冷巷雨未停 提交于 2019-11-28 12:59:01
问题 I have a set of points which comprise a (in theory) co-planar curve. My problem is that the plane is arbitrary and can move between each time I collect the data (these points are being collected from a camera). I was wondering if you guys could help me figure out how to: find the plane which is closest to the one which these points are co-planar on project the points on this plane in such a way that gives me a 2-d curve I believe that I know how to do point 2, it is really mainly point 1 that

Curving an image that starts as a rectangle (uploaded by user), preferably using Canvas or JS

吃可爱长大的小学妹 提交于 2019-11-28 09:50:02
问题 I'm trying to create a site that curves an image uploaded by a user, and then allows the user to save the new image. I'm having trouble figuring out how to curve the image as shown in the link below. I can create the curved shape as a solid color in Canvas, but not with an image. http://i53.tinypic.com/2gule04.jpg 回答1: I tried something like this. I have a source image having width 300 and height 227. And I am going to bend this image 15 pixel down. So create a canvas with same width and

Split a cubic bezier curve at multiple points

扶醉桌前 提交于 2019-11-28 09:06:58
问题 I'm writing an algorithm that will split a cubic bezier curve into multiple curves (up to 4). I have the t values for each point I want to split at from the beginning. I also have an algorithm already for splitting the curve once: SubdivPoints subdivideBezier(Vector2 p0, Vector2 p1, Vector2 p2, Vector2 p3, float t) { Vector2 p11 = (p1 - p0) * t + p0; Vector2 p21 = (p2 - p1) * t + p1; Vector2 p31 = (p3 - p2) * t + p2; Vector2 p12 = (p21 - p11) * t + p11; Vector2 p22 = (p31 - p21) * t + p21;

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

橙三吉。 提交于 2019-11-28 07:49:55
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 questions. First, I am using the spline.getTanget( t ) where t is the position along the path in order to

JavaFX line/curve with arrow head

久未见 提交于 2019-11-28 07:01:32
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 javafx.stage.Stage; public class BasicConnection extends Application { public static void main(String[]