geometric-arc

Draw arc with 2 points and center of the circle

一笑奈何 提交于 2019-11-27 14:44:22
I have two points of circle and center of this circle. I want to draw an arc between these points. Method drawArc is to simple and doesn't fit my purpose. Anybody help? botismarius You can use Canvas.drawArc, but you must compute the arguments it needs: Lets say that the center of the circle is (x0, y0) and that the arc contains your two points (x1, y1) and (x2, y2). Then the radius is: r=sqrt((x1-x0) (x1-x0) + (y1-y0) (y1-y0)). So: int r = (int)Math.sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0)); int x = x0-r; int y = y0-r; int width = 2*r; int height = 2*r; int startAngle = (int) (180/Math.PI*atan2

How to determine whether a point (X,Y) is contained within an arc section of a circle (i.e. a Pie slice)?

Deadly 提交于 2019-11-27 11:42:41
问题 Imagine a circle. Imagine a pie. Imagine trying to return a bool that determines whether the provided parameters of X, Y are contained within one of those pie pieces. What I know about the arc: I have the CenterX, CenterY, Radius, StartingAngle, EndingAngle, StartingPoint (point on circumference), EndingPoint (point on circumference). Given a coordinate of X,Y, I'd like to determine if this coordinate is contained anywhere within the pie slide. 回答1: I know this question is old but none of the

JFreechart draw arc on chart

左心房为你撑大大i 提交于 2019-11-26 21:07:39
I have 2 questions 1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code? Arc2D.Double arc = new Arc2D.Double(3.0, 16.9, 44.0, 17.04, 180.0, 180.0, Arc2D.OPEN ); plot.addAnnotation(new XYShapeAnnotation(arc, new BasicStroke(2.0f),

Draw arc with 2 points and center of the circle

試著忘記壹切 提交于 2019-11-26 16:52:44
问题 I have two points of circle and center of this circle. I want to draw an arc between these points. Method drawArc is to simple and doesn't fit my purpose. Anybody help? 回答1: You can use Canvas.drawArc, but you must compute the arguments it needs: Lets say that the center of the circle is (x0, y0) and that the arc contains your two points (x1, y1) and (x2, y2). Then the radius is: r=sqrt((x1-x0) (x1-x0) + (y1-y0) (y1-y0)). So: int r = (int)Math.sqrt((x1-x0)*(x1-x0) + (y1-y0)*(y1-y0)); int x =

Android: looking for a drawArc() method with inner & outer radius

百般思念 提交于 2019-11-26 10:15:17
问题 I have the following custom view: This I have achieved by using the Canvas\' drawArc() method. However, with this drawArc() method I cannot limit the arc\'s inner radius. What I\'d like to have is something like this: where there is only an outer ring left. What I need is an drawArc() function where I can set the inner radius of the arc. Anyone an idea how to do that? (BTW, overpainting the inner area doesn\'t work, because it needs to be transparent. Painting an inner circle with Color

Circle drawing with SVG's arc path

喜夏-厌秋 提交于 2019-11-26 09:48:19
Short question: using SVG path, we can draw 99.99% of a circle and it shows up, but when it is 99.99999999% of a circle, then the circle won't show up. How can it be fixed? The following SVG path can draw 99.99% of a circle: (try it on http://jsfiddle.net/DFhUF/1381/ and see if you see 4 arcs or only 2 arcs, but note that if it is IE, it is rendered in VML, not SVG, but have the similar issue) M 100 100 a 50 50 0 1 0 0.00001 0 But when it is 99.99999999% of a circle, then nothing will show at all? M 100 100 a 50 50 0 1 0 0.00000001 0 And that's the same with 100% of a circle (it is still an

JFreechart draw arc on chart

雨燕双飞 提交于 2019-11-26 07:49:32
问题 I have 2 questions 1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code? Arc2D.Double arc = new Arc2D.Double(3.0, 16.9, 44.0, 17.04

Circle drawing with SVG's arc path

落花浮王杯 提交于 2019-11-26 03:26:20
问题 Short question: using SVG path, we can draw 99.99% of a circle and it shows up, but when it is 99.99999999% of a circle, then the circle won\'t show up. How can it be fixed? The following SVG path can draw 99.99% of a circle: (try it on http://jsfiddle.net/DFhUF/1381/ and see if you see 4 arcs or only 2 arcs, but note that if it is IE, it is rendered in VML, not SVG, but have the similar issue) M 100 100 a 50 50 0 1 0 0.00001 0 But when it is 99.99999999% of a circle, then nothing will show