Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!van-bc!ubc-cs!uw-beaver!zephyr.ens.tek.com!tekcrl!brucec From: brucec@phoebus.phoebus.labs.tek.com (Bruce Cohen;;50-662;LP=A;) Newsgroups: comp.object Subject: Re: Should objects draw themselves? Message-ID: Date: 17 Aug 90 00:46:30 GMT References: <12873@rouge.usl.edu> <77500047@m.cs.uiuc.edu> Sender: news@tekcrl.LABS.TEK.COM Organization: Tektronix Inc. Lines: 60 In-reply-to: johnson@m.cs.uiuc.edu's message of 9 Aug 90 12:24:00 GMT In article <77500047@m.cs.uiuc.edu> johnson@m.cs.uiuc.edu writes: > > When life gets even more complicated, I fall back on the "mechanism, not > policy" advice that was given earlier. Complex behavior requires complex > designs, and 3D graphics requires other objects to represent things > like perspective. I'd go even farther than this in separating the objects used in graphics, especially 3D. First off, it's very useful to distinguish between "physical" objects, "geometric" objects and "graphic" objects. Physical objects have attributes like mass, surface reflectivity, elasticity, etc, and they know how to react to forces applied to them and light shown on them. They used in physically-based models as the elements of complex mechanically-correct mechanisms. Geometric objects have attributes like shape and size, and they know how to group together and modify each other (for instance Constructive Solid Geometry objects or differential manifolds). They are used to model geometric relations, and as the parts from which physical objects derive their notions of shape and size. Graphic objects have attributes like color, and they know how to display themselves. They are used to build scenes which can be viewed. They are the objects which geometric objects use for display. Example: say I have a geometric object which models a rubber ball. It has a certain mass, represented by a scalar, and a certain elasticity, represented (in general) by a tensor field. The ball has a geometric object which it uses when it is concerned with shape and size. It could if it wanted to, make that object a sphere in the relaxed state, and change to a more general ellipsoid only if stressed. This provides some decoupling between the physical model and the geometry used to model it. Now the physical object is asked to draw itself. It passes the request on to the geometric object, which has a set of of graphic objects it can tell to draw. It might have one graphic object: a sphere, or several: a collection of flat facets. These graphic objects in turn might have different ways to draw themselves depending on the type of display, etc. Now I agree, I've put some policy in the graphic objects, which sounds bad. But on the other hand, I've insulated the physical model programmer from the graphics completely. In a practical system, the graphic objects would be provided as low-level system utilities, to be reused by any application programmer. While I haven't seen any papers on this sort of thing, I expect to see some in the near future; I know of several people who've looked into it in the past couple of years. --------------------------------------------------------------------------- NOTE: USE THIS ADDRESS TO REPLY, REPLY-TO IN HEADER MAY BE BROKEN! Bruce Cohen, Computer Research Lab email: brucec@tekcrl.labs.tek.com Tektronix Laboratories, Tektronix, Inc. phone: (503)627-5241 M/S 50-662, P.O. Box 500, Beaverton, OR 97077 -- --------------------------------------------------------------------------- NOTE: USE THIS ADDRESS TO REPLY, REPLY-TO IN HEADER MAY BE BROKEN! Bruce Cohen, Computer Research Lab email: brucec@tekcrl.labs.tek.com Tektronix Laboratories, Tektronix, Inc. phone: (503)627-5241 M/S 50-662, P.O. Box 500, Beaverton, OR 97077