curve

The curve function in base R

Deadly 提交于 2019-12-24 02:41:01
问题 Sorry this might be basic but I am a newbie. I will be making lots of curves so some advice will be useful for me. I have a function which I want to plot: f <- function(x) sum(4*sin(x*seq(1,21,2))/(pi*seq(1,21,2))) using curve(f, -pi, pi, n=100) Unfortunately ,this does not work for me. Please advise. Thanks 回答1: You function isn't vectorized. At the moment it will only take a single scalar input and output a single return value. curve expects that it should be able to feed in a vector of the

How to Drawing a curve line(peaks) using list of x,y coordinates

て烟熏妆下的殇ゞ 提交于 2019-12-23 17:10:00
问题 I have a list of x,y points which printed,display an uneven peak curve line. The above image was generated by just painting the points on a java paint component. I used the following way to paint them on a paint component. g.drawline(pointX,pointY,pointX,pointY) Are there better ways to paint such wave line? I checked some of the similar questions,often they need to print a curve or peak,but my line is not always a peak as some times its flats out and other times they are bizarre. 回答1: The

how to make a curved header with svg or with another responsive solution

*爱你&永不变心* 提交于 2019-12-23 01:54:36
问题 I am trying to make a curved header. And I am wondering if anyone can point me the right direction/or the best method the header as in the following image. I am not a developer so I am slogging. here is the image of the theme and curved header And here is my code.How can I achieve to make exactly the same header on the above image? *{ -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; padding: 0; margin: 0; } :root{ --red-color:#FF5F6D; --white-color:#FFFFFF;

laser curved line detection using opencv and python

房东的猫 提交于 2019-12-22 18:29:10
问题 I have taken out the laser curve of this image : (source: hostingpics.net) And now, I'm trying to obtain a set of points (the more, the better), which are in the middle of this curve. I have tried to split the image into vertical stripes, and then to detect the centroid. But it doesn't calculate lots of points, and it's not satisfactory at all ! img = cv2.Canny(img,50,150,apertureSize = 3) sub = 100 step=int(img.shape[1]/sub) centroid=[] for i in range(sub): x0= i*step x1=(i+1)*step-1 temp =

How to find the normal vector at a point on a curve in MatLab

青春壹個敷衍的年華 提交于 2019-12-22 09:48:04
问题 I have a curve and I want to find the normal vector at a given point on this curve, later I have to find the dot product of this normal vector with another vector. I tried the gradient function of MatLab, but I guess it doesnt work when we need to find the gradient at a specific point still I am not sure if I am wrong. Please guide me how can I achieve this in MatLab. Thanks in advance. 回答1: Using the explanation from this incredible SO question: if we define dx=x2-x1 and dy=y2-y1, then the

How to access calculated values of geom_curve in ggplot2 (R)?

你离开我真会死。 提交于 2019-12-22 09:09:56
问题 I am looking for the calculated values of ggplot2 when applying geom_curve . Herefore, a little reproducible example: require(ggplot2) df <- data.frame(x=c(0,2), y=c(5,5)) plot <- ggplot() + geom_curve(data = df, aes(x = df[1,"x"], y = df[1,"y"], xend = df[2,"x"], yend = df[2,"y"]), color = "red", linetype = 3, curvature = 0.4, size = 2) plot This plots a red curve between the two points of my data.frame. I am interested in the calculated values for plotting the arc, done by geom_curve . How

D3 custom curve: bundle interpolation for areas

左心房为你撑大大i 提交于 2019-12-22 05:07:52
问题 Consider this D3JS graph which uses a basis interpolation: In D3JS v3, I could use bundle interpolation ( .interpolate("bundle").tension(0) ) on areas to achieve this type of rendering instead: Notice how each segment of the graph fits nicely with its neighbors. This is what I need. With D3JS v4 and v5, the syntax for bundle interpolation is now this: .curve(d3.curveBundle) . However, it's now "intended to work with d3.line, not d3.area." I recently upgraded from v3 to v5, and so I'm trying

android 2d arc collision detection

我只是一个虾纸丫 提交于 2019-12-21 19:27:21
问题 i have a rotated arc drawn using android 2d graphics c.drawArc(new RectF(50, 50, 250, 250), 30, 270, true, paint); the arc will rotate while the game is running , i wanna know how i can detect if any other game objects(rects ,circles) collide with it ?? this is the first time for me to write a game :) i saw something like this in http://hakim.se/experiments/html5/core/01/ Thanks in advance 回答1: Arc collisions are slightly harder then normal collisions, but using boolean algebra you can easily

Javascript canvas curve with fixed length

自古美人都是妖i 提交于 2019-12-21 12:32:09
问题 I want to draw any ( randomized ) curve, with given: start point end point curve length How can I do such a thing limited by canvas boundaries, plus the curve can not cross. I was trying to find some solution but I can't figure this out. Thanks for your time. Here is more detailed view of what I want to accomplish: This is Quadratic curve drawn on canvas. Everything is fine. Question is, how to draw this without all the points, just with the fixed length in pixels, random points, bounded by

How to convert quadratic bezier curve code into cubic bezier curve?

有些话、适合烂在心里 提交于 2019-12-21 06:39:07
问题 So I've recently picked up graphics programming and I wanted to compute a cubic Bézier curve. I found this excellent answer on quadratic Bézier but I don't know how to convert this to a cubic Bézier curve. 回答1: For cubic Bézier curve, as you see in the link you shared, the green lines are obtained from the same procedure as the quadratic one. the differences are: you have two green lines, and then you need to calculate a blue line based on them. So the for loop changes as: for( float i = 0 ;