www.delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2015/12/22/18:47:41

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 <martin AT mb5 DOT cz>
To: "Peter Clifton (petercjclifton AT googlemail DOT com) [via geda-user AT delorie DOT com]" <geda-user AT delorie DOT com>
Subject: Re: [geda-user] Circular approximation
Message-ID: <20151222234715.GS14853@abax>
References: <20151222144719 DOT GN14853 AT abax>
<CAJXU7q9yKKheYd5fnQz=cax=+rMmjDGNCuojLquq6zsiYZmRxw AT mail DOT gmail DOT com>
<CAJXU7q9ufwTHKAZf2Dp-_S5FpAs5BmJSPatrWnCi8uCXmPeyVg AT mail DOT gmail DOT com>
<20151222184519 DOT GO14853 AT abax>
<CAJXU7q_wS=HMdUPRHAyu9q2ZKawRUr-aZXvqzedR5ct5f+B-kQ AT mail DOT gmail DOT com>
<20151222215730 DOT GQ14853 AT abax>
<CAJXU7q-4g+wqgUn7oUSS1E4g=sOs2=7R+5Rqn_tFeWpq=6murQ AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAJXU7q-4g+wqgUn7oUSS1E4g=sOs2=7R+5Rqn_tFeWpq=6murQ@mail.gmail.com>
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

> 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019