Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Translation | Geometric Transformations
Geometric Modelling with Python
Section 2. Chapter 2
single

single

Challenge: Translation

Swipe to show menu

Task

Swipe to start coding

Translate a polygon by a given vector.

Given a polygon represented as a list of (x, y) tuples and a translation vector (dx, dy), create a new list of tuples representing the translated polygon.

  • For each point in polygon, add vector[0] to the x-coordinate and vector[1] to the y-coordinate.
  • Return a new list containing all the translated points.
  • The function must not modify the original polygon list.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt