Visual Simulation of Lightning Todd Reed and Brian Wyvill The University of Calgary1 ABSTRACT A method for rendering lightning using conventional raytracing techniques is discussed . The approach taken is directed at producing aesthetic images for animation , rather than providing a realistic physically based model for rendering . A particle system is used to generate the path of the lightning channel , and subsequently to animate the lightning . A technique , using implicit surfaces , is introduced for illuminating objects struck by lightning . CR Categories : I. 3.3 -LSB- Computer Graphics -RSB- : Picture/Image Generation ; I. 3.7 -LSB- Computer Graphics -RSB- : Three-Dimensional Graphics and Realism , Animation . 1 INTRODUCTION The synthetic reproduction of natural scenes has been a primary goal of the computer graphics community . Much attention has been given to the problem of rendering plant life , mountainous terrain , clouds , fire , etc. . Surprisingly , lightning , one of nature 's most spectacular phenomena , has been largely ignored . This paper presents a simple method for modeling and rendering lightning and objects struck by lightning , using raytracing techniques . Lightning is represented as a collection of connected , finite length rays in 3D space . A particle system is used to generate the segments for a complete lightning stroke , and subsequently for animating a lightning strike . For some time we have been working on skeletalimplicit surface modeling techniques and have built a number of models -LSB- 7 -RSB- . Such models are represented as an iso-surface in a scalar field . A method is presented for using the scalar field to provide a value for the brightness of the glow around an object that has been struck by lightning . The best understood source of lightning is cumulonimbus , ordinary thunderstorm clouds . The majority of cloud related lightning discharges are intracloud , and are not visible from earth . Visible types of discharges include cloud-to-cloud , cloud-to-air , ground-to - 1Department of Computer Science , The University of Calgary , 2500 University Drive NW , Calgary , Alberta , Canada T2N 1N4 , E-mail : reedt@cpsc.ucalgary.ca, blob@cpsc.ucalgary.ca cloud , and cloud-to-ground2 . Research on lightning has focused on the familiar cloud-to-ground lightning for the practical reason of minimizing its damaging effect on our environment . This interaction with our environment is also what makes cloud-to-ground lightning so visually stimulating . Photographs of lightning strikes that encounter ? ground zero ? are among the best3 -LRB- see Figure 9 -RRB- , and provided the inspiration for rendering lightning . Research in physically based lightning models has been reported -LRB- see -LSB- 2 -RSB- , for example -RRB- . However , the mathematical complexity and the numerous parameters required to describe the complete lightning environment make these models impractical for the computer artist . The primary goal of this research is to produce visually realistic images of lightning with minimal complexity and computational cost . Hence , the technique developed in this paper does not attempt to model cloud physics , atmospheric conditions , or the physics of lightning discharges . Photographs of lightning from -LSB- 4 , 5 -RSB- provided a yardstick for measuring the accuracy of the images produced . 2 A TYPICAL LIGHTNING STRIKE Eventhough our model is not physically based , a short discussionof lightning physics is essential to introduce terminology and concepts . A typical -LRB- negative -RRB- cloud-to-ground lightning strike is initiated within a cloud that is positively charged in its upper region , and negatively charged in its lower region ; sparse positive charges also occupy the lowest region of the cloud -LRB- see Figure 1 -RRB- . The stepped leader , a negative stream of electrons , propogates toward ground zero in discrete steps . The stepped leader itself is initiated by an unknown process termed the preliminary breakdown -LRB- a -RRB- . The descending stepped leader forms a jagged and branching channel , still invisible , that attracts an upward positive leader from the ground , thus starting the attachment process -LRB- b -RRB- . The meeting of the downward and upward leaders triggers the first return stroke , which is responsible for illuminating the channel , and creating thunder -LRB- c -RRB- . The return stroke begins at the point of contact between the downward and upward leader , usually close to the ground . If sufficient charge remains in the cloud , dart leaders may travel through the residual channel and create subsequent return strokes -LRB- d -RRB- . A lightning strike will typically have less than five return strokes , but can have many more . Returns strokes subsequent to the first usually do not illuminate branches off the main channel . The entire discharge , termed a flash , lasts about half a second . 2If you happen to be a shuttle astronaut , include cloud-to-space lightning in this list of visible discharges . On April 28 , 1990 , a cloud-to-space discharge was recorded for the first time by a payload-bay camera aboard the space shuttle . See -LSB- 6 -RSB- for details . 3See -LSB- 4 -RSB- for an excellent collection of lightning photographs . Stepped leader + + + + + + + + + + - -- + + + -- -- Upward positive leader + + + + + + + + + + - -- + + + -- -- + + + + + + + + + + + + + + + + + + + + - -- + + + -- -- Dartleader -LRB- a -RRB- -LRB- b -RRB- -LRB- c -RRB- -LRB- d -RRB- -- - -- + + + -- - Figure 1 : A lightning flash . The above description is admittedly scant . Readers interested in the physical details of the lightning phenomena are referred to -LSB- 5 -RSB- . 3 LIGHTNING MODEL The skeletal structure of lightning is generated by a particle system which simulates the stepped leader progression toward ground zero . Starting with a seed segment -LRB- in the clouds -RRB- , new segments are spawnedand randomly rotated about the seed segment . Always rotating children segments with respect to the initial seed segment guarantees the channel assumes a linear shape4 . The segments are concatenated to form a complete channel . Enough segments are generated so that the main channel hits ground zero . During the leader progression , branches are recursively generated . Branches are allocated a number of segments , chosen from a uniform distribution , and grow until its segments are depleted , or ground zero is encountered . Uman reports that the directional changes between successive channel segmentsare randomly distributed , independentof segment length , with a mean absolute value of about 16 degrees -LSB- 5 -RSB- . This is simulated by rotating non-seed segments ? degrees with respect to the seed segment , where is chosenfrom a normal distribution with mean 16 degrees and variance of about 0.15 . In three dimensions , two rotations in orthogonal planes are required . Segment lengths 4Lightning usually obeys the philosophy that the shortest path is the best path , so most channels are linear . Nonetheless , it is not difficult to find photographs showing channels of irregular shape . 5The variance was experimentally determined . are chosen from a uniform distribution ; segment lengths reportedly vary from less than 1 metre to over 1 kilometre . For the purpose of rendering , small segments provide more visually realistic results . Branching is controlled by a probability function . From the main channel , branching is usually more frequent near the ground . In practice , the erratic behavior of the pseudo-randomnumber generator used6 made it difficult to consistently control branching . The lightning strokes generated were very sensitive to the seed selected for the number generator . Some seeds completely eliminated branching , while others produced excessive branching -LRB- see Figure 2 -RRB- . Figure 2 : Various lightning skeletons obtained with different seeds for the pseudo-random number generator . 4 RENDERING Although conventional raytracing techniques are used for rendering , the line-segment representation of lightning prevents us from treating lightning strokes as geometric objects . The usual shading methods employed by raytracers are inappropriate because lightning does not have a definable surface . The proposed shading method modifies the conventional shading algorithm by adding a color contribution from the lightning . For each ray , r , the following shading calculation is made : Itotal > = = X i Ii > = Ii > = = mi > = exp ? ? ? di wi > = ? ni > = ? -LRB- 1 -RRB- where ffl > = is the wavelength -LRB- red , green or blue -RRB- . ffl Ii > = is the light contribution from segment Si for wavelength > = . ffl mi > = ffl -LSB- 0 ; 1 -RSB- is the maximum value of Ii > = ffl di is the shortest distance between the ray r and the segment Si . ffl wi > = > is half the width of the lightning channel segment Si . If di > wi > = , then Ii > = is essentially zero . ffl ni > = > 1 controls the contrast of the lightning channel with respect to the background . Small values of n create fuzzy lightning channels , and large values -LRB- n > 8 -RRB- create sharp lightning channels . 6The random number generator and distributions used are from GNU 's libg + + . Most photographs of lightning show a strong glow surrounding the main channel of the lightning stroke . Reproducing this effect is achieved by a secondary illumination function which is added to equation 1 : Gtotal > = = X i Gi > = -LRB- 2 -RRB- Gi > = = g > = li exp ? ? ? di W ? 2 ? -LRB- 3 -RRB- where ffl Gi > = is the glow light contribution for wavelength > = . ffl g > = is the maximum value of Gi > = . ffl li ffl -LSB- 0 ; 1 -RSB- is a ? life ? factor that describes the brightness of segment Si . ffl W is half the width of the glow -LRB- when l = 1 -RRB- . ffl di is the shortest distance between the ray r and the segment Si . The left-most image of Figure 5 was generated with equation 1 ; the second and third images show the effect of adding a blue and red glow with equation 2 to the lightning channel . The calculation of di -LSB- 3 -RSB- for each segment Si is a computational bottleneck . By generating the lightning in a plane parallel to the view plane , the rendering process can be optimized by simplifying the calculation of di . If L is the plane containing the lightning stroke to render , and p is the point where the ray r intersects L , then let di be the shortest distance between the segment Si and the point p. Using this technique , rendering time can be reduced by a factor of 2-5 . While a boon to the time conscious artist , this method has the disadvantage of requiring the plane L to be oriented perpendicular to the line of sight . For the purposes of animation , the more general approach is adopted , thus allowing free motion of the camera . As the particle system proceeds , appropriate values for m , w , n , and l are assigned to each segment . Seed values for m , w , and n are input parameters , and l is automatically initialized to 1 . For the main channel , the width attribute , w , is fixed for all segments , thus maintaining a uniform thickness for the entire channel . To simulate the gradual narrowing of branches , w = :95 wpredecessor for branch segments . For a primary branch seed segment7 , w = cwparent , where cffl -LSB- a ; b -RSB- is chosen from a uniform distribution , and < a < b < 1 . Branches off the main channel are consistently less than half as thick as the main channel , so b < :5 is appropriate . For branch seeds not attached to the main channel , w = wparent . The ? life ? factor , l , which controls the glow around a segment , is modified in a similar fashion , except for all branch seeds , l = c2lparent , where c is defined as above . All segments share the same values for m and n. 5 MAKING LIGHTNING A LIGHT SOURCE Employing the method described aboveproduces realistic lightning images which provide a good background for raytracing scenes . However , if other objects surround the lightning channel , then the lightning must behave as a light source . An expensive , but adequate solution is to add line-segment light sources to each segment . The light source for segment Si is scaled by li , so that the main channel contributes more light than the branches . When calculating the 7A branch off the main channel . light contribution from segment Si to point p on some object the light intensity is attenuated by the scalar 1 = d2i , where di is the shortest distance between Si and p ; this attenuation factor prevents the lightning from illuminating distant objects . 6 ANIMATION A single lightning flash , lasting about 0.5 seconds , is composed of at least one return stroke , and possibly subsequent return strokes . Each return stroke is identified by a surge of light illuminating the channel . The first return stroke illuminates the main channel and the branches , while subsequent return strokes typically illuminate only the main channel . Numerous return strokes account for the flickering of lightning . This can be simulated by appropriately modulating the attributes li and mi over time . For animation , additional attributes are assigned to each segment : ffl the age of the segment -LRB- one unit of time = one frame -RRB- ffl the branch level -LRB- 0 for the main channel , 1 for branches off the main channel , etc. -RRB- ffl the position of the segment within a branch -LRB- 0 for the first segment , 1 for the next segment , etc. -RRB- The particle system used for generating the segments is extended to account for time . The animation of a lightning strike is done in two distinct phases : Progression In this phase , the lightning is initiated from a seed segment , and propogates toward ground zero , as described above . Traveling up to 160,000 kilometres per hour , the appearance of a lightning stroke is instantaneous to the human eye . However , for an animation , this gives unsatisfactory results . Recall that a lightning channel is not illuminated until the first return stroke is initiated by the contact of the downward and upward leaders . Rather than replicate this process , we have adopted to illuminate the channel as it progresses toward the ground . This technique , although not physically accurate , is effective for animation because it agrees with people 's intuition of how lightning should appear . Regression The flickering of lightning is a result of multiple return strokes down the main channel -LRB- but not the branches -RRB- . To simulate this effect , a positive , decaying , sinusoidal function is used to calculate the intensity of main-channel segments for each frame . The intensity of branch segments decreases monotonically . To enhance the visual impression of a lightning stroke , we have doubled the time duration of a typical flash to one second , or 30 frames . Figure 6 shows selected frames from a lightning animation . The first five images correspond to the progression stage , and the last image starts the regression phase . 7 GLOWING OBJECTS The visual effects of lightning striking an object depend on a number of factors , such as the shape of the object , the material from which it is made , etc. . Since our goal is to provide a reasonable visual impression of lightning , particularly for animation , making an object glow when it is struck is sufficient for our purposes . Since we already have a skeletal implicit surface system , a value for the glow can be obtained directly from the field in which such models are defined . Readers unfamiliar with implicit surface modeling are directed to -LSB- 1 , 7 -RSB- . Given a scalar field defined by the implicit function F , an implicit surface is defined by the set of points fp : F -LRB- p -RRB- = kg , where kffl -LRB- 0 ; 1 -RRB- is a chosen constant . For a non-trivial model , F is the aggregate of several fields , each associated with a primitive skeletal element . The train and coach in Figure 6 , for example , are composed of several ellipsoids , each with its own field , Fi . Hence , the surface of the train is defined by the implicit function F -LRB- p -RRB- = N X i = 1 ciFi -LRB- p -RRB- -LRB- 4 -RRB- where N is the number of ellipsoids , and ci is a scalar value used to adjust the contribution of Fi . In our system , k is conventionally :5 . Thus , if F -LRB- p -RRB- < :5 , p is outside the surface , and if F -LRB- p -RRB- > :5 , p is inside the surface . The objective is to make the field between the surfaces defined by fp : F -LRB- p -RRB- = :5 g and fp : F -LRB- p -RRB- = :0 g glow ; the latter surface , the zero-contour , defines the outer extent of the glow . For each ray r spawned by the raytracer , the closest point on r to each primitive is found , giving N points , p1 ; p2 ; : : : ; pN . For each point pi , the implicit value vi = Fi -LRB- pi -RRB- is calculated . The largest vi , vmax , is used to calculate the brightness of the glow as follows : G > = = m > = v0 -LRB- 5 -RRB- where v0 = -LRB- if vmax < k if vmax > k vmax otherwise -LRB- 6 -RRB- and m > = ffl -LSB- 0 ; 1 -RSB- are scalars controlling the intensity of independent wavelengths . If m > = = g > = -LRB- from equation 3 -RRB- , then the glow around the implicit surface will coincide with the lightning channel glow , if this is desired . Figure 7 illustrates the glowing effect on two spherical implicit surfaces blending . The animation frames in Figure 6 show lightning striking the train 's coach , causing it to glow . The advantage of using implicit surface models is that the glow can be calculated directly from the field as shown above . However , the technique can produce undesirable results in certain instances . Problems arise when the zero-contour surface , which defines the edge of the glow , does not faithfully follow the k-contour surface , which defines the model . This problem is especially evident when negative primitives , obtained by setting ci in equation 4 to a negative value , are used . 8 CONCLUSION We have presented a workable model of lightning , which produces aesthetic images sufficient for most animation requirements . Our lightning model takes account of the following features of real lightning : ffl Accurate shape according to statistical data available . ffl The glow around lightning which is often observed . ffl Glow around objects that are struck -LRB- provided that they are modeled as implicit surface objects -RRB- . ffl Lightning as a light source . The following points still require further attention : ffl Implementing a physically based model and formalizing the branching algorithm used to generate lightning channels . ffl Improving the appearance of objects struck by lightning ; investigating further how glowing objects can be modeled with implicit surfaces . ffl Improving rendering time . 9 ACKNOWLEDGEMENTS We would like to thank the members of the GraphicsJungleresearch lab at the University of Calgary and the support of the computer science department . We would also like to thank Andrew Glassner of Xerox PARC for his encouragementand advice . Thanks go to all those who have contributed to Rayshade development , particularly Craig Kolb and Rod Bogart , at Yale and Princeton Universities respectively . This work is partially supported by the Natural Sciences and Engineering Research Council of Canada . A LIGHTNING SPECIFICATION Figure 3 shows an example of the new commands added to the Rayshade input language to specify the lightning and glow around implicit surfaces . The contents of the file light.zap are shown in Figure 4 . The file train.soft is a binary file generated by the implicit surface editing system . This file contains the specifications of the skeletal elements which define the train model . / * Lightning specification * / lightning light.zap / * Implicit surface description for glow * / glow train.soft Figure 3 : An example of the new commands added to Rayshade for rendering lightning and glowing objects . REFERENCES -LSB- 1 -RSB- Jules Bloomenthal and Brian Wyvill . Interactive Techniques for Implicit Modeling . Computer Graphics , 24 -LRB- 2 -RRB- :109 ? 116 , 1990 . -LSB- 2 -RSB- L Dellera and E. Garbagnati . Lightning stroke simulation by means of the leader progression model . IEEE Transactions on Power Delivery , 5 -LRB- 4 -RRB- :2009 ? 22 , October 1990 . -LSB- 3 -RSB- Ronald Goldman . Intersection of Two Lines in Three-Space . Graphics Gems , page 304 , 1992 . Edited by David Krik . -LSB- 4 -RSB- William Newcott . Lightning , nature 's high-voltage spectacle . National Geographic , 184 -LRB- 1 -RRB- :83 ? 103 , July 1993 . Photographs by Peter Menzel . -LSB- 5 -RSB- Martin A. Uman . The Lightning Discharge . Academic Press , Inc. , 1987 . -LSB- 6 -RSB- O.H. Vaughan , R. Blackesleee , et al. . A cloud-to-spacelightning as recorded by the Space Shnuttle payload-bay TV cameras . Monthy Weather Review , 120 -LRB- 7 -RRB- :1459 ? 61 , July 1992 . -LSB- 7 -RSB- Brian Wyvill , Craig McPheeters , and Geoff Wyvill . Animating Soft Objects . The Visual Computer , 2 -LRB- 4 -RRB- :235 ? 242 , February 1986 . LIGHTNING -LRB- -- seed point POINT -LCB- 830.0,1150.0,3800.0 -RCB- , -- random number generator seed 2 , -- ground elevation , 1055.0 , -- initial value for w parameter VECTOR -LCB- 0.4 , 0.4 , 0.64 -RCB- , -- value for m parameter VECTOR -LCB- 0.7 , 1.0 , 0.7 -RCB- , -- value for n parameter VECTOR -LCB- 10.0 , 10.0 , 4.0 -RCB- , -- colour of glow COLOUR -LCB- 0.1 , 0.05 , 0.07 -RCB- , -- width of glow 3.84 , -- angle -LRB- in radians -RRB- and std . deviation -- for tortuosity -LRB- twist -RRB- of channel NORMAL -LCB- 0.179 , 0.1 -RCB- , -- length of each segment ; uniform -- distribution UNIFORM -LCB- 0.1 , 0.25 -RCB- , -- number of branch segments ; discrete -- uniform distribution DISC_UNIFORM -LCB- 10,20 -RCB- , -- angle of branches wrt -- parent segment ; UNIFORM -LCB- 0.18 , 0.75 -RCB- , -- width of branch relative -- to parent UNIFORM -LCB- 0.45 , 0.6 -RCB- , -- branch probability 0.025 , -RRB- Figure 4 : Sample input for lightning specification . images/e.bolts.ps Figure 5 : Various lightning images ; the left-most lightning image was generated without the additional glow . images/e.anim.ps Figure 6 : Selected frames from a lightning animation . images/e.peanut.ps Figure 7 : Glowing ? soft ? objects . images/e.water.ps Figure 8 : Lightning over a plane of water . Photo not available . Figure 9 : A real photograph of lightning striking a tree ; courtesy of Johnny Autery .

