-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcrossRatio.m
39 lines (35 loc) · 1.11 KB
/
crossRatio.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
function [ ratio ] = crossRatio( points )
% CROSSRATIO Cross ratio of four 1D points
%
% ## Syntax
% ratio = crossRatio( points )
%
% ## Description
% ratio = crossRatio( points )
% Returns the cross ratio of the four points.
%
% ## Input Arguments
%
% points -- Points on the projective line
% A 4-vector, where `points(i)` contains the coordinate of the i-th 1D point.
%
% ## Output Arguments
%
% ratio -- Cross ratio
% A scalar value equal to the cross ratio of `points`.
%
% ## Notes
% - The cross ratio computed by this formula does not change if the order
% of the input points is reversed.
%
% ## References
% Page 45 of Hartley, Richard, and Andrew Zisserman. Multiple View Geometry In Computer Vision.
% Cambridge, UK: Cambridge University Press, 2003. eBook Academic Collection
% (EBSCOhost). Web. 27 July 2016.
% Bernard Llanos
% Spring 2016 research assistantship supervised by Dr. Y.H. Yang
% University of Alberta, Department of Computing Science
% File created July 27, 2016
ratio = ((points(1) - points(2)) * (points(3) - points(4)))...
/ ((points(1) - points(3)) * (points(2) - points(4)));
end