Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Uber for Massage 2.0
Job Board Software 1.1
RentALL - Airbnb Clone | Built with ReactJS 2.6
VB.Net PDF 2020.6.0
Flowrigami 1.0.0
SentiVeillance SDK Trial 7.3.2020.03.02
Entity Developer 6.8
dbExpress driver for SQLite 4.2
dbForge SQL Complete 6.5
Advanced Amazon Clone App 2.0
Appjetty Delivery Date Manager 1.0.0
The C# Barcode Library 2020.5.0
Chowtro - Online Restaurant Food Ordering Software 1.0
Alvas.Audio.Core 2019.0
Sainsburys Script 1.3.2
Top Code
dbForge SQL Complete 4.8
dbExpress Driver for SQLite 3.9
Availability Booking Calendar PHP 1.0
ATN Site Builder 3.0
ATN Resume Finder 2.0
Aglowsoft SQL Query Tools 8.2
Classified Ad Lister 1.0
Solid File System OS edition 5.1
Deals and Discounts Website Script 1.0.2
SentiVeillance SDK Trial 7.3.2020.03.02
PHP Review Script 1.0
ICPennyBid Penny Auction Script 4.0
Invoice Manager by PHPJabbers 3.0
Blobsmenu
PHP Taxi Booking Script 1.0.4
Top Rated
phpEnter 5.1.
Single Leg MLM 1.2.1
Azizi search engine script PHP 4.1.10
Paste phpSoftPro 1.4.1
Extreme Injector 3.7
Deals and Discounts Website Script 1.0.2
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
Invoice Manager by PHPJabbers 3.0
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
Calculation of distances from a given set of points to a set of segments 1.0
File ID: 80085






Calculation of distances from a given set of points to a set of segments 1.0
Download Calculation of distances from a given set of points to a set of segments 1.0http://www.mathworks.comReport Error Link
License: Freeware
File Size: 10.0 KB
Downloads: 11
Submit Rating:
Calculation of distances from a given set of points to a set of segments 1.0 Description
Description: CSMV calculates distances from a given set of points to a set of linear segments

SYNOPSIS: [squared_distances_to_segments I]=csmv(P,R,Q,to_plot)
[squared_distances_to_segments I]=csmv(P,R,Q,...)

INPUT P,R : arrays of coordinates of 2n segment endpoints
(i.e., if there are n segments considered in p-dimensional
Euclidean space, than P and R are n-by-p matrices); the sizes of P
and R should coincide; p should be greater than or equal to unity.
Q : an array of coordinates corresponding to the set of m points
from which distances to the segments PR are calculated
(Q should therefore be an m-by-p matrix).
to_plot : (optional) graphical output.
Any non-zero value would cause the graphical output. There will be
no graphical output by default (if this parameter is not passed).

OUTPUT squared_distances_to_segments : an n-by-m matrix whose j-th column
contains n squared distance from the j-th point of Q to the segments PR.
I : a vector of m elements representing indices of the segments PR
which are the closest to points from Q.

EXAMPLES (1-D, 2-D and 3-D cases with graphical outputs)

1) segments and points on the line
PR_segments = [10,-10; -1,0; 2.3,1; 5,9; 10,10.2]; % note that PR do not have
to be defined as directed segments! E.g. the third segment [2.3,1] in
PR_segments is defined as an undirected segment.
P = PR_segments(:,1); R = PR_segments(:,2);
[squared_distances_to_segments I]=csmv(P,R,Q)

OR

[squared_distances_to_segments I]=csmv(P,R,Q,1);

2) plane
P =[1 3;
4 6;
8 -1;
3 7]

R = [0 -1;
2 2;
3 1;
0.1 2]

Q =[4 1;
5 5;
-1 3.5;
-10 2;
10 -2]

to_plot=1; [squared_distances_to_segments I]=csmv(P,R,Q,to_plot)

3) 3-D space
P =[
1 3 5;
4 6 9;
8 -1 -9;
3 7 0]

R = [

0 -1.0000 -1;
2.0000 2.0000 2;
3.0000 1.0000 4;
0.1000 2.0000 7]

Q =[

4.0000 1.0000 0;
5.0000 5.0000 8;
-1.0000 3.5000 3;
-10.0000 2.0000 -1;
10.0000 -2.0000 -1]

[squared_distances_to_segments I] = csmv(P,R,Q,1);

License: Freeware

Related: points, nonzero, calculated, nbyp, and 3d, undirected, Array, mbyp, nbym, are the, greater, be no, default, calculates distances, Defined, be an, arrays, as an

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 11



More Similar Code

In this example you will learn the "function handler" from a "functor set" points-of-view. The functor set can store more than one function
handlers, so one can choose a function handler from a functor set and pass it to another function as an input argument.



Tag Posts Widget is a light widget to show posts from a given set of tag. Ispired by Category Posts Widget by James Lao - http://jameslao.com

Features:

* Select any number of tag to be shown.
* Add the tag browsed,...



The SBMLevolver is an evolutionary algorithm package that creates SBML models with user-specified properties and behaviour from a given set of building blocks. Applications lie in network reconstruction and synthetic biology.



ssprep is a tool that generates file-trees from a given set of templates. The intent is generation of project structures. The major design goals has been: * Simple. * Platform independent. * Configurable. * Recursive.



A blogroll-like module that displays a block of items from a given aggregator feed. Using votingapi.module, it allows users to flag items in the sidebar as interesting. If enough users flag an item, it will remain on the list rather than being...



The content distribution module is for managing distribution of content from a single central website to one or many remote websites via web services.

A typical set-up includes one single 'content distributing' Drupal instance with...



function [out]=random2(ini,fin,num)
% Choosse randomly a number (num) of elements from a vector [ini:fin]
% Randomly change the position of the vector. in pairs of twos
%
% Imput:
% ini: Beginning of the vector
% fin:...



This recipe finds the complement of a set of indices from a specific arange(n) array. Suppose, for example, you are given a linear array with 10 elements and you want to extract the elements from this array that have indices other than [1, 3, 5]....



This recipe yields each subset of size k from a super set of size n. I thought I had seen a recipe that did this before, but when I needed it I couldn't find it. There are two methods. The first operates on sets of integers of the form...



Want to get a value from a dictionary but want to make sure that the value exists in the dictionary? Then use the incredibly useful get method.

User Review for Calculation of distances from a given set of points to a set of segments
- required fields
     

Please enter text on the image