0% found this document useful (0 votes)
14 views3 pages

2D Transformation MATLAB Report

The document outlines a MATLAB program for performing 2D geometric transformations including translation, rotation, scaling, and reflection on lines and planes. It provides mathematical formulations for each transformation using 3x3 matrices in homogeneous coordinates and includes a sample MATLAB script demonstrating the transformations. The program serves as a foundational tool for applications in computer graphics and geometry.

Uploaded by

meetpaghdar900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

2D Transformation MATLAB Report

The document outlines a MATLAB program for performing 2D geometric transformations including translation, rotation, scaling, and reflection on lines and planes. It provides mathematical formulations for each transformation using 3x3 matrices in homogeneous coordinates and includes a sample MATLAB script demonstrating the transformations. The program serves as a foundational tool for applications in computer graphics and geometry.

Uploaded by

meetpaghdar900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2D Transformation of Lines and Planes using MATLAB

2D Transformation of Lines and Planes using MATLAB

Prepared by: ChatGPT

Objective

To develop a MATLAB program for performing 2D geometric transformations such as translation, rotation,

scaling, and reflection on lines and planes.

Theory

2D transformations modify the position, size, and orientation of objects in a plane. Common transformations

include:

- Translation: Moves an object by a certain distance.

- Rotation: Rotates an object about the origin or a specified point.

- Scaling: Enlarges or reduces the size of an object.

- Reflection: Flips the object about an axis.

These transformations are represented using 3x3 matrices in homogeneous coordinates.

Mathematical Formulation

A point (x, y) in 2D is represented as [x y 1] in homogeneous coordinates.

Transformation matrices:

Translation: T(tx, ty) = [[1 0 tx]; [0 1 ty]; [0 0 1]]


2D Transformation of Lines and Planes using MATLAB

Rotation (angle theta): R(theta) = [[cos(theta) -sin(theta) 0]; [sin(theta) cos(theta) 0]; [0 0 1]]

Scaling: S(sx, sy) = [[sx 0 0]; [0 sy 0]; [0 0 1]]

Reflection about X-axis: [[1 0 0]; [0 -1 0]; [0 0 1]]

Reflection about Y-axis: [[-1 0 0]; [0 1 0]; [0 0 1]]

MATLAB Code

Below is a sample MATLAB script for 2D transformation of lines:

% Define line points

P1 = [0; 0; 1];

P2 = [1; 1; 1];

% Translation matrix

T = [1 0 2; 0 1 3; 0 0 1];

% Rotate 45 degrees

theta = pi/4;

R = [cos(theta) -sin(theta) 0; sin(theta) cos(theta) 0; 0 0 1];

% Apply transformations

P1_new = R * T * P1;

P2_new = R * T * P2;

% Plot original and transformed lines

plot([P1(1), P2(1)], [P1(2), P2(2)], 'b'); hold on;

plot([P1_new(1), P2_new(1)], [P1_new(2), P2_new(2)], 'r');

legend('Original Line', 'Transformed Line'); grid on;


2D Transformation of Lines and Planes using MATLAB

Sample Output

The script plots a blue line as the original and a red line as the transformed version. The transformations shift

and rotate the line in the 2D plane.

Similar techniques can be applied to a set of points defining a polygon or plane shape.

Conclusion

This MATLAB program demonstrates how basic 2D geometric transformations can be implemented. It serves

as a foundation for further applications in computer graphics and geometry.

References

- MATLAB Documentation

- Gonzalez & Woods, 'Digital Image Processing'

- Foley et al., 'Computer Graphics: Principles and Practice'

You might also like