COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015.

Slides:



Advertisements
Similar presentations
Computer Graphics Lecture 3 Modeling and Structures.
Advertisements

Computer Graphics- SCC 342
OpenGL: Simple Use Open a window and attach OpenGL to it Set projection parameters (e.g., field of view) Setup lighting, if any Main rendering loop –Set.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
CMPE 466 COMPUTER GRAPHICS
CS 450: COMPUTER GRAPHICS FILLING POLYGONS SPRING 2015 DR. MICHAEL J. REALE.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Constructing Objects in Computer Graphics
1 Planes, Polygons and Objects ©Anthony Steed
2 COEN Computer Graphics I Evening’s Goals n Discuss the fundamentals of lighting in computer graphics n Analyze OpenGL’s lighting model n Show.
Characteristics of 3-D Shapes
Extended Gaussian Images
2IV60 Computer graphics Graphics primitives and attributes Jack van Wijk TU/e.
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
Chapter 12: Surface Area and Volume of Solids
Two- and Three-Dimensional Figures
CS 450: Computer Graphics OVERVIEW OF POLYGONS
CPCS 391 Computer Graphics 1 Lecture 5: Polygon Filling
CS447/ Realistic Rendering -- Solids Modeling -- Introduction to 2D and 3D Computer Graphics.
Computer Graphics - Class 14
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
2003 by Jim X. Chen: Introduction to Modeling Jim X. Chen George Mason University.
ENDS 375 Foundations of Visualization Geometric Representation 9/30/04.
ENDS 375 Foundations of Visualization Geometric Representation 10/5/04.
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
CS-321 Dr. Mark L. Hornick 1 3-D Object Modeling.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
COMP 175: Computer Graphics March 24, 2015
7.1 Scalars and vectors Scalar: a quantity specified by its magnitude, for example: temperature, time, mass, and density Chapter 7 Vector algebra Vector:
C O M P U T E R G R A P H I C S Stuff Jian Chen January 15, 2010 Transformations 1/10 Describing Shape By Andries van Dam.
A solid figure 3 dimensional figure.
Part 6: Graphics Output Primitives (4) 1.  Another useful construct,besides points, straight line segments, and curves for describing components of a.
Object Representation Rama C Hoetzlein, 2010 Univ. of California Santa Barbara Lecture Notes.
Geometric Modeling. Volumetric o Collection device obtains regular grid of measurement values Examples: CT, MRI, PET, Ultrasound o Values are interpreted/visualized.
Polygons A Polygon is a closed plane figure formed by 3 or more segments Each segment intersects exactly 2 other segments only at their endpoints. No.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Three-Dimensional Solids Polyhedron – A solid with all flat surfaces that enclose a single region of space. Face – Each flat surface of the polyhedron.
7.1 Three- Dimensional Figures I can classify and draw three-dimensional figures.
Computer Graphics Basic 3D Geometry CO2409 Computer Graphics Week 5-1.
12.1 – Explore Solids.
Background Mathematics Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
12.1 & 12.2 – Explore Solids & Surface Area of Prisms and Cones.
1 Dr. Scott Schaefer Intersecting Simple Surfaces.
CSE554ContouringSlide 1 CSE 554 Lecture 4: Contouring Fall 2015.
Vertices, Edges and Faces By Jordan Diamond. Vertices In geometry, a vertices is a special kind of point which describes the corners or intersections.
Polygons 6-1. Definition of Polygon A polygon is a closed figure formed by an finite number of coplanar segments such that  the sides that have a common.
Nets Nets A net is a pattern that you cut out and fold to form a 3 - dimensional figure.
Geometry: A Year Around By: Kourtney Mansfield. Chapter 1: Points, Lines, and Planes Point – Has no dimension. Usually represented by a small dot. Point.
12.1 Exploring Solids.
Attributes A quality that is characteristic of someone or something.
In the name of God Computer Graphics Bastanfard. Curve Function(2) Other method is approximate it using a poly-line. Just locate a set of points along.
3D Object Representations graphics scenes contain solid geometric objects trees, flowers, clouds, rocks, water representations surface ↔interior models.
Geometry Vocabulary. Triangle Triangle: a polygon with three sides. 180⁰ Sum of the interior angles of a triangle = 180⁰.
Introduction to Meshes Lecture 22 Mon, Oct 20, 2003.
7.1 Three- Dimensional Figures I can classify and draw three-dimensional figures.
Computer Graphics Lecture 08 Taqdees A. Siddiqi Computer Graphics Filled Area Primitives I Lecture 08 Taqdees A. Siddiqi
Introduction to 3D Solids and Solids of Revolution Some 3D shapes can be formed by revolving a 2D shape around a line (called the axis of revolution).
Unit-4 Geometric Objects and Transformations- I
Constructing Objects in Computer Graphics
Unit 11: 3-Dimensional Geometry
Chapter 12 Math 181.
Intersecting Simple Surfaces
Engineering Geometry Engineering geometry is the basic geometric elements and forms used in engineering design. Engineering and technical graphics are.
Constructing Objects in Computer Graphics By Andries van Dam©
Unit 11: 3-Dimensional Geometry
Polygons.
Presentation transcript:

