geometric-arc

How to draw a circle sector on an html5 canvas?

99封情书 提交于 2020-01-21 02:53:45
问题 I'm trying to make a sort of pie-chart shape on a canvas element, however I can't seem to find any function that does this by itself. I only seem to be able to draw full circles and segments. Is there an easy way to do this? (See also: Wikipedia on circle terminology) 回答1: The following should work: context.moveTo(cx,cy); context.arc(cx,cy,radius,startangle,endangle); context.lineTo(cx,cy); context.stroke(); // or context.fill() with cx , cy being the center of the arc. 来源: https:/

Get points of svg/xaml arc

喜你入骨 提交于 2019-12-24 16:19:57
问题 Format of svg arc (arc in xaml have same args): (rx ry x-axis-rotation large-arc-flag sweep-flag x y) Description: Draws an elliptical arc from the current point to (x, y). The size and orientation of the ellipse are defined by two radii (rx, ry) and an x-axis-rotation, which indicates how the ellipse as a whole is rotated relative to the current coordinate system. The center (cx, cy) of the ellipse is calculated automatically to satisfy the constraints imposed by the other parameters. large

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

HTML5: Fill circle/arc by percentage

核能气质少年 提交于 2019-12-21 05:43:11
问题 Here is my pseudo code: var percentage = 0.781743; // no specific length var degrees = percentage * 360.0; var radians = degrees * Math.PI / 180.0; var x = 50; var y = 50; var r = 30; var s = 1.5 * Math.PI; var context = canvas.getContext('2d'); context.beginPath(); context.lineWidth = 5; context.arc(x, y, r, s, radians, false); context.closePath(); context.stroke(); I'm using the KineticJS library to control the shapes I make and redraw them as necessary. My problem is that the above code

Draw ellipse with start and end angle in Objective-C

醉酒当歌 提交于 2019-12-20 23:28:19
问题 I am writing an iPad app in which I am rendering XML objects that represent shapes into graphics on the screen. One of the objects I am trying to render is arcs. Essentially these arcs provide me with a bounding rectangle as well as a start and end angle. Given attributes: x y width height startAngle endAngle With these values I need to draw the arc (which is essentially part of an ellipse). I can not use the following: UIBezierPath *arc = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(x,

drawing centered arcs in raphael js

纵然是瞬间 提交于 2019-12-17 15:17:33
问题 I need to draw concentric arcs of various sizes using raphael.js. I tried to understand the code behind http://raphaeljs.com/polar-clock.html, which is very similar to what I want, but, whithout comments, it is quite difficult to fathom. Ideally, I would need a function that creates a path that is at a given distance from some center point, starts at some angle and ends at some other angle. 回答1: That answer is ok, but cant be animated. I ripped the important stuff out of polar-clock for you.

Drawing a Thick, Arched Line in Android

大憨熊 提交于 2019-12-13 05:22:50
问题 Greetings Everyone. I was wondering how would I go about drawing an ached line on a canvas. If I were to continue this line it would make a perfect circle. I've got pie wedges which is close but I just want the outside of the wedge and it needs to be circular. What should I do 回答1: Canvas and the drawArc() function. 来源: https://stackoverflow.com/questions/4200723/drawing-a-thick-arched-line-in-android

SceneKit Orbital Transformations

北慕城南 提交于 2019-12-12 07:38:51
问题 So having started with SceneKit all has gone well so far until I stumbled upon transformations, thinking that it would be like CA3d* transformations on layers. However it seems I quite wrong and transformation work quite differently with regards to how the Z-axis works. For example I am trying to accomplish a 3d orbital style movement, similar to a carousel look. This piece of CA3D code works brilliantly to do that: var trans = CATransform3DIdentity trans = CATransform3DRotate(trans, deg *

Is it possible to change the shape of android seek bar?

我的未来我决定 提交于 2019-12-11 10:03:01
问题 I want to implement something similar to android seek bar.But not in a linear fashion,in an arc shape. is it possible to customize the seek bar in an arc shape? 回答1: You can't make SeekBar to draw its thumb any other way than offset horizontally. The code that actually draws thumb is in AbsSeekBar.onDraw, and there it's seen it's just horizontal offset. You may however make your own widget extending ProgressBar, which would draw thumb whatever way is needed (in arc). But you'll also need to

Getting End Point in ArcSegment with Start X/Y and Start+Sweep Angles

混江龙づ霸主 提交于 2019-12-08 17:22:55
问题 Does anyone have a good algorithm for calculating the end point of ArcSegment ? This is not a circular arc - it's an elliptical one. For example, I have these initial values: Start Point X = 0.251 Start Point Y = 0.928 Width Radius = 0.436 Height Radius = 0.593 Start Angle = 169.51 Sweep Angle = 123.78 I know the location that my arc should end up at is right around X=0.92 and Y=0.33 (through another program), but I need to do this in an ArcSegment with specifying the end point. I just need