thinman@netcom.com (Lance Norskog) (04/22/91)
- 33 - - 34 - 8. _P_r_i_m_i_t_i_v_e__C_l_a_s_s__L_i_b_r_a_r_y This is the first cut at basic tools I think I want for doing graphics work. It is in an extremely condensed pidgin. These are all built-in classes and methods, library classes are listed in the next section. / Root object (class ID=Object ) / Number class (class ID=Number super=Object / multi ops op Self +(Self, Self, multi Self) op Self *(Self, Self, multi Self) / binary op Self -(Self, Self) op Self /(Self, Self) / unary ops op Self -(Self) op Self sqrt(Self) op Self number(Boolean) / multi ops IS THIS THE RIGHT WAY TO DO THIS? / assignment op op Self Set(Self) ) / Angle definition - / Number modular around circle / Uses signed 2's complement arithmetic to implement clean / angular arithmetic. Going beyond 360 degrees rounds off / to beginning. If these are implemented with signed chars, / all trig becomes table lookups. Should complex numbers / subclass from Number or Angle? (class ID=Angle super=Number ) / get Graphics Gems book and figure out ops / probably nothing needs to be overidden from Number / Point class (class - 35 - ID=Point super=Number / creation op Point op Point(Number, Number, Number) / destruction ops Number op X(Point) Number op Y(Point) Number op Z(Point) / binary ops Point op +(Point, Point) Point op -(Point, Point) Point op *(Point, Number) Point op *(Number, Point) Point op *(Point, Matrix) Point op *(Matrix, Point) Point op Distance(Point, Point) / unary ops Point op -(Point) Point op sqrt(Point) Point op normalize(Point) Point op +(Point, Point, multi Point) ) / Matrix class - 4x4 matrix for general 3-space xlations / Do quaternions completely supercede this? ( class ID=Matrix super=Number / creation op Matrix op Matrix(Number, Number, Number, ..., Number) / 16 Matrix op Matrix(Point, Point, Point, Point) / 4x3 / binary ops Matrix op *(Matrix, Matrix) / unary ops Matrix op invert(Matrix) Number op determinant(Matrix) Matrix op normalize(Matrix) Matrix op transpose(Matrix) ) / random numbers. Deliver a number between 0 & 1. ( class ID=Random super=Number ) / builtins: all the generators I can get with different distributions. / Raid Knuth for algorithms. - 36 - / Range class / A range is a pair of numbers. The first must be lower than the second. (class ID=Range super=Number / creation op Range op Range(Number, Number) / destruction ops Number op Lower(Range) Number op Upper(Range) / binary ops / Range op +(Range, Range) / do these make sense? / Range op -(Range, Range) Range op Shift(Range, Number) / shift range up or down Range op Scale(Range, Number) / expand/contract range / in Dataset, shift and expand/contract are 'shift' and 'slide' ops ) / Boolean class (class ID=Boolean super=Object / multi ops op and(Boolean, multi Boolean) op nor(Boolean, multi Boolean) op xor(Boolean, multi Boolean) / unary ops op Boolean not(Boolean) op Boolean boolean(Number) op Boolean change(anything) / when input changes, become true / assignment op op Self Set(Self) ) / built-in Booleans stereo / system is drawing in stereo mode - rw left_eye / system is updating left or right eye - ro out_of_ram / running on empty: do something! - ro input_changed / an input value to this operator changed - ro switch1 / supplied hardware or window system switch2 switch3 switch4 / Address of a node / This class needs to be here to provide a specific type for / indirect references to nodes. (class - 37 - ID=Address super=Object ) / Error class: error exception handler ( class ID=Error super=Object / On error #N, execute a program / Scoped for all siblings of this node and their descendants. ( Self op Self(Number, Void)) / get error ( Self op Self(Number, Void, Void)) / get error with message / Should the error number be a property? / If not specified, default to all? ( Self op Raise(Number)) / make error ( Self op Raise(Number, Void)) / make error with message ) / Void object / Various miscellaneous uses : rename it Glue? Clump? (class ID=Void super=Object (property // call all inputs in order, or simultaneously? ID=ordered type=Boolean inherited=False ) (property // when to execute ID=execute type=Boolean ) (property // copy tree or evaluate tree and copy value ID=evaluate type=Boolean ) / clump of nodes (op Void call( multi type=anything )) / do all / conditional (op Void cond( Boolean, type=anything, type=anything)) / if then else / tree surgery operation- can only rearrange at void "cut-points" / replace tree at address with tree void (op Void replace( Address type=Void), Void) / add tree to Void call op: add to collection (op Void add( Address(call) type=Void), Void) / maybe remove the most recently added tree? - 38 - / top of World (op Void World( Void)) / top of world - visibility box / This is very goofy. I don't like what it does to / tree storage at all. / copy value of property from address to address (op Void Setprop( Address (property name=xxx), Address (property name=xxx) ) / copy values of all properties from address to address (op Void Setprop( Address (property name=xxx), Address (property name=xxx) ) ) / Unknown class / internal data of unknown format / used for things like network addresses, etc. / not manipulable, just there. ( class ID=Unknown super=Object ) / Dataset class / data array abstract superclass (class ID=Dataset super=Object (property ID=dimensions type=Number ) (property ID=indexable type=Boolean ) (property ID=fractional type=Boolean ) / OR /(property / ID=indexing / type=Enum(none,integer,fractional) /) / series of ranges for each dimension (property ID=infinite - 39 - type=Boolean ) (property ID=range0 type=Range ) / type of data held (property ID=datatype type=Address ) / shift data up or down by factors (op Self Shift(Self, Number, ...)) / stretch or shrink indices by scale factors (op Self Scale(Self, Number, ...)) / concatenate two datasets to create a new one / they must have the same dimensionality, ranges, & types (op Self concat(Self, Self)) ) / real datasets you can use / HDF scientific data set - NCSA HDF format - or abstract superclass as / is deemed appropriate by sci-vis people. / / I have the HDF spec but haven't studied it much. ( class ID=HDF super=dataset ) / linear numerical set ( class ID=Linear / spectrum? 1D? super=Dataset ) / random numbers? I don't get it! / ( class / ID=Random / super=Linear / ) / Array / 2D or 3D array of equally spaced data points / may be formulaically derived (infinite=True). Fractionally indexable / (usually). ( class ID=Texture - 40 - super=Dataset (property ID=indexable type=Boolean value=True ) ) / bitmap - 2D monochrome Texture ( class ID=Bitmap super=Texture ( property ID=Dimension type=Number value=2 ) ( property ID=Size type=Box ) ) / pixmap - 2D color Texture ( class ID=Pixmap super=Texture ( property ID=Dimension type=Number value=2 ) ( property ID=Size type=Box ) ) / body - 3D color Texture - throughcut woodgrain etc. / I've forgotten the special name for this, if there was one ( class ID=Body super=Texture ( property ID=Dimension type=Number value=3 ) ) / Drawable object - 41 - / visible screen object abstract superclass (class ID=Drawable / for now, all the graphics you get. (property ID=color type=Point ) / used for selecting several representations based on screen size / (that is, distance from user) / If this property is set, it overrides 3D placement stuff below. / If not set, it reflects the 3D placement stuff below. (property ID=screenbox type=Box ) / when is this object to be drawn? (property ID=execute type=Boolean ) / coordinate frame. / I thought I was using quaternions? Boy, am I confused. (Property ID=frame Type=Point ) / xlate, scale, rotate operations (op Self Scale(Self, Number X, Y, Z)) (op Self Xlate(Self, Number X, Y, Z)) (op Self Rotate(Self, Point Center, ???)) / collection of drawables, inherit props from here (op Drawable call(Drawable, multi Drawable)) / should be drawable? ) / Line ( class ID=Line Super=Drawable (Self op Self(Point, Point)) / two endpoints / Connect creates a line vertex (Self op Vertex(Point, Point)) / connector: allow painted textures ) / Triangle ( class - 42 - ID=Triangle Super=Drawable (Self op Self(Point, Point, Point)) / three endpoints / Two triangles connect via a hinge (op Self Hinge (Point, Point)) / Allow spray-painted textures / should hinge be self or void? / hinge will usually use pointers ) / Circle ( class ID=Circle Super=Drawable (Self op Self(Point, Number)) / Center, radius / does connecting a circle make sense? At given points? ) / Sphere ( class ID=Line Super=Drawable (Self op Self(Point, Number)) / Center, radius / does connecting a sphere make sense? At given points? ) / Don't hold your breath waiting for support for the following... / Patch / ( class / ID=Patch / Super=Drawable / / / hellifino / ) / Patch:Bezier ( class / ID=Bezier / Super=Patch / / / hellifino / ) / Quadric / ( class / ID=Quadric / Super=Drawable / / (Self op Self()) / Equation inputs - 43 - / (Self op Connect()) / Connect not allowed / ) / Superquadric / ( class / ID=Line / Super=Drawable / / (Self op Self()) / equation inputs / (Self op Connect()) / Connect not allowed / ) / / Painted drawable object / Overlay 2D or 3D Drawable with 2D or 3D texture / Here we have the classic Trouble With Objects: doing a whole damn / class definition just to make two different things interact. ( class ID=Painted Super=Drawable Super=Texture / is this image sampled or just a flat bitmap? / real-time bitmaps will require the Intel DVI stuff or similar. / flat bitmaps are useful for hypertext / This can also be stroked Hershey fonts. ( property ID=flat type=Boolean ) (op Apply(Texture, Drawable)) ) / Built-in textures are 2D: granite, 3D: wood. / The apply operator re-runs the texturing operation with a new random / seed, to get a new texture. / Physical object / bounding-box physics abstract superclass. (class ID=Physical super=Object / motion (property ID=direction type=Point ) (property ID=force type=Number - 44 - ) / spin (property ID=rotation_axis type=Point ) (property ID=angular_momentum type=Number ) ) // Box definition - used for physical and screen bounding boxes (class ID=Box input Point lower, upper (op Point ID=Lower(Box)) (op Point ID=Upper(Box)) (op Number ID=MinDist(Box)) (op Number ID=MaxDist(Box)) ) / Quaternion class / used in 3D rotation & placement work (class ID=Quaternion super=Number / creation op Quaternion op Quaternion(Number, Number, Number, Number) / destruction ops Number op X(Quaternion) Number op I(Quaterion) Number op J(Quaterion) Number op K(Quaterion) / binary ops / go get the book, I don't know about these operations Quaterion op +(Quaterion, Quaterion) Quaterion op -(Quaterion, Quaterion) Quaterion op *(Quaterion, Number) Quaterion op *(Number, Quaterion) Quaterion op *(Quaterion, Matrix) Quaterion op *(Matrix, Quaterion) Quaterion op Distance(Quaterion, Quaterion) / unary ops Quaterion op -(Quaterion) Quaterion op sqrt(Quaterion) Quaterion op normalize(Quaterion) ) - 45 - / I/O port abstract superclass ( class ID=IO super=Object ( property ID=readable Type=Boolean ) ( property ID=writeable Type=Boolean ) ( property ID=evaluate type=Boolean ) ( Self op Self ) / notification op to alert handler ( Boolean op New (Self)) ) / MIDI I/O port class- superclass only? It seems to be useless by itself. ( class ID=MidiPort Super=IO readable=True writeable=True ) / Speaker I/O port class- superclass only? It seems to be useless by itself. / Not a loudspeaker, but a separate abstract noise-making entity. ( class ID=SoundChannel Super=IO ( property ID=Position Type=Point ) ( property ID=Volume Type=Number ) ) / Absolute one-directional input from 0 to 1 - 46 - / A Slider itself is a number, but it inherits the New / An analog joystick is two Sliders. ( class ID=Slider Super=IO Super=Number readable=True writeable=False (Number op Value(Self)) ) / Relative one-directional input from 0 to 1 / A Delta itself is a number, but it inherits the New / A mouse is two Deltas. / An Nintendo joystick is two Deltas, using relative motion and an / auto-acceleration input. ( class ID=Delta Super=IO Super=Number readable=True writeable=False (Number op Value(Self)) ) / Switch ( class ID=Switch Super=IO Super=Boolean readable=True writeable=False (Boolean op Value(Self)) ) / sound bite ( class ID=SoundSample super=Linear super=SoundChannel (op Play(SoundSample, Speaker)) (op Record(Speaker, SoundSample)) / the use of the when-executed property to start and stop is a hack ) - 47 - / sound synthesizer patch: hardware-dependent. / With Csound, an LPC parameter set. ( class ID=SoundPatch super=Linear super=SoundChannel (op Play(SoundPatch, Speaker)) / the use of the when-executed property to start and stop is a hack ) / MIDI sound file ( class ID=MidiSeq super=Dataset super=MidiPort / one dimension, indexable (op Play(MidiSeq, MidiPort)) / play Midi sequence out (op Record(MidiPort, MidiSeq)) / real-time capture? good trick! / the use of the when-executed property to start and stop is a hack ) / Network port abstract superclass ( class ID=Network super=Object / This port has a unique channel number within the deck ( property ID=Channel type=Number writeable=False ) / This protocol has guaranteed delivery ( property ID=Reliable type=Boolean writeable=False ) / This protocol has ordered delivery ( property ID=Ordered type=Boolean writeable=False ) / constructor & destructor ops / A network port's children are the most recent / incoming and outgoing trees which went across the net. / Void nodes are used as compartmental "cut-points". - 48 - ( Self op Self (Void outgoing, incoming)) ( Self op In (Self)) ( Self op Out (Self)) / send & receive programs / usually, the port is accessed via a Refer node ( Void op Send (Self, Void)) ( Void op Receive (Self, Void)) / notification op to alert handler ( Boolean op New (Self)) ) / Virtual circuit port abstract superclass ( class ID=VirtualCircuit super=Network / Inherit channel number / This port initiates or accepts connections ( property ID=Initiate type=Boolean writeable=False ) ) / Datagram port abstract superclass ( class ID=Datagram super=Network ) / TCP/IP UDP network port / 5D program directly in UDP packet, no intermediate protocol layer / A channel number is a UDP port number. It is assigned by the deck / when the program is digested. The deck must upload the tree with / the network object to an application to inform the application what / the subsidiary port number is. ( class ID=UDP super=Datagram / other host IP & Port number ( property ID=OtherIP type=Unknown / magic secret data type / value will be a text string, with format for RFC xxx / proto-assigner ) ) - 49 - / TCP/IP TCP network port / 1 port # per channel ( class ID=TCP super=Network / other host IP & Port number ( property ID=OtherIP type=Unknown / magic secret data type / value will be a text string, with format for RFC xxx / proto-assigner ) )