O O O B O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O B I O O O O O O O O B O O O O O O O B I O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O B O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B I O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O B O O O O O O O O O B O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O B O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O B O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O B O O O O O O O O O

computer graphics
implicit surfaces
lightning
raytracing


End User Controlled Interfaces : Creating Multiple View Interfaces for Data-Rich Applications ? Tyson R. Henry Department of Computer Science University of Arizona , Tucson AZ 85721 Scott E. Hudson College of Computing Georgia Institute of Technology , Atlanta , GA 30332-0280 University of Arizona Technical Report 92-04 Abstract Direct manipulation interfaces give the user the feeling that he is interacting directly with the data . This feeling is achieved by designing the interface to closely resemble the user 's mental model of the data . Thus the success of the interface depends on how closely it matches the user 's mental model : how closely the interface objects match and how closely the structure of the interface objects matches . Since the user 's mental model may depend on his current interests and the current data set , there is not always a single \ best '' structure for the interface . This is especially true in interfaces to applications with many data objects | data-rich applications . This paper presents techniques for creating flexible interfaces that allow the user to customize the structure of the interface . These techniques allow the user to restructure the interface so it matches his current interests and his current mental model of the data . 1 Introduction Direct manipulation interfaces provide the illusion of directly manipulating data objects -LSB- 9 , 15 -RSB- . This illusion is most often created by representing the data objects with graphical interaction objects that can be directly manipulated by the user . One of the main goals of direct manipulation interfaces is to increase the directness felt by the user | so the user feels he is interacting directly with the data and not with an interface . ? This work was supported in part by the National Science Foundation under grants CDA -LCB- 8822652 , and IRI -LCB- 9015407 . There are two important aspects of a user interface that contribute to its directness ; how closely the interface objects and the interface structure match the user 's mental model . However , all users do not always have the same mental model . Mental models may vary from user to user and may even depend on the user 's current interests and the current data set . Thus there is not always a single \ best '' structure for any given interface . The importance of the structure increases in interfaces that concentrate on the manipulation and exploration of large data sets | data-rich interfaces | because the data begins to predominate the interface . Not only does the structure become more important , the large number of interaction objects are more difficult to lay out on the screen . Unlike many interfaces , a data-rich interface may be used for the general exploration of data or for other poorly structured tasks that can not be well characterized in advance . In addition , multiple aspects of the data may need to be addressed simultaneously and multiple relationships between individual data items to be depicted . Finally , data-rich applications normally can not control the number and properties of most of the user interface components in advance | since these are derived from a dynamic data set . One approach to this difficulty is to present different views of the data for different purposes -LSB- 2 , 3 , 4 , 6 -RSB- . As a simple example , the Macintosh Finder interface normally depicts files as icons on the desktop . However , the user can optionally select from a small set of alternative textual views . Each of these views has advantages and disadvantages , and each supports some tasks better than others . By providing alternative views , the supported range of tasks increases and the interface becomes more useful . Unfortunately , presenting a small fixed set of views has limitations | particularly for exploratory tasks in which the user 's focus may change as the interaction progresses . To address these issues , this paper considers a more general approach to multiple view interfaces . This approach does not simply define a fixed set of views but provides the end-user with the capability to construct additional custom views . Clearly , not all end-users want or need to construct custom views . However , by giving sophisticated end-users the ability to create new views , the interface becomes more flexible and can be expanded to meet very specific needs or particular focuses . The basic idea behind this approach is to use a flexible layout mechanism to position the interaction objects within the interface . Providing the user with an interface to the layout mechanism allows him to create new views of the interface and customize them to meet their mental model and current interests . There are three basic mechanisms with which the user can customize the interface : choosing a specialized algorithm , adjusting parameters to the layout algorithm , and building a new algorithm . This approach stems from the authors ' previous work in interactive graph layout systems -LSB- 7 , 8 -RSB- . In these systems , a visual programming interface allows the user to interactively compose and manipulate custom graph layouts . This framework has been extended to include general layout composition of the kind found in a number of user interface toolkits -LSB- 12 -RSB- -LRB- although the examples used here still make heavy use of graph layout compositions since these are the most powerful and well developed -RRB- . The next section presents related work on flexible layout and multiple view interfaces . Section 3 will illustrate the use of multiple views in a spreadsheet application and Section 4 will demonstrate how views can be customized by the user to achieve a better interface for a very specific task . Finally , Section 5 will consider the the prototype implementation being used to explore these concepts , and Section 6 will provide a brief conclusion . 2 Related work Most user interfaces provide a static presentation of the interface | they do n't provide the end-user with any control over the structure of the interface . However , there are a few systems that allow the end-user to interactively control the structure . A few of these systems provided the basis for this research and are thus presented in this section . An example of an interface in which the structure of the display can be modified is the Cone Tree -LSB- 14 -RSB- . This system is designed to visualize hierarchical data structures . It uses a 3D representation of the data that can be interactively animated . Interactive animation allows the user to not only modify the display but to create an animation sequence to display the data . Several example applications have been built in which the cone tree acts as both a visualization tool for the data set and as an interface to the data . As mentioned in the introduction , the Macintosh Finder interface allows the user to choose between an iconic and a textual representation of files . In addition to providing these two formats , the interface allows the user to reorganize the files based on one of several key fields . When in iconic mode , a clean-up utility automatically arranges the icons to prevent overlapping . While the Macintosh directory interface and the cone tree allow the user to modify the appearance of the interface to change focus , they do not provide general tools for interacting with the structure of the interface . Most interface building toolkits provide the interface designer with a collection of tools for positioning a given static set of interaction objects on the screen -LSB- 5 , 10 , 11 , 13 , 16 -RSB- . These systems provide support for creating interfaces with fixed structures but they can not create interfaces the end-user can restructure at runtime . They also can not produce interfaces for dynamic data sets . The Humanoid system -LSB- 18 -RSB- creates interfaces for dynamic data sets by using templates to position interaction objects . While the templates in Humanoid are fixed , a dynamic template selection algorithm examines the data set at run time and chooses an appropriate set of templates . While the Humanoid system provides a mechanism that handles dynamic data sets , it does not provide the end-user with the power to directly interact with the interface structure . This work builds on the concepts in Humanoid by allowing the end-user to select and modify the equivalent of the Humanoid positioning templates . Unlike the Humanoid project , this work only deals with the task of positioning interaction objects within an interface and does not provide a general interface management system . 3 Multiple View Interfaces As a sample interface , consider a spreadsheet . Each cell in a spreadsheet is an interaction object that allows the user to manipulate part of the data | usually a name , an equation and a value . Traditional spreadsheet interfaces are structured in a rectangular matrix | all the cells are positioned on the screen in a rectangular grid | as shown in the sample spreadsheet in Figure 1 . The position of each cell is permanent and can not be changed by the user . Figure 2 shows an alternative interface to the sample Figure 2 : Spreadsheet Interface Depicting Cell Dependencies for Example in Figure 1 Figure 1 : Traditional Spreadsheet Interface spreadsheet shown in Figure 1 . The cells in this interface are positioned in such a way as to reveal the equation dependencies between cells . The algorithm used to position the cells in this interface uses the equation in each cell to determine the dependency ordering of all the cells in the spreadsheet . It then positions the cells in a pattern that represents the dependency dag . In addition to positioning the cells , the algorithm creates dependency edges between cells -LRB- drawn as arrows in Figure 2 -RRB- . The interfaces in Figures 1 and 2 are live interfaces ; they provide different views of the spreadsheet . Both are concurrently shown on the screen and the user can interact with either to change the spreadsheet data . This allows the user to look at both interfaces to understand the data and to interact with the interface that best fits his current task . In the example above , if the user wanted to edit all the cells that a given cell depends on , he might use the dependency oriented interface . On the other hand , if the user wanted to change all the cells grouped in a column , he would use the interface organized as a matrix . 4 Giving the User Control Traditional user interface management systems have concentrated on providing the interface designer with very general tools for specify the interface . These tools provide the interface designer with the ability to precisely specify exact interfaces . The cost for this power is that the specification must be very exact | each interaction object must be considered . The main goal of end-user controlled interfaces is to empower the user so he can customize the interface to match his current interests | which may in turn rely on the current data set and his mental model of the data . The solution is to provide the user with tools to create new views of the interface and to provide tools to customize these views . The proposed mechanism is to format the interface using a general graph layout system that allows the user to customize the layout . Since general graph layout algorithms do not generally generate precise layouts , this approach does not provide the accuracy of traditional Figure 3 : Spreadsheet with two Cells of Interest Highlighted Figure 4 : Dependency Graph for Cell \ c4 '' in Figure 3 Figure 5 : Pruned Dependency Graph user interface management systems . However , it does empower the user with the tools to customize the interface . The prototype interface layout system is built on top of the Vivid interactive graph layout system -LSB- 7 , 8 -RSB- . Vivid extends traditional automatic graph layout algorithms to accept interactive parameters , thus allowing the user to interactively control the layout process . A direct manipulation interface allows the user to interactively create multiple custom views of a given graph . As an example of end-user control , consider the spreadsheet shown in Figure 3 . The cells in this example were interactively formatted to be drawn without their equations to save screen space . Since the layout of the interface is done algorithmically , when the interaction objects change their size | as in this example in which cells are drawn without their equation | the entire interface automatically adjusts . Thus when the user chooses a drawing options for a cell that changes its size , the layout algorithm automatically repositions all the cells . Assume the user has discovered that when the value for cell \ f6 '' is changed , the value in cell \ c4 '' changes unexpectedly | these cells have been highlighted in Figure 3 . The dependency graph for the spreadsheet would help the user examine the dependencies between the two cells of interest . However , the complete dependency graph is quite large and would not fit well on the screen . The solution is to allow the user to specify the portion of the spreadsheet he is currently interested in . Figure 4 is an interface that includes only a portion of the original interface . It includes all cells in the spreadsheet that the cell \ c4 '' depends on . Even this graph is a bit large and contains some information that does pertain to the user 's current interest . Figure 5 shows another interface that includes only the cells that depend on \ f6 '' and that \ c4 '' depends on | all the paths between these cells . Since there is more space available , cells have been expanded in Figures 4 and 5 to include the equations allowing the user to interpret the dependency graph . Several of the cells have longer equations have been enlarged to show the entire equation . The resulting interface , while no longer general purpose , is dramatically better for the particular task at hand -LRB- debugging the connection between cells \ f6 '' and \ c4 '' -RRB- . There are three basic mechanisms in Vivid that empower the user with the tools to customize the interface : creating multiple views , using different algorithms to format the interface , and interacting with parameters to the interactor objects and the layout algorithms . Additional views can be constructed by first creating a new interface with a menu selection . When a new view is created , it is an empty interface without any interaction objects . The user must select interaction objects to be copied into the new interface . There are two methods for selecting interaction objects . The first | manual Figure 6 : Selecting all Cells Reachable from \ c4 '' selection | is to select individual objects or groups of objects with the mouse . The second method | algorithmic selection | is to apply a selection algorithm to all the interaction objects in the interface . A visual programming language allows the user to combine multiple instantiations of selection algorithms . Figure 6 shows the selection interface and the selection programs used to select the cells pasted into the interfaces shown in Figures 4 and 5 . -LRB- These cells were copied from the interface shown in Figure 3 . -RRB- The first program selects all the cells reachable from cell \ c4 . '' The object labeled \ 1 '' represents a manual selection set . These objects allow the user to manually select a set of nodes . In this example , the first manual selection set contains the single cell \ c4 . '' The next object represents a selection algorithm that selects all the cells within a given distance of the input set . Since the manual selection object is connected to the \ reachable '' object , its elements act as the parameters to the reachable algorithm . -LRB- The maximum traversal distance of the reachable algorithm can be set interactively through the distance slider . For this example is has been set to a value larger than any path in the spreadsheet -RRB- . The user can now copy all the cells reachable by \ c4 '' by selecting the \ reachable '' object -LRB- it and all the cells it represents are drawn highlighted when it is selected as shown in Figure 6 -RRB- and then dragging the \ Copy Selected Nodes w/Drag '' button into the new view . The second program calculates the paths between \ c4 '' and \ f6 '' as shown in Figure 5 . This visual program consists of three objects . The first two are manual selection set objects labeled \ 3 '' and \ 4 . '' In this example , the first manually selected set contains the single cell \ c4 . '' The second manual selection set contains the single cell \ f6 . '' The next object represents a selection algorithm that selects all paths between its input parameters . Figure 5 was created by selecting the \ path -LRB- s -RRB- '' object and dragging the \ Copy Selected Nodes w/Drag '' button into an empty view . Since interfaces are formatted using general layout algorithms the user can change the format of the interface by using a different algorithm . In the example shown in Figures 3 and 4 , each view uses a different layout algorithm . The interface in Figure 3 uses a grid layout algorithm that positions all the objects in a rectangular grid and the interface shown in Figure 4 uses a hierarchical layout algorithm based on ideas presented in -LSB- 17 -RSB- to position the interaction objects . When the cells in this example were selected and copied into the new interface , they were automatically formatted using the grid layout algorithm . In general , when objects are pasted into a new interface , the algorithm that formatted them in the original interface is also pasted into the new interface . The user had to explicitly choose the hierarchical layout algorithm to create the interface shown in Figure 4 . In addition to creating new interfaces , the user can interact directly with the interaction objects and layout algorithms . Each layout algorithm has a set of parameters used during the layout process . A control panel is associated with each instantiation of a layout algorithm . This allows the user to fine tune the interface . For example , the orientation and spacing for the interface shown in Figure 4 was interactively changed | the default orientation is to draw the hierarchy horizontally as in Figure 2 . It was changed to draw the tree vertically Figure 7 : Interface Formatted by Hierarchy of Layout Algorithms and increase the spacing to make the interface easier to read . The main drawback of using layout algorithms to format the interface is that the user is constrained to using existing algorithms . Even if a large set of algorithms were introduced to the system , situations would arise in which the system could not format the interface in the manner the user desired . This problem is partially solved by allowing end-user to compose new layout algorithms out of existing algorithms -LSB- 8 -RSB- . New custom layout algorithms can be created by hierarchically combining existing algorithms . The basic idea is to standardize all layout algorithms so they can lay out a set of nodes and a set of layouts generated by other layout algorithms . . For example , consider the interface shown in Figure 7 . It is formatted by a hierarchical collection of layout algorithms . Each group of cells is formatted by either a row , column or grid layout algorithm . All the groups of cells are in turn laid out by a hierarchical layout algorithm . The result is that the interface is laid out by a two level hierarchy of layout algorithms . The end-user creates new layout algorithms through the use of a direct manipulation editor . 5 Implementation The example interfaces shown in this paper were built on top of the Vivid graph layout system -LSB- 7 -RSB- . Vivid is a general system that provides a direct manipulation interface to any given set of layout algorithms and interactor definitions . No changes were made to Vivid to enable it to lay out interfaces | interaction objects are just a special case of Vivid graph objects . However , the spreadsheet interface did required the specification of the cell interactor . Each cell definition included functions for handling changes to the three text fields and included a general equation solving system for was accessed calculating and updating the value fields . The algorithms used to lay out the all the examples are basic Vivid layout algorithms . 6 Conclusion The structure of a user interface serves as a presentation model of the underlying data set . While this model is often adequate , it forces the user to view the data in a particular form . Providing the user with the power to directly manipulate the structure of the interface allows him to create an interface that matches his individual mental model , his current interests and changing data sets . Using interactive graph layout algorithms to format the interface provides a flexible mechanism that empowers the end-user with the tools to customize the structure of the interface . In addition , graph layout algorithms can handle interfaces to applications with dynamic data sets . The result is that the end-user can create interfaces that more closely match his expectations . This reduces the gap between the user and the actual data and increases the directness of the interface . There are two main directions of future work . The first is to develop new layout and selection algorithms that are especially well suited for interfaces . This will provide the end-user with additional power to customize interfaces . The second direction is to develop a means by which the end-user can specify layout and selection algorithms . Once the user can create arbitrary algorithms , he will be able to create interfaces that meet his exact interests . References -LSB- 1 -RSB- Apple computer Company , Inside Macintosh , Addison-Wesley Publishing Company , Inc. , -LRB- 1982 -RRB- . -LSB- 2 -RSB- Asente , P. J. , Editing Graphical Objects Using Procedural Representations , Digital Equipment Corporation Western Research Laboratory Research Report , 87/6 , -LRB- November 1987 -RRB- . -LSB- 3 -RSB- Brooks , K. P. , A Two-view Document Editor with User-definable Document Structure , Ph. D. Dissertation , Department of Computer Science , Stanford University , -LRB- May 1988 -RRB- . -LSB- 4 -RSB- Card , S. K. , Robertson , G. G. , Mackinlay , J. D . The Information Visualizer , an Information Workspace , Proceedings of ACM/SIGCHI , pp . 181-188 , -LRB- April 1991 -RRB- . -LSB- 5 -RSB- Cardelli , L. , Building User Interfaces by Direct Manipulation , Proceedings of the ACM/SIGGRAPH Symposium on User Interface Software and Technology , pp. 152-166 , -LRB- October 1988 -RRB- . -LSB- 6 -RSB- Henderson , D. A. Jr. , Card , S. K. , Rooms : The use of Multiple Virtual Workspaces to Reduce Space Contention in a Window-Based Graphical User Interface , ACM Transactions of Graphics , vol . 5 No. 3 , -LRB- July 1986 -RRB- . -LSB- 7 -RSB- Henry , T. R. , Interactive Graph Layout : the Exploration of Large Graphs , Ph. D. Dissertation , Department of Computer Science , University of Arizona , in preparation . -LSB- 8 -RSB- Henry , T. R. , Hudson , S. E. , Interactive Graph Layout , to appear in Proceedings of the ACM/SIGGRAPH Symposium on User Interface Software and Technology , -LRB- November 1991 -RRB- . -LSB- 9 -RSB- Hutchins , E. L. , Holland , J. D. , Norman , D. A. , Direct Manipulation Interfaces , in User Centered Systems Design , Norman , D. A. , Draper , S. W. -LRB- eds . -RRB- , Lawrence Erlbaum Associates , Hillsdale , New Jersey , pp. 87-124 , -LRB- 1986 -RRB- . -LSB- 10 -RSB- Myers , B. A. , Creating User Interfaces by Demonstration , University of Toronto Technical Report , Ph.D. . Thesis CSRI-196 -LRB- May 1987 -RRB- . -LSB- 11 -RSB- Myers , B. A. , et . al. . The Garnet Toolkit Reference Manuals : Support for Highly -LCB- Interactive , Graphical User Interface in Lisp . Technical Report CMU - CS-98-196 , School of Computer Science , Carnegie Mellon University , -LRB- November 1989 -RRB- . -LSB- 12 -RSB- Linton , M. A. , Vlissides , J. M. , Calder , P. R. , Composing User Interfaces with InterViews , IEEE Computer , vol . 22 , no. 2 , pp. 8-22 , -LRB- February 1989 -RRB- . -LSB- 13 -RSB- Olsen , D. MIKE : The Menu Interaction Kontrol Environment . ACM Transactions on Graphics , vol . 17 , no. 3 , pp. 43-50 , -LRB- 1986 -RRB- . -LSB- 14 -RSB- Robertson , G. G. , Mackinlay , J. D. , Card , S. K. , Cone Trees : Animated 3D Visualizations of Hierarchical Information Proceedings of ACM/SIGCHI , pp. 189-194 , -LRB- April 1991 -RRB- . -LSB- 15 -RSB- Shneiderman , B. , The Future of Interaction Systems and the Emergence of Direct Manipulation , Behaviour and Information Technology , vol . 1 , pp. 57-69 , -LRB- 1982 -RRB- . -LSB- 16 -RSB- Singh , G. , Green , M. Chisel : A system for Creating Highly Interactive Screen Layouts , Proceedings of the ACM/SIGGRAPH Symposium on User Interface Software and Technology , pp. 86-94 , -LRB- November 1989 -RRB- . -LSB- 17 -RSB- Sugiyama , K. , Tagawa , S. , Mitsuhiko , T. , Methods for Visual Understanding of Hierarchical System Structures , IEEE Transactions on Systems , Man , and Cybernetics , vol . SMC-11 , No. 2 , -LRB- February 1980 -RRB- . -LSB- 18 -RSB- Szekely , P. , Template -LCB- Based Mapping of Application Data to Interactive Displays , Proceedings of the ACM/SIGGRAPH Symposium on User Interface Software and Technology , pp. 1-9 , -LRB- October 1990 -RRB- .

O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O