Computer Graphics: Algorithms, Transformations, and Projections
Line Drawing Algorithms
DDA (Digital Differential Analyzer)
DDA is an incremental scan conversion algorithm used in computer graphics for drawing a straight line between two endpoints on a raster display. It determines intermediate pixel positions by calculating the differences between X and Y coordinates. The larger absolute difference is taken as the number of steps. Increments are calculated and coordinates are updated step by step. Since results may contain fractional values, they are rounded to the nearest pixel. DDA is simple to implement but uses floating-point arithmetic, which may cause rounding errors.
Bresenham’s Line Drawing Algorithm
Bresenham’s algorithm is an efficient incremental method used to draw straight lines on a raster display. It selects the most appropriate pixel at each step using a decision parameter. Unlike DDA, it primarily uses integer arithmetic, avoiding floating-point calculations and repeated rounding. The decision parameter determines the next pixel based on the line’s slope, resulting in faster, more efficient, and smoother lines.
2D and 3D Transformations
Transformation is the process of changing the position, size, orientation, or shape of a graphical object.
Basic Transformations
- Translation: Moving an object from one position to another without changing its shape, size, or orientation.
- Rotation: Turning an object through a specified angle around a fixed point or axis.
- Scaling: Increasing or decreasing the size of an object using scaling factors.
- Reflection: Creating a mirror image of an object with respect to a particular axis or line.
- Shearing: Slanting or distorting an object by shifting points proportional to their distance from a reference axis.
Projections in Computer Graphics
A projection represents a 3D object on a 2D surface, such as a screen or paper, by converting 3D coordinates into 2D coordinates. It is essential in engineering, CAD, animation, and 3D modeling.
Types of Projection
Projections are classified into two main categories:
1. Parallel Projection
In parallel projection, all projection lines (projectors) remain parallel. The object size remains constant regardless of distance from the viewer.
- Orthographic Projection: Projectors are perpendicular (90°) to the plane. Used for front, top, and side views.
- Oblique Projection: Projectors are inclined to the plane. The front face appears in true shape while depth is represented at an angle.
2. Perspective Projection
In perspective projection, all lines meet at a single point called the Center of Projection (COP). Objects farther away appear smaller, providing a realistic representation.
- One-Point Perspective: Features one vanishing point.
- Two-Point Perspective: Features two vanishing points.
- Three-Point Perspective: Features three vanishing points, often used for tall structures.
Multimedia Technology
Multimedia integrates text, graphics, audio, video, and animation to present information interactively. It is widely used in education, entertainment, and business.
Core Multimedia Components
- Text: Provides titles, descriptions, and instructions.
- Graphics: Visual representations like charts, diagrams, and photos.
- Audio: Includes sound, music, and voice recordings.
- Video: A sequence of moving images, often with sound.
- Animation: Creating the illusion of motion through rapid image sequences.
