computing with geometry as an undergraduate course: a ...shene/nsf-2/sigcse2001-slides.pdfhands−on...

44
Computing with Geometry as an Undergraduate Course: A Three-Year Experience Partially supported by National Science Foundation John L. Lowther and Ching-Kuang Shene Department of Computer Science Michigan Technological University Houghton, MI 49931-1295

Upload: others

Post on 23-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Computing with Geometry as an Undergraduate Course: A Three−Year Experience

Partially supported by National Science Foundation

John L. Lowther and Ching−Kuang Shene Department of Computer Science Michigan Technological University Houghton, MI 49931−1295

Page 2: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

What is this course all about?We want to teach our studentsthe way of handling geometricproblems.

Is this course necessary?It depends. Many people opposeto this idea. But, as long as the the demand is there, it is worthto provide our students with thisimportant skill.

How important is this course?This is a geometric world. But, atypical CS student may not receiveany geometric training.

Geometric materials are scatteredthroughout many courses withouta coherent view.

Page 3: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

This is NOT a Graphics Course

Graphics

Vision

CAD

DataVisualization NC and

Robotics

Comp. Geo

CAGD

Computing with Geometry

This course does not require graphicsbackground

Page 4: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Nobody Teaches this Course!

There Is NO National Impact!!

Here are some information gatheredfrom our course web site

Course Info Page 10.91Electronic Book 13.87Curve User Guide 5.07Surface User Guide 3.04Download Visitors 4.96Total Downloads 1090CD−ROM Disttributed 50+

Daily AvgSite

We have 10−20 students per year

Page 5: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Educators and students are interestedin these topics

CS,EECS,Math/CS... 27.47CS alone 22.07Science 4.67Math alone 3.57Engineering 7.78Mech Eng alone 4.67EDU general 11.36Education Total 51.28COM 25.09Other 22.34ORG/GOV 1.29

Domain %

"Other" may include many studentsas shown by their correspondences

Page 6: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Geographical Distribution

North America 41South America 2Europe 41Far East 9Other areas 7

USA 38.53France 7.98Germany 7.16

Area %

Top Three %

We have no way to count visitorsto our electronic book and user guidesbecause our server does not keeptrack this information.

Page 7: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

A quick Internet search reveals thefollowing universities where ourmaterials are being used:

Arizona StateDePaul UniversityFeng Chia University (Taiwan)Ghent University (Belgium)The Hong Kong U. of Sci. &TechINRIA Sophia−Antipolis (France)Mechanical Engineering Nis (Yugos)MITOhio StateTaylor UniversityTechnische Fachhochschule BerlinUniversity of AlaskaUniversity of Alberta (Canada)University of Magdeburg (Germany)University of Patras (Greece)Verona University (Italy)Western Washington U.

This search does not include courseswithout course web sites.

Page 8: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Too Much MathematicsWe are not in Math or Eng Dept

Yes and No.

With the help of our software toolDesignMentor we can take a hands−on and intuitive approach anddo not use very much mathematics.Our electronic book shows this well.

Calculus and elementary linearalgebra are required. The formerhelps understand the characteristicsof curves and surfaces and the latterprovides a solid background of geometric transformations and affineand projective spaces.

Thus, if students have good mathbackground, we do more theory;otherwise, let them know more aboutalgorithms and applications.

Page 9: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Only covers the fundamentals ofsolids, curves, surfaces and theirimportant algorithms and operations.

It has to be intuitive and elementary,and takes a learning−by−doingapproach. Complex algebraic derivations and calculations are notour primary topics.

You cannot teach beginners top−downdesign because they do not know which way is up (C.A.R. Hoare).In a geometry class, let the studentssee the geometry must be the firststep. So, we use our DesignMentorsoftware tool.

Design Merit

Page 10: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Geometry

Representation

Algebra

Algorithm

Program

The Theme of This Course

Page 11: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Complexity of Geometric Problems

Dimensional Complexity2D, 3D, 4D, .....

Analytical Complexity

equations aremore complex

ComputationalComplexitythe O() stuffs

Page 12: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Floating point computations cannotbe exact. How do we use discreteentities to represent a continuum?

What are the roots of x + 20000x + 1=0 using single precision? Answer: 20000 and 0!

Will the following five expressionsdeliver the same result?

x = (R + 1)x − (Rx )x i+1 i i

x = (R + 1)x − R(x x )i+1 i i

x = ((R + 1) − Rx )x i+1

x = Rx + (1 − Rx )xi+1

x = x + R(x − x x )i+1

i

i

i i

i i

i i i i

i

No, it is a chaotic system!

Algorithm Robustness

2

