X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Wed, 23 Dec 2015 00:47:15 +0100 From: Martin Beranek To: "Peter Clifton (petercjclifton AT googlemail DOT com) [via geda-user AT delorie DOT com]" Subject: Re: [geda-user] Circular approximation Message-ID: <20151222234715.GS14853@abax> References: <20151222144719 DOT GN14853 AT abax> <20151222184519 DOT GO14853 AT abax> <20151222215730 DOT GQ14853 AT abax> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > One idea I never pursued - which will greatly reduce complexity of > output polygons, is to force-align the circular approximation against > fixed angular steps. Say you had two lines meeting at 10 degrees... > why not have the end-cap vertices at the coincident ends match? (Just > need to figure out a scheme for stitching the nearest > arc-approximating vertex sensibly into the straight line portion. > (Ideally, leave the straight line portion un-molested, as shifting it > could potentially cause other rendering / output problems). This one is quite easy to implement, I believe. Take one regular complex polygon with edges tangential to the approximated circle (the polygon will be only scaled to match the circle, not rotated). The first segment of the approximating polygon will be the ray tangential to the approximated circle from the starting point (which lies on the circle by definition). This ray will be straight extension of the previous edge too in most code, btw. First vertex is the intersection of this ray with one edge of the fixed polygon. Then edges of the polygon follows until the point where we want to leave. Leaving will be implemented in the same way (i.e. tangential ray) as entry point. We should maybe "cheat" a bit in the case intersection between the ray and polygon would lay too close to the regular vertex of the polygon. Then, instead of intersection with the edge one could instead extend the next edge of the polygon behind its end vertex and use the intersection with this one. (It is more or less matter of preffering accurancy or not having vertices too close to each other, a minor difference anyway.) I believe there is nothing preventing implementation of this approach (parts of the code calling frac_circle() need a review anyway). Martin