Table of Contents

Interactive Surface Editor

Quick Contents of this Page

Overview

Along with the line segments and polygons drawn by the turtle, the cpfg program makes it possible to incorporate Bezier surfaces into a plant model. The interactive surface editor program, ise, allows the user to see the structure of the surface being designed, select control points, and move them causing immediate changes to the surface shape.

A user's view of ise

Ise takes as input a view file describing how the user wishes to view the surface and a surface description file containing 16 control points for each patch making up the final surface. After reading the information from this file, the program displays the window with a wireframe view of the edited surface and the xyz axes (Figure 1).

  

Figure 1 - An ise screen composed of a viewing window and a control panel window

The orientation of the surface can be manipulated by the user, holding down the left button while dragging the mouse. The displayed wireframe representation of the surface is calculated using Bezier form. This wireframe is made up of a mesh of intersecting curves of constant parameter value. Each curve is approximated by a number of segments between each intersection with the curves of the other parameter. The number of segments is called the precision of the curve and can be specified in the view description file for cpfg.

Along with the wireframe, the control points of one surface patch will be displayed. Each control point is represented as a dot with an appropriate label from 1 to 16 beside it.

The editing of the patch is performed using a control panel, which includes a set of buttons and sliders. The operation of the slider is explained in Figure 2.

Figure 2 - The control panel slider

The horizontal arrows allow the user to change values and are activated using the left mouse button. The controlled value is shown in the top central part of the slider and changes down, if you move the cursor to the left and up, if you move it to the right. The up and down arrows make it possible to increase or decrease the precision of value manipulation and display. The central diamond shaped control is used to reset the slider value.

Returning to the control panel shown in Figure 1, the slider at the top of the panel makes it possible to select the patch to be edited in cases where the surface is composed of multiple patches. The Point selection array of buttons is used to select the point to be controlled. Point position can be changed using sliders. There is one slider for each of the x, y, and z coordinates. The changes to the point's position and the corresponding changes to the surface are reflected immediately in the view of the surface.

When integrating a surface into a plant model, the user must be able to control its position and orientation. This is accomplished by providing geometric parameters to be matched to the position and orientation specified in the plant model for the surface. The contact and end points are specified by points labelled CP and EP. The surface orientation is specified by a heading and an up vector, shown on the screen as arrowheads labelled HV and UV, respectively. These attributes are only displayed when the user selects the Geometry option from the ise popup menu, or selects the appropriate buttons from the Point selection array for manipulation. They can be manipulated in the same manner that control points are.

Instead of the default wireframe representation, the user may choose a Gouraud shaded image from the ise popup menu. In order to produce this shaded image, the ise program must have shading parameters available. These are read in from the view description file and include the colormap index of the base color, a vector specifying the direction of the light source (assumed to be at infinity), the ambient light coefficient, and the diffuse light coefficient. If these parameters are changed (for example, using a text editor), the ise Reread menu item must be used to reflect the changes in the shaded image.

When a surface is composed of multiple patches, the user must specify in the input file where the patches are joined. If two patches are joined along an edge, the four control points making up that edge are matched with their counterparts in the other patch. If one control point of a pair is moved, the other is moved in unison with it.

When the user is satisfied with the appearance of the surface and its geometry parameters, the control points can be output to a file, using the Save menu item.

Ise popup menu

The ise popup menu is controlled using the right mouse button. The menu contains the following items:

Surface description file format

The creation of a complex surface requires the use of multiple patches. Adjacent patches are connected along shared edges. In order to determine which patches share the edge, a patch neighborhood is defined. Each patch can have up to eight neighbors as shown in Figure 3.

Once an arbitrary orientation has been chosen for the surface, adjoining patches can be considered to be above and to the left, AL, above, A, above and to the right, AR, to the left, L, to the right, R, below and to the left, BL, below, B, or below and to the right, BR, of a given patch.

These abbreviations are used in the surface description file when defining adjoining patches (see the example file shown below). The neighboring patch name must be specified next to the corresponding abbreviation, or the symbol "~" must be used, which represents no neighbor.

Figure 3 - Patch neighborhood

