Introduction to Computer Graphics
Lecture 4
Computer Graphics 3D Primitives
Don Herbison-Evans
don@it.uts.edu.au
(updated 23 August 2006)
3D Entities
Beware: 4 points or more may not be co-planar.
Only 3 are guaranteed flat.
Operations
More about Planes
(1)
Solve by using just the first 3 equations with D=1,
then scaling resulting values of A,B,C, (and D) by dividing by r:
Alternatively, solve them by evaluating 3x3 determinants of a matrix composed of the components of the points and columns of '1's. See book for details.
For any point in 3D space, the value of ' f ' :-
BRep Tables
For each polyhedron in a scene, could have 9 tables:
Save space using the Winged-Edge system:
Where does a line strike a face?
Express the line as:
Check if the resulting point is on the face by projecting it and the vertices of the face into 2 dimensions (eg by ignoring the z coordinate), and doing the 2D test of a point being in a polygon.
Is a point inside a polyhedron?
2 algorithms :-
(1)
(1) Use 5 Platonic solids directly from OpenGL
(2) Use sweeping plus a polygon to create a prism
(3) Use CSG (Constructive Solid Geometry: union, intersection, difference)
(4) Use Shape Grammar and CSG.
Validating a polyhedron
To check absence of holes or partly attached faces, edges, and vertices, ensure that:
(1) Every vertex appears in at least 3 edge lists
(2) Every vertex appears in at least 3 face lists
(3) Every edge appears in exactly 2 vertex lists
(4) Every edge appears in exactly 2 face lists
(5) Every face has at least 3 vertices
(6) Every face has at least 3 edges