I’m working on a piece of code to drag and draw an arc. Once the width of the arc is set I can then adjust the height by dragging the mouse. It replicates the two-point arc function found in many pieces of CAD software. However, I’m having problems with the arc plotting code. When I run it, dragging the arc height simply expands the whole arc (width and height), when the arc width(cord) should remain constant with only the height changing.

Here’s a quick drawing of what I’m trying to achieve (the top red arc):

pt1->pt2 or c is the width/cord of the arc

pt3 or h is the height of the arc which I’m dragging out with the mouse

I calculate the radius of the circle that fits all three points, then work out the angle from the center of the circle, between pt1 and pt2.

This angle is then divided by a number of segments and the corresponding points for the arc looped through and returned for drawing.

I’ve been testing with a simple ellipse function, so I know that my surround code works (mouse dragging, drawing, etc). I know this should be straightforward but I’m going around in circles (literally and figuratively :)). I think I’ve looked at it too long. Any help, much appreciated!

Current Arc Code:

```
# height(h), width(c) and midpoint(m) between
# pt1 and pt2 of the arc are passed from the dragging function
# along with the number of segments
def plot_arc_r_dim(h, c, m, segs):
d = (c * c) / (8 * h)
theta = (2 * math.atan(h / (2 * d))) / segs
# theta = math.pi / segs
dx = 0
dy = 0
dz = 0
r = (h / 2) + d
mx = m[0]
my = m[1]
verts = []
# anti-clockwise
for i in range(segs + 1):
dx = mx + math.cos(theta * i) * r
dy = my + math.sin(theta * i) * r
verts.append(Vector([dx, dy, dz]))
return verts
```