X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com Date: Sun, 27 Nov 2011 14:15:19 -0800 From: Andrew Poelstra To: geda-user AT delorie DOT com Subject: Re: [geda-user] Mathematics of the arc element in pcb. Message-ID: <20111127221519.GG4766@malakian.lan> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) 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 On Sun, Nov 27, 2011 at 10:36:03PM +0100, myken AT iae DOT nl wrote: > Hello all, > > I'm working on some functionality in pcb and I have a question. > > The question is about the start angle and the delta of an Arc element in pcb. > If I draw an Arc in pcb then I will get the following entry in my pcb file: > Arc [X Y Width Height Thickness Clearance StartAngle DeltaAngle SFlags] > (no not literally but I hope you know what I mean ;-). > > If the Width and the Height are the same the start angle (45 degrees) and > the delta (90 degrees) work as expected, > Arc[200000 150000 20000 20000 100 200 45 90 "clearline"] > > But if the Width and the Height are not the same, it looks like the start > angle and the delta are totally ignored. > Arc[200000 150000 30000 20000 100 200 45 90 "clearline"] > > Can anyone explain to me the mathematics behind the Arc element or point > me to the source code that does the mathematics? > As DJ said, width and height are applied as stretching, after a circular arc has been drawn with the given angles. StartAngle 0 means the arc starts at the left (opposite of traditional maths in which angles usually start at the right), and increase counter-clockwise. The HID's all draw stretched arcs in this way, except Peter Clifton's GL code, which still does not support them. It draws circular arcs using Width as the radius. Further, any "real" code which looks for intersections, connectivity, etc, only uses the width/height to calculate the endpoints. For the body of the arc, almost all of it just assumes a circular arc (using Width as the radius). So when using stretched arcs, you'll have all sorts of DRC and connectivity troubles. Also rotations don't work properly. Officially, pcb does not support stretched arcs for these reasons. If you're willing to donate some time and numerical analysis to get this stuff working well, that'd be wonderful. Peter C. has suggested just getting rid of arcs and using bezier curves for everything, but you can't do elliptical arcs with bezier curves :( -- Andrew Poelstra Email: asp11 at sfu.ca OR apoelstra at wpsoftware.net Web: http://www.wpsoftware.net/andrew "I don't understand. Are you saying dualism is always good, or always bad?"