Page 13: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Good Method

Poor Method

Page 14: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Course Overview

Review of Geometric Concepts

Parametric Curves and Surfaces

Bezier, B−spline and NURBS

Implicit Curves and Surfaces

Computational Geometry Issues

Robustness Issues

Interpolation and Approximation

Object Representations

Course Contents

Page 15: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

The theme of this course, complexityof geometric problems, and so on.

The impact of finite precision arithmetic to geometric problems

The failure of associative law anddistributive law

How to prevent the loss of significantdigits

Many computation examples

Course Overview

Page 16: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Programming Exercise 1: A pentagon can be shrunk (goingin) or expanded (going out).

Are out (in (P)), in (out (P)), ... thesame as P?

2 2 2 2

P

the differencesare 0.1, 0.01, 0.001, 0.0001, ...

A Taste of Implementation Failure

Page 17: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Wireframe and polyhedron models

Boundary representationsManifolds, the winged−edge data structure,the Euler−Poincare formula and EulerOperators (e.g., make an edge and a vertex,make a face and an edge, make a shell anda hole, kill an edge and a vertex, kill a faceand an edge, kill a shell and a hole and so on).

Euler operators are used for constructingpolyhedral solids.

Constructive Solid GeometryInterior, exterior and closure, regularizedBoolean operators, and design examples.

Object Representations

Page 18: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Winged−edge data structuresPerform queries such as given a vertex, find all adjacent edges given a facet, find all incident edges given a vertex, find its link or star

Write a program that reads in a descriptionof a solid with winged−edge data structureand display it. Students are required tosupply some interesting designs.

Programming Exercise 2: Part I

Page 19: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Constructive Solid GeometryDesign a scene using set union, intersection and difference. Students are given a sceneand an object to start with.

MTU

CSE

Programming Exercise 2: Part II

Page 20: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

This is a 300−level course. Most students are juniors, some are seniors,and only a few are sophomores.

Course PrerequisitesC/C++, data structures, calculusand linear algebra

Teaching EnvironmentThis course is taught in a computerequipped classroom. Coursematerials are all web−based.Software tools can be accessed from every workstation. Thus, we cantake a hands−on approach.

Software ToolsDesignMentor and a raytracer

Background Information

Page 21: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Parametric Curves

Parametric Curves

Moving TriadTangent vector, normal vector, bi−normalvector, curvature, and curvature sphere

Continuity IssuesC − and G − continuity, curvature continuity

k k

Rational CurvesWhy are circles, ellipses, and hypobolas cannotbe represented by polynomials. This opensup a window for the need of NURBS

Uniformization Theorems. "Parametric −>implicit" is always possible. Only rationalcurves can have parametric forms.

Page 22: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Tangent

Bi−normal

Normal

CurvatureSphereMoving

Point

Curvature Plot

Riding on the Curve

Curve Tracing with DesignMentor

T

Bi−N

N

Page 23: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Bezier, B−Spline and NURBS

Bezier Curves (about 3 hours)Fundamentals: construction, partition of unity, convex hull property, affine invariance,and variation diminishing property

De Casteljau’s AlgorithmThis is the algorithm for computing a pointon a Bezier curve given a parameter

Advanced TopicsCurve Subdivision: Dividing a Bezier curve into two Bezier sub−curves

Degree Elevation: Increasing the degree of a Bezier curve by one without changing the shape of the curve

Other Important TopicsFirst derivative (Hodograph), second andhigher derivative. The concept of cornercutting.

Page 24: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

De Casteljau’s Algorithm with DesignMentor

Note thecolorrelation

de Casteljau’sAlgorithm andIntermediateComputation

StepwiseComputation

Page 25: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

u = 0.5

first segment

second segment

Curve Subdivision with DesignMentor

Page 26: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Corner Cutting

Degree Elevation with DesignMentor

Page 27: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Implement de Casteljau’s algorithmand use it to trace a Bezier curve.Also design some interesting curves.

Programming Exercise 3

Page 28: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

B−spline Curves (about 6 hours)Motivation: a B−spline curve is the union of a number of Bezier curves joining together with C − continuity.

k0 k1 k2 k3 k4

knots

knot points or ducks

Bezier curvesegments

C − continuousk

k

Page 29: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

B−spline FundamentalsConstruction, partition of unity, strong convexhull property, local modification property,affine invariance and variation diminishing

Advanced TopicsKnot Insertion: Inserting a new knot without changing the shape of the B−spline curve

Curve Subdivision: Dividing a B−spline curve into two B−spline sub−curves

Degree Elevation: Increasing the degree of a B−spline curve by one without changing the shape of the B−spline curve

