Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Goals • Coordinate-free representation of objects • Homogeneous coordinates • Distinction of an object from its representation
Scalars, Points, and Vectors • Geometric View • Mathematical View • Vector • Affine Spaces • Computer-Science View • Other issues • Geometric ADTs • Lines • Affine Sums • Convexity • Dot and Cross Products • Planes
Geometric View • Point: a location in space • Scalar: real number • Vector: directed line segment Directed Line Segment That Connects Points
Mathematical View • Vector space: vectors and scalars • Operations • Scalar-vector multiplication • Vector-vector addition • Affine space: vector space + point • Vector-point addition (or point-point subtraction) • Euclidean space: affine space + measure of size or distance
Computer-Science View • Scalars, points, and vectors as abstract data types (ADTs) • ADT • Object-oriented • Data and operations • Object declarations vector u,v; point p,q; scalar a,b; q = p + a * v;
- - - Use of the Head-to-Tail Axiom
Lines • The sum of a point and a vector (or subtraction of two points) leads to the notion of a line in an affine space.
Affine Operations • In an affine space, scalar-vector multiplication vector-vector addition are defined. However, point-point addition and scalar-point multiplication are not. • Affine addition has certain elements of the above two latter operations.
Convexity • A convex object is one for which any point lying on the line segment connecting any two points in the object is also in the object. Line segment that connects two points
Convex Hull • Geometrically, a convex hull is the set of points that we form by stretching a tight fitting surface over the given set of points – shrink wrapping the points.
u Dot Product and Projection
Cross Product • Right-handed coordinate system
Formation of a Plane • Normal vector:
Three-Dimensional Primitives • Three features characterize three-dimensional objects that fit well with existing graphics hardware and software: • Objects described by surfaces and hollow – 2D primitives modeling 3D primitives; • Objects can be specified through vertices – efficient implementation; • The objects either are composed of or can be approximated by flat convex polygons.
w Vector Derived From Three Basis Vectors
Rotation and Scaling of a Basis • The changes in basis leave the origin unchanged. We can use them to represent rotation and scaling of a set of basis vectors to derive another basis set.
Translation of a Basis • However, a simple translation of the origin, or change of frame cannot be represented in this way. • Homogeneous coordinates.
Homogeneous Coordinates • Represent frame change (translation) • Avoid point vs. vector confusion
Camera and World Frames In OpenGL, the model-view matrix positions the world frame relative to the camera frame.
One Frame of Cube Animation • Tasks: • Modeling (8 vertices, 12 edges) • Converting to the camera frame • Clipping • Projecting • Removing hidden surfaces • Rasterizing
Traversal of the Edges of a Polygon Counterclockwise: (0,3,2,1) (3,2,1,0) (2,1,0,3) (1,0,3,2) Outward facing
Projection of Polygon A polygon is first projected onto the two-dimensional plane and then filled with colors.
Scan-Line Interpolation OpenGL Approach
X’, y’ Computation of the Shear Matrix