translating this polygon to a new position

i am tryin to translate this polygon so the startin point is at -10 , 3. i keep getting an error code and its not working

1 Comment

Please attach the code using this button
Attach plot_polygon function

Sign in to comment.

 Accepted Answer

I don't know what your plot_polygon function does, but I'd probably create a polyshape object and translate it before plotting the translated polygon.
p = polyshape([0 1 1 0], [0 0 1 1]);
plot(p, 'DisplayName', 'original')
hold on
pt = translate(p, [2 3]);
plot(pt, 'FaceColor', 'r', 'DisplayName', 'translated')
legend show location northwest

More Answers (0)

Categories

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!