File Name: Il problema di Pappo
Author: The Mascheroni CAD Team
Author URI: http://www.geogebraitalia.org
License: GPL2

# Pappus Problem - 4 straight lines

### Problem Statement: 

Given 4 arbitrary lines(r1, r2, r3, r4),4 
arbitrary angles, find the locus of points C such that:
- CP1, CP2, CP3 e CP4

form with r1, r2, r3, r4,

the angles theta1,theta2, theta3 and theta4,

respectively;

- is fulfilled the condition:
CP1*CP2=k*(CP3*CP4)
where points P_i belongs to r_i (i=1,2,3,4).

First compute segment lenghts

kill(all);
d1:(a1*x+b1*y+1)/(sin(theta1)*sqrt(a1^2+b1^2));
d2:(a2*x+b2*y+1)/(sin(theta2)*sqrt(a2^2+b2^2));
d3:(a3*x+b3*y+1)/(sin(theta3)*sqrt(a3^2+b3^2));
d4:(a4*x+b4*y+1)/(sin(theta4)*sqrt(a4^2+b4^2));

### Compute the locus equation

eq:expand(d1*d2-d3*d4)$
eq:num(ratsimp(eq));

### Extract the coefficients from equation.
Ax^2+By^2+Cxy+Dx+Ey+F=0

Term of y^2

B:ratcoef(eq,y,2);

Term of x^2

A:ratcoef(eq,x,2);

Term of x*y

u:ratcoef(eq,y,1);
C:ratcoef(u,x,1);

Term of y

E:ratcoef(u,x,0);

Term of x

v:ratcoef(eq,x,1);
D:ratcoef(v, y,0);

Known Term

c1:ratcoef(eq,x,0);
F:ratcoef(c1,y,0);