 # Examples of algebraic curve in 3D

For details of the basic operation of the program see the Main Help page. Some special options specific to the calculation of algebraic curves in 3D are below. Example definitions plus some explanation are also below.

## Region of interest

These parameters control the range over which the surface is calculated. Its best if unequal values are chosen for the ranges. Otherwise certain degeneracies may occur which can lead to poorer results.

## Resolution control

These parameters control how detailed the resulting mesh will be. Each of these must be a power of two. The box specified by the range is split into a number of smaller boxes and points of the faces of these boxes will be found together with any singularities lying in the middle of them. The Coarse parameter specifies the number of smaller boxes, by default 8 along the x, y, z directions, i.e. 512 boxes. The Fine parameter specifies the smallest box size used to find a singularity. The Face specifies how accurately each face of the box is subdivided and the edge parameter specifies how accurately each edge is subdivided.

Generally you will just want to change the Coarse parameter. If the singularities are not calculated very well then you could also increase the Fine parameter. Lowering the other parameters may give quicker results. Not much will be gained by increasing them. As a rule you should keep Coarse < Fine < Face < Edge or the results will be unpredictable.

## Timeout

If a degenerate surface is specified the program can take a very long time to run. To prevent this from happening the cgi program will timeout after a certain time. This may mean the surface will not be calculated properly. If you want to calculate more complicated surfaces please email me at rich@singsurf.org and I'll provide a version you can run at home which does not have the timeout restriction.

## Examples

Intersection of two cylinders
```x^2+y^2=1;
x^2+z^2=1;
```
Each of the two equations defines a cylinder. The curve calculated gives their curve of intersection.

Apparent Contour of a surface
```f=0;
(A,B,C) . n = 0;
n = (diff(f,x),diff(f,y),diff(f,z)); # the normal
f = x^4 + a x^2 + x y - z;
a = -1;
A = 1; B = 0; C = 0; # direction of view
```
Given a viewing direction (A,B,C) the apparent contour of the surface is constructed by finding all points where the normal at that point is orthogonal to the viewing direction. When looking at the surface along the viewing direction the outline of the surface will include parts of the apparent contour.

To calculate the surface insert

```f = x^4 + a x^2 + x y - z;
a = -1;
```
into the Algebraic Surfaces program. To see the profile select the Right (Y-Z) mode in the Camera Panel.

Cusps appear on the apparent contour when the view direction occurs along an asymptotic direction. If further the point lies on a flecnodal curve then a swallowtail singularity appears this happens when setting a = 0 in the definition.

Intersection of sphere and cylinder
```(x-1)^2 + y^2 = 1;
x^2 + y^2 + z^2 = 4;
```
Conic sections
```x^2-y^2-z^2=0; # A cone
a x + b y + c z = d;
a = 0.3; b = 0.5; c = 0; d = 0.1; # a hyperbola
```
This gives the intersection of a cone and a plane. The intersection will give a conic section. Use the following to get other types of conic section.
```a = 0.5; b = 0.5; c = 0; d = 0.1; # a parabola
a = 0.5; b = 0.5; c = 0; d = 0.1; # an ellipse
a = 0.5; b = 0.0; c = 0; d = 0.1; # a circle
a = 0.3; b = 0.5; c = 0; d = 0.0; # two lines
```
The cone can be viewed by selecting the A1 (cone) surface in the Algebraic Surfaces program.

Web page, applet and Algebraic Surface program by Richard Morris