Code covered by the BSD License  

Highlights from
polyorient

Be the first to rate this file! 0 Downloads (last 30 days) File Size: 1.36 KB File ID: #10823

polyorient

by M MA

 

21 Apr 2006 (Updated 24 Apr 2006)

Orientation of polygon

| Watch this File

File Information
Description

Returns the orientation and signed area of a 2D polygon

Syntax:
[ORIENT,SAREA] = POLYORIENT(X,Y)

Inputs:
X, Y Vectors with the polygon vertices

Outputs:
ORIENT Polygon orientation. 1 if the orientation is counter-clockwise (direct), 0 otherwise
SAREA Signed area of the polygon, negative if orientation is not direct

Examples:
x1 = [0 0 1 1]; y1 = [1 2 2 1];
x2 = [0 0 1 1]; y2 = [1 0 0 1];
x3 = [x1 x2]; y3 = [y1 y2];

[o1,a1] = polyorient(x1,y1) % 0, -1
[o2,a2] = polyorient(x2,y2) % 1, 1
[o3,a3] = polyorient(x3,y3) % 0, 0

MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
polygon M MA 22 Oct 2008 08:22:54
orientation M MA 22 Oct 2008 08:22:54
2d M MA 22 Oct 2008 08:22:54
area M MA 22 Oct 2008 08:22:54
signed M MA 22 Oct 2008 08:22:54
orientation Evgeny 21 Jul 2011 12:01:04

Contact us at files@mathworks.com