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

Translation of Shapes

Sveip for å vise menyen

Translation is a fundamental geometric transformation that shifts every point of a shape by the same distance in a specified direction. Mathematically, translating a shape means adding a fixed vector to each of its points.

  • If a point has coordinates (x, y) and you want to move it by a vector (dx, dy), the new coordinates become (x + dx, y + dy). This operation preserves the size, shape, and orientation of the figure—it simply moves the entire shape to a new location.

Suppose you have a triangle with vertices at (1, 2), (3, 5), and (5, 4). If you translate this triangle by the vector (2, -1), the new vertices will be (3, 1), (5, 4), and (7, 3). Each vertex is shifted to the right by 2 units and down by 1 unit. This simple addition works for any shape represented as a collection of points.

12345678910111213141516171819
def translate_polygon(polygon, dx, dy): """ Translates a polygon by a vector (dx, dy). Args: polygon: List of (x, y) tuples representing the polygon's vertices. dx: Translation in the x-direction. dy: Translation in the y-direction. Returns: List of (x, y) tuples representing the translated polygon. """ return [(x + dx, y + dy) for (x, y) in polygon] # Example usage: triangle = [(1, 2), (3, 5), (5, 4)] translated_triangle = translate_polygon(triangle, 2, -1) print("Translated triangle:", translated_triangle)
question mark

Which of the following statements about translation is correct?

Velg det helt riktige svaret

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 1

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

Seksjon 2. Kapittel 1
some-alt