Basic Transformations in Computer graphics
A Basic Transformations in Computer graphics is a way to change the position, size, shape, or orientation of a geometric object (like a point, line, shape, or even an entire image). Transformations map input points to output points.In mathematics, a transformation is a function that maps a set to itself or another set.
This means it takes an input (often a point, a vector, or a geometric shape) and produces a corresponding output according to a defined rule. Here’s a breakdown:
The main basic transformations are:
ransformation Type | What it Does? |
---|
Translation | Moves an object from one place to another |
Scaling | Changes the size of an object (enlarges or shrinks) |
Rotation | Rotates an object about a fixed point (origin or any point) |
Shearing | Distorts the shape of an object (slanting effect) |
Reflection | Creates a mirror image of an object |
1. Translation
Formula:
Definition: Moving an object from one location to another. (Basic Transformations in Computer graphics)

2. Scaling
- Definition: Increasing or decreasing the size of an object. (Basic Transformations in Computer graphics)
- Formula:

3. Rotation
- Definition: Rotating an object around the origin (or a point) by an angle θ. (Basic Transformations in Computer graphics)
- Formula:

4. Shearing
- Definition: Slanting the shape of an object.
- Types:
- X-Shear: shifts x-coordinate proportionally to y.
- Y-Shear: shifts y-coordinate proportionally to x.
- Formulas:

5. Reflection
- Definition: Mirroring the object across a line (x-axis, y-axis, origin, or diagonal). (Basic Transformations in Computer graphics)
- Matrix forms:
- Reflection about X-axis:

What are Composite Transformations?
Two or more individual transformations are combined into one matrix. This allows you to apply several transformations to an object in a single step, rather than applying each transformation separately. (Basic Transformations in Computer graphics)
Why Composite Transformations?
- Efficiency: Combining multiple transformations reduces the number of calculations required.
- Simplicity: Instead of applying each transformation step by step, you can use a single transformation matrix. (Basic Transformations in Computer graphics)
- Consistency: You can apply transformations in a single operation while preserving the object’s relative transformations (e.g., rotating and scaling an object at once).
How to Perform Composite Transformations?
When combining multiple transformations, the key is to multiply the corresponding transformation matrices. (Basic Transformations in Computer graphics)
For example, if we want to apply translation, scaling, and rotation to a point P(x,y)we multiply the corresponding matrices: Mcomposite=T×S×R
Where:
- T is the translation matrix.
- S is the scaling matrix.
- R is the rotation matrix.
Order of Multiplication Matters:
Matrix multiplication is not commutative, meaning the order in which you multiply the matrices affects the result. For example, Scaling then Rotation is different from Rotation then Scaling.

1. Reflection
Definition:
Reflection is a transformation that produces a mirror image of an object across a given axis or line.
Common Types of Reflection:

Effect:
- Reflection flips the object across the specified axis.
- Changes the signof coordinates accordingly.
Example:
Reflect point (3,4) about X-axis

2. Shearing
Definition:
Shearing is a transformation that distorts the shape of an object by shifting its points in a particular direction, giving it a slanting effect. (Basic Transformations in Computer graphics)
Types of Shearing:
Shearing Type | Transformation Matrix |
---|

Effect:
- X-Shear: Shifts x-coordinate in proportion to y.
- Y-Shear: Shifts y-coordinate in proportion to x.
- Changes shape but not area in simple cases.
Formulas:
- X-Shear: x′=x+Shx⋅y ,y’= y
- Y-Shear: x′=x y′=y+Shy⋅x
Viewing Pipeline (Graphics Pipeline)

Definition:
The Viewing Pipeline is the sequence of steps used to display a 3D or 2D object correctly on a 2D screen. It transforms objects from world coordinates to screen coordinates (Basic Transformations in Computer graphics)
Stages of the Viewing Pipeline:
- World Coordinates:
- Objects are defined in real-world measurements.
- Example: Meters, centimeters, etc.
- World to Viewing Coordinates (Modeling Transformation):
- Converts world coordinates to a viewing reference coordinate system.
- Defines position, orientation, and size of objects.
- Viewing Coordinates to Normalized Device Coordinates (NDC):
- The scene is fit into a normalized cube or rectangle (0 to 1 range).
- Clipping (Important Step):
- Removes objects or parts of objects outside the viewing area (window/viewport).
- Increases efficiency.
- Projection (Perspective / Orthographic):
- Maps 3D viewing coordinates to 2D projection plane.
- Orthographic: Parallel projection.
- Perspective: Distant objects appear smaller.
- Viewport Mapping (Window to Viewport Transformation):
- Converts coordinates to screen coordinates (pixels).
- Maps the “window” into the screen’s viewport area.
Windowing & Viewport Mapping
- A rectangular region in world coordinates selected for display.
- Defined by:
- Xwmin , Xwmax ,Ywmin, Ywmax
Viewport:
Xvmin, Xvmax, Yvmin ,Yvmax
A rectangular area on the display device (screen) where the window content is mapped. (Basic Transformations in Computer graphics)
Window to Viewport Transformation:
- Converts window coordinates to viewport (screen) coordinates.
Transformation Equations:

