Geometry

Unless stated, all classes describe objects in N dimensions. Vectors are N-dimensional, so the input for a vector is
number_of_components
For each:
   component_value

Class: Line

Data format:
position_vector_on_line
direction_vector_along_line

Class: Surface

Generic hypersurface.

A surface is considered to have an inside and an outside, for use in defining solid regions. Unless stated otherwise, the inside is what you would intuitively expect, e.g. the inside of a sphere or a cone. The inside of a plane is chosen to be the opposide side to the direction of the normal (i.e. plane normals point outward).

Polymorphic input and output is provided for pointers to objects of this class. Polymorphic data format:

type_name
parameters

type_name parameters
planenormal_vector (n) family_parameter (f=n.r : r = point_in_plane)
cylinderpoint_on_axis axis_vector radius
conepoint_on_axis axis_vector half_angle (radians)
general_conepoint_on_axis axis_vector half_angle (radians) radius_at_point_on_axis
spherecentre radius
ellipsoidcentre radius_1 radius_2 ... radius_N
general_ellipsoidcentre axis_vector_1 axis_vector_2 ... axis_vector_N radius_1 radius_2 ... radius_N
More complicated types of surface are:
General surface function
Name: function
Parameters:
      function_type_name parameters
      function_bandwidth
      minimum_line_parameter maximum_line_parameter line_parameter_step
   
Based on a Realfunctionnd, which defines a function value everywhere in space - i.e. as a function of the position vector - see the ND function documentation. The surface is where the function is zero; inside is where the function is negative. The bandwidth is a small number, used when funding the zeroes to say when the function is sufficiently close to zero. When funding the intersection with a line, intersections are sought in the region of the line between the parameter limits chosen, with the desired step. (If the function value changes sign between the ends of a step, bosection is used to find the position of the surface in between.)
`Opposite' of a surface
Name: outside
Parameters: type_name parameters
Exchanges the inside and outside of a surface.
Subset of a surface
Name: subset
Parameters:
      type_name parameters
      number_of_constraints
      For each:
         type_name parameters
   
Defines a subset of a surface. The subset is described as a set of constraints. Each constraint is itself a surface; the subset is the part of the surface which lies inside all the constraining surfaces.
Intersection of surfaces
Name: intersection
Parameters:
      number_of_surfaces
      For each:
         type_name parameters
   
Defines the intersection of a set of surfaces, in the sense of the smallest region lying inside all the surfaces.
Union of surfaces
Name: union
Parameters:
      number_of_surfaces
      For each:
         type_name parameters
   
Defines the union of a set of surfaces, in the sense of the region lying inside any of the surfaces.