De Boor’s AlgorithmComputing a point on a B−spline curve givena parameter. This extends de Casteljau’salgorithm to B−spline curves. De Boor’salgorithm is implemented by repeated knotinsertion.

Other TopicsDerivative computation

Page 30: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Corner Cutting

StrongConvexHull

Division Ratios

Knot Insertion with DesignMentor

New Knot

Page 31: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Shape Editing with DesignMentor

The local modification property guaranteesthat only part of the curve will be affectedwhen a control point changes its position.

In fact, position change is parallel to the movementof the control point.

Page 32: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Implement de Boor’s algorithm withrepeated knot insertion and use it to trace a B−spline curve

Familiarize all quadric surfacesand use all of them to construct ascene using whatever techniqueyou like (e.g., constructive solidgeometry). Quadric surfaces arein implicit form.

Programming Exercise 4

Page 33: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Quadric Surface Modeling

Page 34: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

A 3D B−spline curve using homogeneous coordinate is a 4D B−spline curve.

Projecting this 4D B−spline back to3D with w = 1, the 4th coordinate,yields a NURBS curve.

Since a NURBS curve is rational,circles, ellipses and hyperbolas can berepresented.

Most non−metric related propertiesof B−spline translate to NURBS (e.g.,de Boor’s algorithm, strong convex hull, local modification, and so on)

Hence, you know NURBS if you know B−spline well.

NURBS Curves

Page 35: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Weight Change with DesignMentor

w = 1

w = .1

w = 10

Increasing weight pulls the curvetoward the selected control point.Decreasing weight pushes the curveaway from the selected control point.

no change

Page 36: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Bezier, B−spline, NURBS Surfaces

A Bezier, B−spline and NURBS surface is a tensor product surface andis the product of two curves.

Surfaces are defined by a grid andhave two sets of parameters, two setsof knots and so on.

De Casteljau’s and de Boor’s algorithms can easily be generalizedfor surfaces.

Other algorithms such as knot insertion are applied to one set ofparameters.

Page 37: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Implement the 3D de Boor’s algorithmand use it to trace a B−spline surface.Note that adding a weight to eachpoint making a B−spline surface aNURBS one. In OpenGL, this is theonly difference.

Triangulate the domain of aparametric surface and display it. Then, use this surface to design an interesting scene.

Students are only given a set ofparametric equations. They do not know what the surface looks like.

Programming Exercise 5

Page 38: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Parametric Surface Triangulation

Kuen’s surface

Astroidal Ellipsoid

Page 39: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Interpolation and Approximation

InterpolationFind a B−spline curve (resp., surface) thatcontains all data points (resp., data point grid)

ApproximationFind a B−spline curve (resp., surface) thatcan follow the shape of the data points(resp., data point grid) as close as possible.

This topic is difficult and requiresa linear equation solver. Most students managed to get it. Some performed extremely well.

This topic is also very useful in graphics (e.g., animation pathgeneration) and in other areas(e.g., reverse−engineering)

Page 40: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Design a program that can interpolateand approximate an input data gridusing B−spline surfaces and differentparameter selection methods.

Render an algebraic surface and useit to design an interesting scene.Students only receive an equationand do not know what the surfacelooks like.

This surface has a free parameter.Students should explore the relationbetween this parameter and the shape of this surface.

Programming Exercise 6

Page 41: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Inte

rpol

atio

nA

ppro

xim

atio

n

de B

oor

net

de B

oor

net

para

met

er s

elec

tion

met

hods

Page 42: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Algebraic Surface Modeling

Kummer’s surface

Kummer’s surface

Page 43: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

Since this is an elective course, students in this course just love it.

The difference between a pre−testand a post−test shows that studentsdo learn a lot. Compared withtheir exam papers and exercises,this is a fair assessment.

Almost all students prefer this intuitive, elementary and learning−by−doing approach.

Since students receive a minienvironment to work with, they donot have to know about rendering.In fact, 40% of them do not havegraphics background.

A detailed behavior−based study will be published elsewhere.

Course Evaluation

Page 44: Computing with Geometry as an Undergraduate Course: A ...shene/NSF-2/sigcse2001-slides.pdfhands−on and intuitive approach and do not use very much mathematics. Our electronic book

We believe we should provide ourstudents with some geometry skills.

Based on our experience, this courseis a success, especially that there areso many off−campus visitors andsoftware downloads.

We still need more materials forinstructors and students to makechoices. Good candidates includethe blossoming principle, scattereddata interpolation/aprroximation,multiresolution modeling, geometriccompression and so on.

All materials are available at

http://www.cs.mtu.edu/~shene

Conclusion