Be the first to rate this file! 5 Downloads (last 30 days) File Size: 19.76 KB File ID: #32110
image thumbnail

DISTANCE2LINE c++ mex

by Mehmet OZTURK

 

07 Jul 2011

Orthogonal euclidean distances of points to a line with c++ mex

| Watch this File

File Information
Description

[DISTANCES PROJ_POINTS]=DISTANCE2LINE(POINTS,LINE_SEG)

This function distance2line computes minimum euclidean distances (vertical distances) of "points" (nxm matrix which m=2,3) to a "line" (1xm which m=2,3). The input "line" is defined by its two points that lying on this line

The output "distances" is a nx1 vector matrix consisting of distances of points to the line. The second output "proj_points" is also a nxm matrix and this matrix gives the coordinates of vertically projected points onto the line.

I did not include any input error checking for the speed considerations because i use this function in a loop in MATLAB. So this function must be used with care.

You can use the provided example file for usage.

Mehmet OZTURK, 2011

MATLAB release MATLAB 7.12 (2011a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
05 Aug 2011 Mehmet OZTURK

MATLAB's Lcc compiler could give some errors on compilation. I have used Microsoft Visual Studio Express Edition 2010

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
orthogonal euclidean distance Mehmet OZTURK 07 Jul 2011 12:07:59
line Mehmet OZTURK 07 Jul 2011 12:07:59
mex Mehmet OZTURK 07 Jul 2011 12:07:59

Contact us at files@mathworks.com