Tag Archives: three points

Vertex angle from three points, Matlab code

I am sharing a Matlab code to get a vertex angle from three points.

This is the code, and you can download this one from here <Download>

 

function [ang] = get_vertex_ang_from_three_points(p0,p1,p2)

% get the vertex angle at p0 from three points p0,p1,p2
% p0, p1,p2 are two dim vector
%
%%% example
% p0=[0;0];p1=[1;0];p2=[0;1];
% get_vertex_ang_from_three_points(p0,p1,p2)
% answer = 1.57 (45 deg)
%%%

v1 = p1-p0;
v2 = p2-p0;
ang = acos(v1′v2/(norm(v1)norm(v2)));

It is very easy to use. you can get the vertex angle from three points, It is written in Matlab code

Good luck~~