Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Scaling of Shapes | Geometric Transformations
Geometric Modelling with Python

Scaling of Shapes

Pyyhkäise näyttääksesi valikon

Scaling is a fundamental geometric transformation that changes the size of a shape while preserving its overall structure. When you apply scaling to a geometric figure, each point of the shape moves closer to or further from a fixed point, usually the origin, by a specific factor. This process can be uniform, where all dimensions are scaled by the same factor, or non-uniform, where different dimensions are scaled by different factors.

In uniform scaling, every coordinate of each point is multiplied by the same value. This keeps the proportions of the shape the same, so a square remains a square, and a circle remains a circle—just larger or smaller. In non-uniform scaling, each coordinate axis can have a different scaling factor. For instance, you might stretch a rectangle horizontally while keeping its height the same, turning it into a wider rectangle.

Scaling transformations are commonly used in computer graphics, modeling, and design to resize objects or adjust their proportions. When you scale a shape, its area and perimeter change in predictable ways: for uniform scaling by a factor of k, the perimeter is multiplied by k, and the area by k^2. However, non-uniform scaling can distort the shape, changing angles and relative side lengths.

12345678910111213141516171819202122232425262728
import numpy as np import matplotlib.pyplot as plt def scale_polygon(vertices, scale_x, scale_y): scale_matrix = np.array([[scale_x, 0], [0, scale_y]]) return vertices @ scale_matrix.T # Define a triangle triangle = np.array([[1, 1], [3, 1], [2, 3], [1, 1]]) # Uniform scaling by factor 2 scaled_uniform = scale_polygon(triangle, 2, 2) # Non-uniform scaling: x by 2, y by 0.5 scaled_nonuniform = scale_polygon(triangle, 2, 0.5) # Plot original and scaled triangles plt.figure(figsize=(6, 6)) plt.plot(triangle[:,0], triangle[:,1], 'o-', label='Original') plt.plot(scaled_uniform[:,0], scaled_uniform[:,1], 'o-', label='Uniform scale (2x)') plt.plot(scaled_nonuniform[:,0], scaled_nonuniform[:,1], 'o-', label='Non-uniform scale (2x, 0.5y)') plt.legend() plt.axis('equal') plt.title('Scaling Transformations of a Triangle') plt.xlabel('X') plt.ylabel('Y') plt.show()
question mark

Which of the following statements about scaling transformations is correct?

Valitse oikea vastaus

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 5

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Osio 2. Luku 5
some-alt