Download presentation
Presentation is loading. Please wait.
1
CPT 450 Computer Graphics 5th Lecture
2
Explicit Definition of a Function
The function explicitly defines one variable in terms of the others. In other words, y or z is isolated on one side of the “=“ y = F(x) (2D) z = F(x, y) (3D) i.e. y = 2*x -3 y = sqrt(r 2 - x2) y = -sqrt(r 2 - x2) (another solution) z = sqrt(r 2 - x2 - y2) (hemisphere)
3
Implicit Definition of a Function
The definition of the function is not stated explicitly in the equation. Instead, it is implied by an equation. In other words, y or z is not isolated on one side of the “=“ F(x,y) = 0 2D example: Circle x2 + y2 = r 2 F(x,y,z) = 0 3D example: Sphere x2 + y2 + z2 = r 2
4
Parametric Equation of a Curve
x = x(t) y = y(t) z = z(t) (for 3 D Curves) where t is a parameter, and is defined in some range such as [0,1] A series of points on the curve can be generated by looping on t, and calculating x(t), and y(y)
5
How to draw a parametric curve
Dim lastPt, pt as pointF Const dt = 0.1 ‘ step size lastPt.x = x(0) lastPt.y = y(0) For t = dt to 1 step dt pt.x = x(t) pt.y = y(t) g.drawLine(pen, lastPt, pt) lastPt.x = pt.x lastPt.y = pt.y Next t
6
Graphing Calculator Using this approach, you could create a simple graphing calculator program. Need to know the domain and range of the function, i.e. Domain t = [0,1] Range x(t), and y(t) Find the minimum and maximun values for x(t) and y(t). Then scale to fit on the form or picture box. Choose a reasonable value for dt, so that the line segments are not too visible and yet not to slow down the drawing by redrawing the same pixels. You will need to define the functions for x(t) and y(t) in your program or you can parse them from user input. This is more difficult.
7
Example: Using enumerated types in VB.Net
Hint: You might want to use these to clean up your program ' a list of the drawing mode type constants Public Enum drawModeType As Integer dmText = 0 dmPoint = 1 dmLine = 2 ' etc... End Enum Dim drawMode As drawModeType
8
Font Types Device Fonts (i.e. Printer Fonts)
GDI Fonts (Windows Fonts stored in c:\windows\fonts) Raster or Bitmap Fonts (generally, not scaleable – designed for one size) Stroke or Vector Fonts (scaleable) Modern, Roman and Scripts TrueType. Outline fonts. Composed of lines and curves. Scaleable. Developed by Apple and Microsoft. (Examples Courier, Times New Roman, Arial and Symbol) OpenType. Outline fonts. Scaleable. Developed by Adobe and Microsoft. Combines TrueType and Type 1 Outline format of Adobe’s page description language (Ex. Verdana) ClearType Developed by Microsoft for LCDs. Allows pixels to be in intermediate states besides on and off. AntiAliasing.
9
HSV or HSB Sometimes colors are represented in Hue Saturation and Value or Brightness Space. This can be represented in 3D as a cone See the following screen shots from the GDI ColorChooser program on the next few pages or, better, run this demo
10
Standard Color Dialog
11
Select Color 1
12
Select Color 2
13
6 Faces of the RGB Color Cube (in no particular order)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.