Viewing Transformations
Definition:
Viewing Transformation refers to the process of transforming the coordinates of objects from the world coordinate system to the view coordinate system, and finally to screen coordinates for display.
It helps in defining what part of the scene is visible and how it should appear on screen.
1. Coordinate Systems Involved
Coordinate System | Description |
---|---|
World Coordinate System (WCS) | Describes the entire scene using real-world measurements. |
Viewing Coordinate System (VCS) | Local coordinate system related to the camera (eye or view reference frame). |
Normalized Device Coordinates (NDC) | Standard coordinates ranging from 0 to 1. |
Device Coordinates (Screen) | Actual screen pixels where the image is displayed. |
2. Stages of Viewing Transformation
Step 1: World Coordinate → Viewing Coordinate
- Reposition and reorient the scene relative to the viewer.
- This involves:
- Translation (move view reference point to origin)
- Rotation (align view direction with Z-axis or viewing plane)
Step 2: Projection Transformation
- Convert 3D viewing coordinates to 2D coordinates.
- Types:
- Orthographic Projection (parallel lines remain parallel)
- Perspective Projection (distant objects appear smaller)
Step 3: Clipping
- Remove parts of objects outside the viewing volume (window). (Basic Transformations in Computer graphics)
Step 4: Normalization
- Transform coordinates to normalized device coordinates (NDC).
Step 5: Viewport Transformation
- Map normalized coordinates to actual screen coordinates (viewport).
3. Viewing Transformation Matrix
The overall viewing transformation is a combination of: Mview=Mviewport⋅Mprojection⋅Mviewing
Where:
- Mviewing: World to viewing coordinate transformation.
- Mprojection : Projection matrix (orthographic or perspective).
- Mviewport: Mapping to screen (viewport transformation).
1) 2D Clipping Algorithms
Clipping is the process of removing parts of objects that lie outside the specified viewing area (also known as the “clipping window”). The clipping window is typically a rectangle, and the goal of clipping algorithms is to find which parts of an object (usually a line or a polygon) are inside and should be displayed. (Basic Transformations in Computer graphics)
Line Clipping Algorithms are used to clip line segments against a rectangular clipping window. Two well-known algorithms are:
- Cohen-Sutherland Line Clipping Algorithm
- Liang-Barsky Line Clipping Algorithm
Types of Clipping:
Polygon Clipping: Clip polygons (such as triangles or rectangles)
Point Clipping: Clip individual points based on whether they lie inside the window.
Line Clipping: Clip line segments based on whether they are inside or outside the clipping window.
2 ) Cohen-Sutherland Line Clipping Algorithm
Basic Concept:
The Cohen-Sutherland algorithm divides the 2D space into 9 regions (using the clipping window boundaries), and it assigns a 4 bit code to each endpoint of the line to determine its position relative to the window. If both endpoints of the line lie inside the window, it is drawn as is. Otherwise, parts of the line are clipped. (Basic Transformations in Computer graphics)
Steps:
Assign Region Codes:
- Every point is assigned a 4 bit region based on its position relative to the clipping window.
- Top, Bottom, Left, Right
- Example: The region code is represented by bits: (Basic Transformations in Computer graphics)
Bit 1: Above
Bit 2: Below
Bit 3: Left
Bit 4: Right
Check Line’s Region:
- If both endpoints of the line are inside the window (i.e., both codes are
0000
), then the line is completely visible, and no clipping is required. (Basic Transformations in Computer graphics) - If both endpoints are outside the window and their region codes have no overlap (i.e., logical AND of codes is non-zero), then the line is entirely outside the window and can be discarded.
Line Intersection:
- If one or both endpoints are outside, calculate the intersection of the line with the clipping window boundaries. Modify the line’s endpoints accordingly.
Repeat Until Line is Inside or Outside:
- Continue the process until the line is either clipped completely inside the window or discarded.
Region Code Example:

3) Liang-Barsky Line Clipping Algorithm
Basic Concept:
The Liang-Barsky algorithm is an efficient method for line clipping. It is based on parametric equations of the line and uses inequalities to check if a line segment lies within the window. It does not require region codes or dividing the space into regions, making it faster than Cohen-Sutherland in many cases.
Steps:
- Parametric Line Equation:
- A line is represented parametrically as: x=x0+t(x1−x0) , y=y0+t(y1−y0)
- Where ttt is a parameter that varies from 0 to 1 for the line segment.
- Clipping the Line:
- For each of the 4 edges of the clipping window (top, bottom, left, right), compute the parameter ttt that corresponds to the intersection point of the line with the edge.

3 Determine Visible Segment:
- For each edge, check if the corresponding parameter ttt lies within the range [0, 1]. If it does, the intersection is part of the visible line. (Basic Transformations in Computer graphics)
- Modify the line’s endpoints accordingly and repeat until you have the clipped portion of the line.
4. Efficiency:
- Unlike Cohen-Sutherland, which involves checking multiple conditions for each endpoint, Liang-Barsky directly computes the intersection points using inequalities.
Also Read :- Computer graphics