#
# Conic section's constructor.
#
#					Gershon Elber, 1998
#

save_mat = view_mat;
view_mat = sc( 0.7 );

Circ1 = ConicSec( list( 1, 0, 1, 0, 0, -1.2 ), 0.1, off, off );
Circ2 = ConicSec( list( 1, 0, 1, 0, -0.5, -1 ), 0.0, off, off );
color( Circ1, white );
color( Circ2, yellow );

Elp1 = ConicSec( list( 1, 2, 4, 0.5, 2, -0.2 ), 0.0, off, off );
Elp2 = ConicSec( list( 1, 0, 4, 0, 0, -1 ), -0.1, off, off );
color( Elp1, red );
color( Elp2, magenta );

Hyp1 = ConicSec( list( -1, 2,  4, 0.5, 2, -0.2 ), 0.0, off, off );
Hyp2 = ConicSec( list(  1, 0, -4, 0, 0, -1 ), -0.1, off, off );
color( Hyp1, cyan );
color( Hyp2, green );

interact( list( axes, Elp1, Elp2, Circ1, Circ2, Hyp1, Hyp2, view_mat ) );

#############################################################################

Circ1a = cmoebius( cregion( Circ1, -20, 0.49 ), 0 );
color( Circ1a, white );
Circ1b = cmoebius( cregion( Circ1,  0.51, 21 ), 0 );
color( Circ1b, white );

Circ2a = cmoebius( cregion( Circ2, -20, 0.49 ), 0 );
color( Circ2a, yellow );
Circ2b = cmoebius( cregion( Circ2,  0.51, 21 ), 0 );
color( Circ2b, yellow );


Elp1a = cmoebius( cregion( Elp1, -20, 0.49 ), 0 );
color( Elp1a, cyan );
Elp1b = cmoebius( cregion( Elp1,  0.51, 21 ), 0 );
color( Elp1b, cyan );

Elp2a = cmoebius( cregion( Elp2, -20, 0.49 ), 0 );
color( Elp2a, magenta );
Elp2b = cmoebius( cregion( Elp2,  0.51, 21 ), 0 );
color( Elp2b, magenta );


Hyp1a = cmoebius( cregion( Hyp1, -2, 0.4 ), 0 );
color( Hyp1a, cyan );
Hyp1b = cmoebius( cregion( Hyp1,  0.6, 3 ), 0 );
color( Hyp1b, cyan );

Hyp2a = cmoebius( cregion( Hyp2, -2, 0.4 ), 0 );
color( Hyp2a, green );
Hyp2b = cmoebius( cregion( Hyp2,  0.6, 3 ), 0 );
color( Hyp2b, green );


interact( list( axes, Elp1a, Elp1b, Elp2a, Elp2b, Circ1a, Circ1b,
		Circ2a, Circ2b, Hyp1a, Hyp1b, Hyp2a, Hyp2b, view_mat ) );

#############################################################################

Prb1 = ConicSec( list( 0.0, 0, 0.3, 0.3, 0.05, 0 ), 0.2, off, off );
Prb2 = ConicSec( list( 0.5, 0, 0.0, 0, 1, -1 ), 0.1, off, off );
color( Prb1, cyan );
color( Prb2, green );

interact( list( axes, Prb1, Prb2 ) );

save( "conics", list( Circ1, Circ2, Elp1, Elp2, Hyp1, Hyp2, Prb1, Prb2 ) );

view_mat = save_mat;

free( Circ1 );
free( Circ2 );
free( Circ1A );
free( Circ1B );
free( Circ2A );
free( Circ2B );
free( Elp1 );
free( Elp2 );
free( Elp1A );
free( Elp1B );
free( Elp2A );
free( Elp2B );
free( Hyp1 );
free( Hyp2 );
free( Hyp1A );
free( Hyp1B );
free( Hyp2A );
free( Hyp2B );
free( Prb1 );
free( Prb2 );

