Path: utzoo!mnetor!uunet!husc6!bbn!rochester!PT.CS.CMU.EDU!IUS1.CS.CMU.EDU!edw From: edw@IUS1.CS.CMU.EDU (Eddie Wyatt) Newsgroups: comp.lang.c Subject: asymmetric layout Message-ID: <1136@PT.CS.CMU.EDU> Date: 16 Mar 88 16:26:51 GMT Sender: netnews@PT.CS.CMU.EDU Organization: Carnegie-Mellon University, CS/RI Lines: 79 Way back whenever, someone posted a list of thou shall and thou shall not. One item on that list was asymmetric layout of assignment. Its use was mainly to help the reader to distinguish assignment for equality testing. I've adopted a convention related to that topic that others may find useful and thought I'd share it with all of you. (I'm such a nice guy :-)) In code segments that contain a lot of assigments, align the equal signs. Example : cosyaw = cos(rotate[YYAW]); sinyaw = sin(rotate[YYAW]); cosroll = cos(rotate[RROLL]); sinroll = sin(rotate[RROLL]); cospitch = cos(rotate[PPITCH]); sinpitch = sin(rotate[PPITCH]); /* x - axis */ yp = point[YY]*cosroll - point[ZZ]*sinroll; zp = point[YY]*sinroll + point[ZZ]*cosroll; point[YY] = yp; point[ZZ] = zp; /* y - axis */ zp = point[ZZ]*cospitch - point[XX]*sinpitch; xp = point[ZZ]*sinpitch + point[XX]*cospitch; point[XX] = xp; point[ZZ] = zp; /* z - axis */ xp = point[XX]*cosyaw - point[YY]*sinyaw; yp = point[XX]*sinyaw + point[YY]*cosyaw; point[XX] = xp; point[YY] = yp; becomes: cosyaw = cos(rotate[YYAW]); sinyaw = sin(rotate[YYAW]); cosroll = cos(rotate[RROLL]); sinroll = sin(rotate[RROLL]); cospitch = cos(rotate[PPITCH]); sinpitch = sin(rotate[PPITCH]); /* x - axis */ yp = point[YY]*cosroll - point[ZZ]*sinroll; zp = point[YY]*sinroll + point[ZZ]*cosroll; point[YY] = yp; point[ZZ] = zp; /* y - axis */ zp = point[ZZ]*cospitch - point[XX]*sinpitch; xp = point[ZZ]*sinpitch + point[XX]*cospitch; point[XX] = xp; point[ZZ] = zp; /* z - axis */ xp = point[XX]*cosyaw - point[YY]*sinyaw; yp = point[XX]*sinyaw + point[YY]*cosyaw; point[XX] = xp; point[YY] = yp; Easier to read no? -- Eddie Wyatt e-mail: edw@ius1.cs.cmu.edu