From theseas!Princeton.EDU!cek Mon, 18 Jul 94 15:48:55 EET
Received: by kriton.UUCP (V1.17-beta/Amiga)
	  id <03rm@kriton.UUCP>; Mon, 18 Jul 94 15:48:55 EET
Received: by theseas.ntua.gr with UUCP; Mon, 18 Jul 1994 11:32:18 +0300
Received: from nemesis.ics.forth.gr (nemesis.csi.forth.gr) by pythia.ics.forth.gr via FORTHnet with SMTP;
	id AA12257 (5.65c/FORTH-ICS-3.0-MHS-7.0); Mon, 18 Jul 1994 10:47:55 +0300
Received: from eunet.EU.net by nemesis.ics.forth.gr via FORTHnet with SMTP;
	id AA22833 (5.65c/ICS-1.1); Mon, 18 Jul 1994 10:39:39 +0300 (EET DST)
Received: (uunet@localhost) by eunet.EU.net (8.6.8/8.6.4) with UUCP id JAA16753 for ariadne!theseas!kriton!kyrimis; Mon, 18 Jul 1994 09:35:27 +0200
Received: from Princeton.EDU by relay1.UU.NET with SMTP 
	(relay) id QQwzba02762; Mon, 18 Jul 1994 03:32:30 -0400
Received: from fs.Princeton.EDU by Princeton.EDU (5.65b/2.111/princeton)
	id AA17932; Mon, 18 Jul 94 03:29:13 -0400
Received: by cs.Princeton.EDU (4.1/1.105)
	id AA00261; Mon, 18 Jul 94 03:29:12 EDT
Received: from iraun1.ira.uka.de by cs.Princeton.EDU (4.1/1.105)
	id AA00175; Mon, 18 Jul 94 03:28:50 EDT
Received: from i44ms.ira.uka.de by iraun1.ira.uka.de with SMTP (PP);
          Mon, 18 Jul 1994 09:28:08 +0200
Received: from i44s15.ira.uka.de (i44s15.ira.uka.de [129.13.14.26]) 
          by i44ms.ira.uka.de (8.6.4/8.6.4) with ESMTP id NAA00609;
          Fri, 15 Jul 1994 13:55:04 +0200
Received: from localhost (tmueller@localhost) 
          by i44s15.ira.uka.de (8.6.4/8.6.4) id NAA25503;
          Fri, 15 Jul 1994 13:55:01 +0200
Organization: Institute of Computer Science, 
	Foundation for Research and Technology-Hellas (FORTH)
	P.O.Box 1385,
	GR 711 10 Heraklion, Crete, Greece        
	tel.: +30 (81) 39 16 00,  fax: +30 (81) 39 16 01
Date: Fri, 15 Jul 1994 13:55:01 +0200
Message-Id: <199407151155.NAA25503@i44s15.ira.uka.de>
X-Organization: IPD Universitaet Karlsruhe Vincenz-Priessnitz-Strasse 1 D-76131 
                Karlsruhe
X-Phone: +49-721-608-6087
X-Fax: +49-721-691462
Reply-To: tmueller@ira.uka.de
Errors-To: rayshade-users-request@cs.Princeton.EDU
Remailed-Date: Mon Jul 18 03:28:54 EDT 1994
From: Thomas Mueller AKA Howie <tmueller@ira.uka.de>
To: rayshade-users@cs.Princeton.EDU
Subject: csg with more then 2 objects

Hi!

Finally I was so tired of writing those deeply nested csg specifications that
I have fixed the problem.  If you want this too, simply replace the function
CsgConvert in libray/libobj/csg.c with the code at the end of this mail.

The new version of CsgConvert transforms a construct like

union obj1 obj2 obj3 end

into

union union obj1 obj2 end obj3 end

in terms of internal data structures.

Thomas

----8<--------8<--------8<--------8<--------8<--------8<--------8<----
int
CsgConvert(csg, list)
Csg *csg;
Geom *list;
{
	static int OpenAdvised = FALSE;
	int prims = 0;

	if (!list || !list->next) {
		RLerror(RL_WARN, "CSG needs at least two objects.\n");
		return 0;
	}
	/*
	 * Things are put into lists backwards....
	 */
	csg->obj2 = list;
	if (!list->methods->closed && !OpenAdvised) {
	  RLerror(RL_ADVISE, "Performing CSG with non-closed object(s).\n");
	  OpenAdvised = TRUE;
	}
	prims += list->prims;
	list = list->next;
	while (list->next) {
	  csg->obj1 = GeomCsgCreate(csg->operator);
	  csg = (Csg*)csg->obj1->obj;
	  csg->obj2 = list;
	  if (!list->methods->closed && !OpenAdvised) {
	    RLerror(RL_ADVISE, "Performing CSG with non-closed object(s).\n");
	    OpenAdvised = TRUE;
	  }
	  prims += list->prims;
	  list = list->next;
	}
	csg->obj1 = list;
	if (!list->methods->closed && !OpenAdvised) {
	  RLerror(RL_ADVISE, "Performing CSG with non-closed object(s).\n");
	  OpenAdvised = TRUE;
	}
	prims += list->prims;

	return prims;
}

----------
Administrivia: rayshade-users-request@cs.princeton.edu
Mailing list: rayshade-users@cs.princeton.edu

