0% found this document useful (0 votes)
8 views5 pages

Transformation of Point and Line

The document outlines various geometric transformations applied to points and lines, including scaling, reflection, shearing, rotation, and translation. It also includes calculations for distances between points, checks for collinearity, and computes the area and perimeter of a triangle defined by three points. The transformations are demonstrated using a point and transformation matrices in Python.

Uploaded by

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

Transformation of Point and Line

The document outlines various geometric transformations applied to points and lines, including scaling, reflection, shearing, rotation, and translation. It also includes calculations for distances between points, checks for collinearity, and computes the area and perimeter of a triangle defined by three points. The transformations are demonstrated using a point and transformation matrices in Python.

Uploaded by

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

# If the line with points A(1,0) and B(0,1) is transformed by the transformation matrix [T] = [5, 0; 0, 1],

then find equation of transformed line #

A=Point(1,0)

B=Point(0,1)

A1=A.transform(Matrix([[5,0,1],[0,1,0],[0,0,1]]))

B1=B.transform(Matrix([[5,0,1],[0,1,0],[0,0,1]]))

L=Line(A1,B1)

L.equation ()

# the distance between two points:

p1=Point (1, 1)

p2=Point (2, 2)

p1.distance (p2)

#Apply each of the following transformation on the point p= [1,0].

# 1. Scaling in x co-ordinate by factor 2.

# 2. Scaling in y co-ordinate by factor 3.

# 3. Scaling in x and y coordinates by factors 2 and 3 respectively.

# 4. Uniform Scaling by factor 2.

#5. Reflection through x-axis.

#6. Reflection through y-axis.

#7. Reflection through the line x + y = 0.

#8. Reflection through the line x - y = 0.

#9. Reflection through origin.

#10. Shearing in x-coordinate by factor 2.


#11. Shearing in y-coordinate by factor 3.

#12. Shearing in x and y coordinates by factor 2 and 3 respectively.

#13. Rotation about origin by angle 90 0 .

#14. Rotation about origin by angle -90 0 .

#15. Translation in x direction by factor 2.

#16. Translation in y direction by factor 3.

#17. Translation in x and y directions by factors 2 and 3 respectively.#

#Solutions:

from sympy import*

p=Point(1,0)

#1. Scaling in x co-ordinate by factor 2.

print(p.transform(Matrix([[2,0,0],[0,1,0],[0,0,1]])))

#2. Scaling in y co-ordinate by factor 3.

print(p.transform(Matrix([[1,0,0],[0,3,0],[0,0,1]])))

#3. Scaling in x and y coordinates by factors 2 and 3 respectively.

print(p.transform(Matrix([[2,0,0],[0,3,0],[0,0,1]])))

#4. Uniform Scaling by factor 2.

print(p.transform(Matrix([[2,0,0],[0,2,0],[0,0,1]])))

#5. Reflection through x-axis.

print(p.transform(Matrix([[1,0,0],[0,-1,0],[0,0,1]])))

#6. Reflection through y-axis.

print(p.transform(Matrix([[-1,0,0],[0,1,0],[0,0,1]])))

#7. Reflection through the line x + y = 0.

print(p.transform(Matrix([[0,-1,0],[-1,0,0],[0,0,1]])))

#8. Reflection through the line x - y = 0.


print(p.transform(Matrix([[0,1,0],[1,0,0],[0,0,1]])))

#9. Reflection through origin.

print(p.transform(Matrix([[-1,0,0],[0,-1,0],[0,0,1]])))

#10. Shearing in x-coordinate by factor 2.

print(p.transform(Matrix([[1,0,0],[2,1,0],[0,0,1]])))

#11. Shearing in y-coordinate by factor 3.

print(p.transform(Matrix([[1,3,0],[0,1,0],[0,0,1]])))

#12. Shearing in x and y coordinates by factor 2 and 3 respectively.

print(p.transform(Matrix([[1,3,0],[2,1,0],[0,0,1]])))

#13. Rotation about origin by angle 90 0 .

print(p.transform(Matrix([[0,1,0],[-1,0,0],[0,0,1]])))

#14. Rotation about origin by angle -90 0 .

print(p.transform(Matrix([[0,-1,0],[1,0,0],[0,0,1]])))

#15. Translation in x direction by factor 2.

print(p.transform(Matrix([[1,0,0],[0,1,0],[2,0,1]])))

#16. Translation in y direction by factor 3.

print(p.transform(Matrix([[1,0,0],[0,1,0],[0,3,1]])))

#17. Translation in x and y directions by factors 2 and 3 respectively.

print(p.transform(Matrix([[1,0,0],[0,1,0],[2,3,1]])))

# Collinear points #

from sympy import*

p1=Point(1,1)

p2=Point(2,2)

p3=Point(3,3)
p4=Point(1,4)

Point.is_collinear (p1, p2, p3)

# Distance between points #

The distance between two points:

p1=Point(1,1)

p2=Point(2,2)

p1.distance(p2)

# Write a Python program to find area and perimeter of the triangle ABC where A[0, 0],B[5, 0],C[3, 3].

from sympy import*

A=Point(0,0)

B=Point(5,0)

C=Point(3,3)

a=A.distance(B)

b=A.distance(C)

c=B.distance(C)

print(a)

print(b)

print(c)

# Perimeter

p=a+b+c

print(p)

# Area

s=(a+b+c)/2

d=s*(s-a)*(s-b)*(s-c)

Area=sqrt(d)
print(Area)

You might also like