Lab Assignment 3

  • Surfaces Assignment – Lab Assignment 3

Instructor: Gershon Elber

T.A.: Haitham Fadila

Handed out: July 2nd, 2023 Due date:  Please contact the course staff to coordinate.

Description

Develop a program for viewing surface differential geometry on parametric tensor product B-spline surfaces. The splines may be of any order and have arbitrary end conditions.
The surface will be drawn as a set of isocurves where the user can control the number of samples per curve and the number of isocurves per dimension separately.

The surfaces should be created in two optional ways:

  • Loading from a data file (see data file format below).
  • Creating a new surface. When creating a new surface, the user should be able to specify:
    – number of control points in each dimension of the control mesh e.g. 5X6.
    – order and knot vector for the B-splines in each dimension of the control mesh.
    After a new surface has been specified a planar grid surface should be displayed.

The user should be allowed to modify orders, knots, and control points’ positions of the surface as he/she wants.
In order to demonstrate the surface’s differential geometry, your program should display the following geometric entities moving along any isoparametric curve picked by the user or the line between any two points (anywhere on the surface – not necessarily along an isoparametric direction) selected by the user (i.e. animation). You should also allow static display of the differential geometry entities at any selected point:

  • The tangent vectors Su and Sv.
  • The unit surface normal.
  • The tangent plane.
  • Principal curvatures and principal directions.
    You could display these by drawing osculating circles (with radius the reciprocal of the principal curvature) in the principal directions.

The user should be able to toggle the display of each of the above geometric objects as well as the surface and its control mesh.

Select one from

You should also implement one of the following additional options:

  • Draw the following offset surfaces:
    – adding a constant in the normal direction (regular offset).
    – adding 1/K in the normal direction, where: K = k1 * k2.
    – adding 1/H in the normal direction, where: H = (k1+k1)/2.
    – adding 1/k1 in the normal direction.
    – adding 1/k2 in the normal direction.
  • Add support for rational surfaces and display a sphere properly.
  • Add support for single knot insertion in u or v.

Data file format

Data for the surface will be read from the text file. The file format is as follows:

  • Spaces and tabs are ignored except to separate tokens.
  • Empty lines or lines starting with a pound sign (‘#’) are comments.
  • The first non-comment line contains two integers, specifying the orders in the u and v directions.
  • Next come optional knot specifications. If one or both is missing, generate a uniform knot vector with open-end conditions for the B-spline surface. The specification is much like what we have used before:

u_knots[n] = f f … f            v_knots[n] = f f … f

  • Finally comes,

points[n][n] =

followed by the coordinates for the control points. Each control point has three coordinates (x, y, and z) separated by white space. Each point will appear on a separate line. The points appear in u-major form (u runs faster than v).

  • Note the knots and the points are floating point numbers while the indices are integers.

Sample data files can be downloaded from here .

A demo can be downloaded from here. In case of a discrepancy between the exe file and this document, this document governs.

 

Submission

Everyone should contribute an interesting data file.

We will schedule a time to grade the program with you.