In order to place the surface at a location in 3D space at the required orientation, four geometry parameters need to be specified as shown in Figure 4. The contact point (CP) is the point which is aligned with the turtle's current position when drawing the surface. The end point (EP) is the point at which the turtle is positioned once the surface has been drawn. The orientation of the surface is specified by the heading vector (HV) and up vector (UV).

Figure 4 - Geometry of a surface

The first section of a surface description file contains information about the surface as a whole. This includes the minimum and maximum value pairs for the x, y, and z values of the bounding box for the surface, the geometry parameters (i.e., contact and end points, heading and up vectors) (see Figure 4), and a scaling parameter (giving the size to be considered as equivalent to the step size in cpfg). This is followed by groups of 9 lines, each describing one component patch. A group consists of a patch name, patch-specific rendering information, three lines of patch neighborhood information (see Figure 3), and four lines of patch control points, each line defining one row of four points.

For example the file leaf.s may contain the following lines:

-35.00 35.00   -7.50 81.29   -7.50 21.85
CONTACT POINT  X: 0.00 Y: -2.52 Z: 0.00
END POINT      X: 0.00 Y: -2.52 Z: 0.00
HEADING        X: 0.00 Y:  0.99 Z: -0.14
UP             X: 0.02 Y: -0.14 Z: -0.99
SIZE: 86.29
Patch_1
TOP COLOR: 0 DIFFUSE: 0.00 BOTTOM COLOR: 0 DIFFUSE: 0.00
AL: ~ A: ~ AR: ~ 
L: ~ R: ~ 
BL: ~ B: Patch_2 BR: ~ 
-25.0  0.0 -5.0  -35.0 10.0 -5.0  -30.0 20.0 -5.0  -25.0 30.00 -2.5
-20.0 -7.5 -5.0  -20.0 10.0 -7.5  -20.0 25.0 -5.0  -15.0 50.00  0.0  
-10.0 -5.0 -5.0  -10.0 15.0 -5.0  -10.0 40.0 -2.5   -7.5 55.00  2.5  
 0.00 -2.5  0.0   0.00 25.0  0.0    0.0 55.0 0.00    0.0 81.29 21.85  
Patch_2
TOP COLOR: 0 DIFFUSE: 0.00 BOTTOM COLOR: 0 DIFFUSE: 0.00
AL: ~ A: Patch_1 AR: ~ 
L: ~ R: ~ 
BL: ~ B: ~ BR: ~ 
0.00 -2.50  0.00  0.00 25.0  0.00  0.00 55.0  0.0   0.0 81.29 21.85  
10.0 -5.00 -5.00  10.0  5.1 -5.00  10.0 40.0 -2.5   7.5 55.00  2.5
20.0 -7.50 -7.50  20.0 10.0 -7.50  20.0 25.0 -5.0  15.0 50.00  0.0  
25.0  0.00 -5.00  35.0 10.0 -5.00  30.0 20.0 -5.0  25.0 30.00 -2.5

View description file format

This file is required to define the viewing parameters for the surface display. Each line contains a keyword, followed by a colon, and the value or values for that parameter. Values are separated by commas. The keywords are self-explanatory.

For example, a file leaf.zv may contain the following lines:


initial color: 100       
viewpoint: 0.5,0.5,10
view reference point: 0,0,0
twist: 0
projection: parallel
front distance: -100.0     
back distance: 100.0
scale factor: 0.8
light direction: 1.0,0.0,0.5
surface ambient: .15
surface diffuse: .75
highlight patch: 1
highlight point: 4
geometry display: off
Note: all of the lines shown are required and must appear in the above order.

References

J. Hanan. Plantworks: A software system for realistic plant modelling. Master's thesis, University of Regina, Regina, Canada, 1988.

A. Snider. An interactive, physically-based simulation system. Master's thesis, University of Regina, Regina, Canada, 1992.


Credits

J. Hanan - ise implementation

A. Snider - the control panel library

J. Hanan, I. Hernadi, P. Prusinkiewicz - ise documentation


Bugs

1. Shading in color space. ???

2. No interactive support for adding/removing patches.

3. No automatic rescaling.


Contact Information

Please direct all feedback, bug reports, and so on to vlab@cpsc.ucalgary.ca.

Last updated Feb. 27, 1996 by Istvan Hernadi