### Ferret Pasting

The goal of this project is to implement model a ferret. To attempt to achieve this, I built some sort of tensor product B-spline editor and implemented some sort of surface pasting.

#### Tensor product B-spline editor:

• Regular Patches:
• Degree dxd patches with n control points in u direction and m control points in v direction
• Regular patches are implemented as greville displacement B-splines, with u correspoinding to x and v corresponding to y
• Regular patches are clamped in the u and v direction
• Regular patches can be scaled in the u and v direction
• Cylindrical Patches:
• Degree dxd cylindrical patches with n control points in the u direction and m+d control points in the v direction
• Cylindrical patches has a 2D spline as the centre of the cylinder. This can be manipualated and updated
• Cylinder spine takes the same knot vector as the patch in the u direction and is degree d
• Cylindrical patches are implemented as greville displacement B-splines, with u corresponding to x and v corresponding a degree around the spine of the cylinder. The corresponding coordinate frame for each greville origin then has the "z" axis pointing out at the degree calculated from the v value
• Cylindrical patches are clamped in the u direction
• Regular patches can be scaled in the u direction
• For cylindrical patches, knot insertion in the v direction is limited to after the first d+2 knots and before the last d+2 knots. This is because for closed splines, the last d control points must be the same the first d control points, and the distance between the corresponding knots must match. I can't be bothered to reupdate the last d points, so I'm avoiding the problem
• Knot insertion in u in cylindrical domain also inserts a knot in the corresponding spine
• Spine control points can be moved
• Multiple control points can be selected and moved at the same time
• Selecting greville points is the same as selecting control points.
• Patches can be translated in the u and v direction
• Knots multiplicity is limited to a maximum of d
• Patches can be assigned colours
• Several display options for patches supported

#### Surface Pasting:

• Domain space pasting implemented
• You can paste any domain on to a bigger domain, however, if the smaller domain is a cylinder, it won't do anything much.
• Tree pasting supported
• Domains can be translated and scaled hierarchically
• Trimming supported for first child only
• Mann-DeRose evaluation for tensor product B-spline patches implemented so that I don't get disowned

#### GUI Stuff:

• Domain operations operate on 1 selected patch
• Control point operations operate on all selected control points
• Delete patch deletes all selected patches
• All other operations operate on all patches if no patch is selected, otherwise, it operates on selected patches.
• Surface editing area (the big black thing on the left)
• Selection
• Patches can be selected/deselected by clicking on a patch with the left mouse button
• Control & greville points can be selected/deselected by clicking on the points with the left mouse button for single selection, middle button for selecting the entire u row and right button for selecting the entire v row
• Mouse mode - change from menu or left double click on rendering area. Operations displayed below rendering area
• L1 - translate view along x & y
• M1 - zoom in and out. -y to zoom in
• R1 - trackball
• L2 - translate selecte control points along coordinate frame x axis
• M2 - translate selecte control points along coordinate frame y axis
• R2 - translate selecte control points along coordinate frame z axis
• Domain editing area (the medium size black thing on the top right)
• Selection
• Left click to select/deselect patches. Smallest domain containing mouse position is pick
• Middle click to add knot in u direction. Click must be in selected domain
• Right click to add knot in v direction. Click must be in selected domain. Restrictions apply to cylinders
• Mouse mode - change from menu or left double click on rendering area. Operations displayed below rendering area
• L1 - translate view along x & y
• M1 - zoom in and out. -y to zoom in
• R1 - translate selected patch
• L1 - scale selected patch. Must start by selecting red circle in top right corner
• R2 - translate selected patch
• Spine editing area (the small black thing on the bottom right)
• Shows a 2D spline curve if a single cylindrical patch is selected
• L to translate view along x & y
• M to zoom in and out
• R to drag control points
• New to clear out current views
• Open to open new file
• Import to add data from new file to current view
• Save to save to current file
• Save As to save to new file
• Quit to exit - short cut "q"
• Reset view to change surface area to default settings
• Reset domain to change domain area to default settings
• Reset spine to change spine area to default settings
• Show axis to show the xyz or xy axis in each view
• Delay update surface to delay surface update
• Colour dialog - brings up dialog to select and set colour for patches
• Surface - sets surface options for all|selected surfaces. Includes turning trimming on or off, showing surface as fill, wireframe or outline(OpenGL options), culling backface showing surface
• Control point - show or hide
• Greville point - show or hide
• Displacement - show or hide (draws line from coordinate frame origin to greville point)
• Delete selected patches
• Clear selection for selected control points
• Restrict cylinder spine movement to y direction only
• Toggle mouse modes for surface editing area and domain editing area
• Status bar
• entry fields for n, m and d needed to create a patch
• New creates a new nxm patch of degree dxd. New patches are always put at the furthest u value in the domain
• Cylinder creates a new nx(m+d) patch of degree dxd
• Clear CP clears control points
• Resolution set the number of samples for opengl to render the currently selected or all the surfaces

#### Models:

 Modeling is very unintuitive. My first model is the "ferret" on the left. I did the snake (with a hat) and the turtle (and same turtle with pox) afterwards. The way I did the bumps was to make a bump and then paste it, then edit it pasted. They don't look that great.

#### Bugs, limitations and other thinggummies:

• When I started out, I didn't know what I was doing (not that it has changed much) so the data structures are in dire need of a redesign
• 3D surfaces are drawn with the OpenGl nurb renderer, which has lots of bugs. The sampling scheme used is domain step. So smaller domains don't look as nice (could've figures it out sooner...)
• Most of the testing is done on bicubic patches, so I'm sure something will act funny if the degree keep going up
• I sure that I didn't fixed all the stuff that seg faults and bus errors
• Scaling patches in the z direction would probably be useful
• Adding a function to copy a patch (and its children) would be really really useful
• No error checking on reading files. Anything goes if you read a file with a different format
• Optimization needed badly in lots of places
• It's very hard to make usable 3D gui
• having multiple windows would probably have been better
• Moving knots would have been good
• Directed acyclic graph pasting woulb be nice
• Rotating would be nice
• A 3D spine for the cylinders would have been nice
• Should have figured out direct manipulations of greville points at least
• Trimming all the children would have been interesting
• Rounding errors in scaling causes a non-increasing knot sequence sometimes
• Wrap around the cylinders would have been good
• and lots more...

#### References:

• CS 679 Course notes
• Feature Oriented Composition of B-Spline Surfaces, Christin Barghiel, Master's Thesis, University of Waterloo, 1994.
• Quasi-Interpolated Surface Pasting, by Blair Conrad, Master's Thesis, University of Waterloo, 1999.
• Pasting Spline Surfaces, by Christin Barghiel, Richard Bartels, and David Forsey, in Mathematical Methods for Curves and Surfaces, 1994.
• Hierarchical B-spline Refinement, D. Forsey and R. Bartels, SIGGRAPH '88, 1988.

#### Acknowledgement of help:

• Blair and Steve, for clearing up many points and confusing me on many more (Everything is NOT easy)
• My kits, for being ferrets
• Sprite, for not only being a ferret, but a white (more or less) ferret, so I can actually make my model 1 colour