COMP 175 | COMPUTER GRAPHICS Remco Chang1/6103b – Shapes Lecture 03b: Shapes COMP 175: Computer Graphics February 3, 2015

COMP 175 | COMPUTER GRAPHICS Remco Chang2/6103b – Shapes  Points vs. Vectors  What are basis vectors?  In 2D, what 2 vectors cannot be basis vectors?  What is:  a unit vector  a normal vector  a null vector?  Vector math:  Add, subtract, multiple (by scalar)  Normalize a vector  What is a cross product?  How do you find the cross product?  Different ways to think about the cross product?  What is a dot product?  How do you find the dot product?  Different ways to think about the dot product?  Given two vectors A, B, show that the cross product N is orthogonal to A and B. Quick Review of Linear Algebra

COMP 175 | COMPUTER GRAPHICS Remco Chang3/6103b – Shapes  Lines and Polyline  Polyline: lines drawn between ordered points  Polygon  If the first and last points of a polyline are the same point, then the polyline is said to be “closed”, and that the closed polyline forms a polygon  Self-intersected polyline 2D Object Definition simple polygon, closed polyline not closed, simple polyline not simple polygon, closed polyline

COMP 175 | COMPUTER GRAPHICS Remco Chang4/6103b – Shapes  Convex and Concave polygons  Convex: for every pair of points inside the polygon, the line between them is entirely inside the polygon  Concave: for some pair of points inside the polygon, the line between them is not entirely inside the polygon. Not convex. 2D Object Definition convex concave

COMP 175 | COMPUTER GRAPHICS Remco Chang5/6103b – Shapes  Why is a convex polygon so awesome? 2D Object Definition

COMP 175 | COMPUTER GRAPHICS Remco Chang6/6103b – Shapes  Why is a convex polygon so awesome?  Center of mass  Tessellation  Subdivision  Fixed boundary  Exactly two intersections  All diagonals are within the boundary  Tessellation -> computing the area  Every interior angle is less than 180  Etc. 2D Object Definition

COMP 175 | COMPUTER GRAPHICS Remco Chang7/6103b – Shapes  Circle  Set of all points equidistant from one point called the center  The distance from the center is the radius r  The equation for a circle centered at (0, 0) is r 2 = x 2 + y 2 Special Polygons TriangleSquareRectangle (0, y) (0, x) r (0, 0) (x, y)

COMP 175 | COMPUTER GRAPHICS Remco Chang8/6103b – Shapes  A circle can be approximated by a polygon with many sides.  Axis aligned ellipse: a circle scaled in the x and/or y direction 2D Object Definition

COMP 175 | COMPUTER GRAPHICS Remco Chang9/6103b – Shapes  Vertex and Edge tables  General purpose, minimal overhead, reasonably efficient  Each vertex listed once  Each edge is an ordered pair of indices to the vertex list Representing Shapes Vertices 0(0, 0) 1(2, 0) 2(0, 1) 3(2, 1) 4(1, 1.5) Edges 0(0, 1) 1(1, 3) 2(3, 4) 3(4, 2) 4(2, 0) E4E4 E3E3 E2E2 E0E0 E1E1 V0V0 V1V1 V2V2 V3V3 V4V4

COMP 175 | COMPUTER GRAPHICS Remco Chang10/6103b – Shapes  Most common representation of shape in three dimensions  All vertices of triangle are guaranteed to lie in one plane  (not true for quadrilaterals or other polygons)  Uniformity makes it easy to perform mesh operations such as subdivision, simplification, transformation etc.  Many different ways to represent triangular meshes Triangle Meshes

