% lengthRatioConstraint - Affine transform constraints given a length ratio. % % Function calculates centre and radius of the constraint % circle in alpha-beta space generated by having a known % lenth ratio between two non-parallel line segemnts in % an affine image % % Usage: [c, r] = lengthRatioConstraint(p11, p12, p21, p22, s) % % Where: p11, p12 and p21, p22 are four points defining two line % segments having a known length ratio. % s is the known length ratio % c is the 2D coordinate of the centre of the constraint circle. % r is the radius of the centre of the constraint circle. % Peter Kovesi % School of Computer Science & Software Engineering % The University of Western Australia % pk @ csse uwa edu au % http://www.csse.uwa.edu.au/~pk % % April 2000 % % Equations from Liebowitz and Zisserman function [c, r] = lengthRatioConstraint(p11, p12, p21, p22, s) dp1 = p12-p11; dx1 = dp1(1); dy1 = dp1(2); dp2 = p22-p21; dx2 = dp2(1); dy2 = dp2(2); c = [(dx1*dy1 - s^2*dx2*dy2)/(dy1^2 - s^2*dy2^2), 0]; r = abs( s*(dx2*dy1 - dx1*dy2)/(dy1^2 - s^2*dy2^2) );