I'm a bit confused about what you're trying to accomplish. It seems you are trying to define the arc of a circle that passes through the origin and the point (x,y), with slope defined at the orign and at (x,y) - is that right? if so, you've over-specified the problem. A different way to approach this is to specify the point (x,y) and angle1 and let the program determine angle2. Here's how: first find the center of the circle, which is the intersection of (a) a line from the origin perpendicular to angle1 and (b) a line perpendicular to the midpoint of the chord bwteen the origin and (x,y). Calculate the radius R of this circle. The angle subtended by the arc is then 2 x asin(halfchord-length/R). And angle2 will be angle1 + the angle of the arc.