Code covered by the BSD License

### Highlights from Conics intersection

5.0
5.0 | 2 ratings Rate this file 21 Downloads (last 30 days) File Size: 6.54 KB File ID: #28318 Version: 1.5

# Conics intersection

### Pierluigi Taddei (view profile)

28 Jul 2010 (Updated )

Given the homogeneous matrices of two conics it recovers the (up to) four intersection points

File Information
Description

The homogeneous representation of a conic is a matrix
m = [A C D; C B E; D E F] that represents the equation
A x^2 + B y^2 + 2C xy + 2D x + 2Ey + F = 0

Given two matrix E1 and E2 representing two conics, the code will detect all their intersections.

For instance:
___________________
%a circle centered in the origin
E1 = [1 0 0; 0 1 0; 0 0 -3]

%an ellipse centered in the origin
E2 = [1 0 0; 0 3 0; 0 0 -6]

%get the four homogeneous intersections
P = intersectConics(E1, E2)

%plot the normalized points
plot(P(1,:) ./ P(3,:) , P(2,:) ./ P(3,:), 'ro');

___________________

and a detailed example describing the method: http://math.stackexchange.com/questions/316849/intersection-of-conics-using-matrix-representation

___________________
If this code was useful, please consider a donation:
Bitcoin: 1JeR6uRx28G8uAJ5XdkQBpwbgt4g8W9MoQ

MATLAB release MATLAB 7.6 (R2008a)
Tags for This File   Please login to tag files.
Comments and Ratings (3)
09 Mar 2013 Shahab

06 Oct 2012 do

### do (view profile)

I did make a mistake. The matrix of the second conic was wrong so your code cannot find the intersections. I checked my code and I found that the matrix of the second conic should be
E2 =[ -0.1642 0 0.1642;
0 8.8358 -15.4627;
0.1642 -15.4627 26.3578]

After receiving your email, I checked my code and corrected the second matrix. YOUR CODE WORKED PERFECTLY AND GAVE THE EXACT SOLUTION. Here is the result.

http://imageshack.us/a/img401/8209/83223264.png

Thank you very much for sharing your code and I really appreciate your kindness to reply my email and help me solve the problem.

06 Oct 2012 do

### do (view profile)

the code doesn't work. I tried with two conics having the matrix

E1 =[ 8.5914 0 -15.0350
0 -0.4086 0.4086
-15.0350 0.4086 24.5709]

E2 =[ 8.8358 0 -15.4627
0 -0.1642 0.1642
-15.4627 0.1642 26.3578]

but the result is an empty intersection matrix. Though these two conics have 4 intersections as you can see in the figure I wrote in Matlab

http://imageshack.us/a/img90/4468/38292011.png

Comment only
03 Nov 2010 1.1

changed URL

15 Oct 2012 1.3

v.1.0.3: bug fixes (degenerate case)

08 Mar 2013 1.4

added case for linear equations

11 Apr 2013 1.5

summary update