COMP 175 | COMPUTER GRAPHICS Remco Chang11/6103b – Shapes  Vertex, Face, (and Normal) Tables Triangular Mesh Representation Vertex List v0 0, 0, 0 f0 f1 f12 f15 f7 v1 1, 0, 0 f2 f3 f13 f12 f1 v2 1, 1, 0 f4 f5 f14 f13 f3 v3 0, 1, 0 f6 f7 f15 f14 f5 v4 0, 0, 1 f6 f7 f0 f8 f11 v5 1, 0, 1 f0 f1 f2 f9 f8 v6 1, 1, 1 f2 f3 f4 f10 f9 v7 0, 1, 1 f4 f5 f6 f11 f10 v8.5,.5, 0 f8 f9 f10 f11 v9.5,.5, 1 f12 f13 f14 f15 Face List f0v0 v4 v5 f1v0 v5 v1 f2v1 v5 v6 f3v1 v6 v2 f4v2 v6 v7 f5v2 v7 v3 f6v3 v7 v4 f7v3 v4 v0 f8v8 v5 v4 f9v8 v6 v5 f10v8 v7 v6 f11v8 v4 v7 f12v9 v5 v4 f13v9 v6 v5 f14v9 v7 v6 f15v9 v4 v7 v0 v1v2 f3 f2 f1 f0 f9 v8 v4 v7 v6 f10 f8 f11 v5

COMP 175 | COMPUTER GRAPHICS Remco Chang12/6103b – Shapes Questions?

COMP 175 | COMPUTER GRAPHICS Remco Chang13/6103b – Shapes Normals

COMP 175 | COMPUTER GRAPHICS Remco Chang14/6103b – Shapes Calculating Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang15/6103b – Shapes 3D Barn Shape

COMP 175 | COMPUTER GRAPHICS Remco Chang16/6103b – Shapes 3D Barn Shape

COMP 175 | COMPUTER GRAPHICS Remco Chang17/6103b – Shapes 3D Barn Shape

COMP 175 | COMPUTER GRAPHICS Remco Chang18/6103b – Shapes  3D meshes can be represented as vertices, (edges), faces, and normals  Are there other ways to encode 3D meshes? Other Possible Encodings

COMP 175 | COMPUTER GRAPHICS Remco Chang19/6103b – Shapes Parametric Shapes

COMP 175 | COMPUTER GRAPHICS Remco Chang20/6103b – Shapes  2.5D objects are 3D objects that are “protrusions” or “extensions” of 2D shapes (i.e., 2D shape + height) 2.5D Objects

COMP 175 | COMPUTER GRAPHICS Remco Chang21/6103b – Shapes 3D Extrusions

COMP 175 | COMPUTER GRAPHICS Remco Chang22/6103b – Shapes  A spring can be described in Cartesian coordinate system as:  Or in cylindrical coordinate as: 3D Extrusions

COMP 175 | COMPUTER GRAPHICS Remco Chang23/6103b – Shapes Surfaces from Revolutions

COMP 175 | COMPUTER GRAPHICS Remco Chang24/6103b – Shapes  We can think of the shapes in assignment 2 the same way... ““Vertices in Motion”  So we can make 3D shapes out of 2D and 1D primitives Technically...

COMP 175 | COMPUTER GRAPHICS Remco Chang25/6103b – Shapes Questions?

COMP 175 | COMPUTER GRAPHICS Remco Chang26/6103b – Shapes  These two have the same number of quads…  What is the difference? GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang27/6103b – Shapes GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang28/6103b – Shapes glNormal3f(nx, ny, nz); glBegin(GL_QUADS); glVertex3f(x1, y1, z1); glVertex3f(x2, y2, z2); glVertex3f(x3, y3, z3); glVertex3f(x4, y4, z4); glEnd(); GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang29/6103b – Shapes glBegin(GL_QUADS); glNormal3f(nx1, ny1, nz1); glVertex3f(x1, y1, z1); glNormal3f(nx2, ny2, nz2); glVertex3f(x2, y2, z2); glNormal3f(nx3, ny3, nz3); glVertex3f(x3, y3, z3); glNormal3f(nx4, ny4, nz4); glVertex3f(x4, y4, z4); glEnd(); GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang30/6103b – Shapes  What are the normals?  For a circle / sphere?  For a cube?  For a cylinder?  For a cone?  How do you define what a normal is? GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang31/6103b – Shapes  What are the normals?  For a circle / sphere?  For a cube?  For a cylinder?  For a cone?  Thinking of the normal of a curved surface as the normal to the tangent plane GL Normal

COMP 175 | COMPUTER GRAPHICS Remco Chang32/6103b – Shapes  Write a render function that takes in two parameters, radius and slices, and produces a 2D circle drawn as a set of polylines (assume centered at (0,0)), with a defined normal for each vertex  That is, fill in this function: void drawCircle2D(float radius, int slices) { : glBegin (...); for (int i=0; i<...) { : glNormal2f(...); glVertex2f(...); } glEnd(); } Exercise

COMP 175 | COMPUTER GRAPHICS Remco Chang33/6103b – Shapes Questions?