MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given a list of 2-d points defining the vertices of a polygon, determine whether these points are sorted clockwise.

The inputs to this function are two vectors **x** and **y** (with equal size) containing the x- and y- coordinates of the polygon vertices, respectively.

The function should return true when sorted clockwise, and false when sorted counterclockwise (the polygon vertices will always be sorted either way).

Example:

x = [-1,-1,1,1]; y = [-1,1,1,-1];

defines a square, the vertices are listed clockwise

d_correct = true;

35 correct solutions
79 incorrect solutions

Last solution submitted on Mar 18, 2015

1 player likes this problem

1 Comment

James
on 6 Sep 2012

Didn't realize ispolycw was in the Mapping Toolbox, and not Cody friendly.

1 Comment