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

Translation of Shapes

Svep för att visa menyn

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?

Vänligen välj det korrekta svaret

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 1

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

Avsnitt 2. Kapitel 1
some-alt