0% found this document useful (0 votes)
2 views

function

The document contains a practical assignment focused on the graphical aspects of three-dimensional transformation matrices using matplotlib. It includes various questions that involve rotating, transforming, reflecting, and scaling line segments defined by specific points, along with the corresponding Python code to achieve these transformations. Each question provides the results of the transformations, demonstrating the application of mathematical concepts in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

function

The document contains a practical assignment focused on the graphical aspects of three-dimensional transformation matrices using matplotlib. It includes various questions that involve rotating, transforming, reflecting, and scaling line segments defined by specific points, along with the corresponding Python code to achieve these transformations. Each question provides the results of the transformations, demonstrating the application of mathematical concepts in programming.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Name : Kachare Pallavi Goraksha

Roll no : 2163
Program name : Study of graphical aspects of Threedimensional transformation
matrix using matplotlib
*********************************************************

Pratical No 7: (Pratical name: Study of graphical aspects of


Threedimensional transformation matrix using matplotlib)
*******************************************************************

Question no 1: Rotate the line passing through points A[1 1] and B[5 5] about origin through an angle 90
degree.

*************************************************************************************

>>> from sympy import *

>>> L=Line((1,1),(5,5))

>>> L.rotate(pi/2)

Line2D(Point2D(-1, 1), Point2D(-5, 5))

Question no 2: If the line segment joining the points A[2,5], B[4 -13] Is transformed to the line segment
A* B* by the transformation matrix [T]= [2 3] then find the midpoint of A* B*
[4 1]

Matrix of reflection in Python will be 3 × 3 matrix for reflection will be

2 3 0

4 1 0

0 0 1

>>> A=Point(2,5)
>>> B=Point(4,-13)

>>> A1=A.transform(Matrix([[2,3,0],[4,1,0],[0,0,1]]))

>>> B1=B.transform(Matrix([[2,3,0],[4,1,0],[0,0,1]]))

>>> L=Segment(A1,B1)

>>> L.midpoint

Point2D(-10, 5)

>>>

Question no 3: Reflect the line segment joining the points A[5 3] and B[1 4] through the line y=x+1

*************************************************************************************

>>> x,y=symbols('x,y')

>>> A=Point(5,3)

>>> B=Point(1,4)

>>> S=Segment(A,B)

>>> S.reflect(Line(x-y+1))

Segment2D(Point2D(2, 6), Point2D(3, 2))

>>>

Question no 4: Suppose that the line segment between the points A[1 4] and B [3 6] is transformed to
the line segment A* B* using the transformation matrix [T]= 2 -1 Find slope of the transformed
line segment A* B* 1 3

*************************************************************************************

>>> A=Point(1,4)

>>> B=Point(3,6)

>>> A1=A.transform(Matrix([[2,-1,0],[1,3,0],[0,0,1]]))

>>> B1=B.transform(Matrix([[2,-1,0],[1,3,0],[0,0,1]]))

>>> L=Segment(A1,B1)

>>> L.slope

2/3

>>>
Question no 5: Find the combined transformation of the line segment between the points A[4 -1] and
B[3 0] for the following sequence of transformations : First rotation about origin through an angle πc ;
followed by scaling in x coordinate by 3 units ; followed by reflection through the line y=x.

*************************************************************************************

>>> A=Point(4,-1)

>>> B=Point(3,0)

>>> S=Segment(A,B)

>>> S=S.rotate(pi)

>>> S=S.scale(3,0)

>>> points=S.points

>>> p=points[0]

>>> q=points[1]

>>> p1=p.transform(Matrix([[0,1,0],[1,0,0],[0,0,1]]))

>>> q1=q.transform(Matrix([[0,1,0],[1,0,0],[0,0,1]]))

>>> Segment(p1,q1)

Segment2D(Point2D(0, -12), Point2D(0, -9))

>>>

You might also like