9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: mirtchov@cpsc.ucalgary.ca
To: 9fans@cse.psu.edu
Subject: Re: [9fans] optimizing graphics
Date: Sat,  6 Sep 2003 12:24:46 -0600	[thread overview]
Message-ID: <edda488d8494dbb8782a50179a45cba3@plan9.ucalgary.ca> (raw)
In-Reply-To: <0c4e34784737145439fd25728872fef4@plan9.bell-labs.com>

> It's on sources now.

i ran all the xscreensaver code through it. some of the
improvements are questionable at best :)

example:
			tmpx = xmid + ((       radius1	          /* * * * *            */
			- radius2        )		 /* This algo simulates	*/
			    * cos((      theta 		/* the rotation of a    */
			* M_PI           ) 		/* circular disk inside */
			    / 180           )) 		/* a hollow circular 	*/
			    + (              d 		/* rim. A point on the  */
			* cos((((  radius1 		/* disk dist d from the	*/
			* theta          )		/* centre, traces the 	*/
			    - delta          )		/* path given by this   */
			    / radius2        )  		/* equation.	        */
			    *             M_PI		/* A deviation (error)  */
			/ 180            )            /* of delta needs to be */
			    );           /* given, which greatly */
			/* adds to the beauty   */
			tmpy = ymid + (				/* of the figure.       */
			( radius1 - radius2	/*			*/
			) * sin			/* Imperfection adds to */
			(			/* beauty, symbolically */
			( theta * M_PI     	/* ...			*/
			) / 180		/* Algo deduced by      */
			)			/* Rohit Singh, Jan'00  */
			    ) +                  /* based on a toy he    */
			( d * sin           /* used to play with    */
			(                  /* when he was a kid.  */
			(                 /*            * * * * */

but it's not cb's fault, i'm sure!

there's a bug in cb.c while parsing comments within structure
definitions.  for example the following is parsed incorrectly:

--------snip----------
static double plane_orig[][2][3] = {
	/* X goes into screen, Y goes right, Z goes down(up?) */
	/* {Normal}, {Point} */
	{ {1.0, 0, 0}, {0.01, 0, 0} },
--------/snip---------

rezulting in non-compileable code:

--------snip----------
static double plane_orig[][2][3] = {
	{Normal}
, {
	Point}
*/
{
	{
		1.0, 0, 0},
		{0.01, 0, 0	}
	},
--------/snip---------

here's a diff that fixes this particular problem (and creates a couple
of warnings), it works for me, but i'm not really completely 100%
surely positive that it's the right solution:

--------snip----------
plan9-2% diff cb.c /sys/src/cmd/cb/cb.c
960c960
< 	return(lastplace);
---
> 	return(beg);
plan9-2%
--------/snip---------


CB also doesn't recognize C++-style '//' comments, or at least it
renders them incorrectly if they contain any tokens suck as '}' or
')', try cb on this for example:

	// this is a comment with a smiley at the end :)


andrey




  reply	other threads:[~2003-09-06 18:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-05  5:16 mirtchov
2003-09-05 22:45 ` andrey mirtchovski
2003-09-05 23:01   ` Geoff Collyer
2003-09-06 14:55     ` David Presotto
2003-09-06 15:00       ` David Presotto
2003-09-06 18:24         ` mirtchov [this message]
2003-09-06 18:28           ` Russ Cox
2003-09-06 18:33             ` mirtchov
2003-09-06 22:03             ` Geoff Collyer
2003-09-05 23:17   ` jmk
2003-09-05 23:27     ` mirtchov
2003-09-08  1:10       ` okamoto
2003-09-06  5:36     ` boyd, rounin
2003-09-06  5:33   ` boyd, rounin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=edda488d8494dbb8782a50179a45cba3@plan9.ucalgary.ca \
    --to=mirtchov@cpsc.ucalgary.ca \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).