-
Notifications
You must be signed in to change notification settings - Fork 1
How to generate the RDP polygon
Basically we are using the two existing points (in this case, the starting and end points of a path) to
generate two pairs of points, each pair shares certain same distance, say
We can first think about the problem of transforming (panning and rotation which do not affect the shape and relative distance) the two existing points, say
We can use two steps to transform
- Panning:
$[(x_1,y_1),(x_2,y_2)] \rightarrow [(\frac{x_1-x_2}{2},\frac{y_1-y_2}{2}),(\frac{x_2-x_1}{2},\frac{y_2-y_1}{2})]$
NB: we set the middle point to be $(0,0)$ so that the following rotation does not affect the shape of polygon.
- Rotation: rotate the line linking the two points by
$-\theta$ , where$\theta = \arctan(\frac{y_2-y_1}{x_2-x_1})$ .
Let
With the transformation being done in mind, we can impose the reversed transformation over the specified polygon points.