Skip to content

NITIN23329/ShapeTransformation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

ShapeTransformation

This project facilitates transformation on a variety of closed shapes like circles, squares, pentagons, or any closed polygon. We can plot these shapes and can view the changes that are made after the transformation. For transformation, I used 'numpy' module and for plotting figures, I used 'matplotlib'.

The transformation that can be done are:

  1. We scale shapes by a given factor in both x and y directions.
  2. We can translate shapes along the x and y direction by a given amount.
  3. And even we can rotate them by a given angle and along a given axis of rotation.
  4. We can also see the coordinate of vertices in case of polygons and radius and centre in case of circle after the transformation.

Some Example shapes and their plots are shown below. Note: After the transformation is done, the black dotted figure represents the old figure before tansformation, and the red figure is the new figure after transformation.

In the case of a circle, options that are available are :

  1. R deg (rx) (ry)
  2. S sr
  3. T dx (dy)
  4. P

In the case of a polygon, options that are available are :

  1. R deg (rx) (ry)
  2. S sx (sy)
  3. T dx (dy)
  4. P

Note : the properties that are inside the parenthesis are optional.

Let say we have a circle having radius 3 and centred at (2,2).

Screenshot 2021-05-22 at 10 19 13

Then we rotate this circle by 145° anticlockwise and the axis of rotation is (1,1)

Screenshot 2021-05-22 at 10 19 19

Then let say we want to scale it by a factor 1.5

Screenshot 2021-05-22 at 10 19 25

Then let say we want to translate it by +2 along x axis and +3 along y axis

Screenshot 2021-05-22 at 10 19 29

Now let's have a pentagon with vertices at : (2,1), (4,1), (5,2), (3,3) and (1,2)

Screenshot 2021-05-22 at 10 59 10

Let say we translate it by -6 in x axis and +2 in y axis

Screenshot 2021-05-22 at 11 01 41

Then say we scale it by a factor 2 in x axis anf by 3 in y axis

Screenshot 2021-05-22 at 11 02 02

Then at last we rotate is by 55 degree along its centre

Screenshot 2021-05-22 at 11 02 35

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages