X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f Date: Wed, 13 May 2015 14:26:32 -0400 Message-Id: <201505131826.t4DIQWuQ002817@envy.delorie.com> From: DJ Delorie To: geda-user AT delorie DOT com In-reply-to: <1431541322.2827.46.camel@linetec> (geda-user@delorie.com) Subject: Re: [geda-user] Free rotate and exported centroid (XY) file question References: <1431514980 DOT 2827 DOT 26 DOT camel AT linetec> <201505131730 DOT t4DHUISw031045 AT envy DOT delorie DOT com> <1431541322 DOT 2827 DOT 46 DOT camel AT linetec> 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 Consider a part with 16 pins in a row (sip) but staggered left-right-left-right etc. Is the part rotated, or not? The XY code in src/hid/bom.c rounds angles to multiples of 90 to avoid being confused by such things. I.e. it only works for parts that haven't been free-rotated. static double xyToAngle (double x, double y, bool morethan2pins) { double d = atan2 (-y, x) * 180.0 / M_PI; /* IPC 7351 defines different rules for 2 pin elements */ if (morethan2pins) { /* Multi pin case: * Output 0 degrees if pin1 in is top left or top, i.e. between angles of * 80 to 170 degrees. * Pin #1 can be at dead top (e.g. certain PLCCs) or anywhere in the top * left. */ if (d < -100) return 90; /* -180 to -100 */ else if (d < -10) return 180; /* -100 to -10 */ else if (d < 80) return 270; /* -10 to 80 */ else if (d < 170) return 0; /* 80 to 170 */ else return 90; /* 170 to 180 */ } else { /* 2 pin element: * Output 0 degrees if pin #1 is in top left or left, i.e. in sector * between angles of 95 and 185 degrees. */ if (d < -175) return 0; /* -180 to -175 */ else if (d < -85) return 90; /* -175 to -85 */ else if (d < 5) return 180; /* -85 to 5 */ else if (d < 95) return 270; /* 5 to 95 */ else return 0; /* 95 to 180 */ } }