Translation of Shapes
Swipe to show menu
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.
12345678910111213141516171819def 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)
Everything was clear?
Thanks for your feedback!
Section 2. Chapter 1
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Section 2. Chapter 1