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)
plane_pointnormal_vector (n) point_in_plane(r)
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
cuboidlow_corner high_corner (N-vectors)
polygon (xy plane, closed)N p_1 p_2 ... p_N (2-vectors)
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, bisection is used to find the position of the surface in between.)
Surface of revolution
Name: surface_of_revolution
Parameters:
      reference_point_on_axis axis_vector
      radius_function_type_name parameters
      minimum_line_parameter maximum_line_parameter line_parameter_step
   
Based on a Realfunction1d, which defines the radius as a function of the line parameter along the axis from the reference point - see the 1D function documentation. (If the axis is a unit vector, the line parameter is distance.) 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 radius difference changes sign between the ends of a step, linear interpolation in radius vs line parameter is used to estimate the intersection point.)
Outside 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.
Translate a surface
Name: translate
Parameters:
      translation_vector
      surface_type_name parameters
   
Translates a surface by the specified vector.
Map a surface
Name: map
Parameters:
      map_matrix
      surface_type_name parameters
   
Maps a surface by applying the matrix to the coordinate system in which the surface is defined. If the surface is defined with respect to a set of axes which are not aligned with the coordinate axes, the mapping matrix is the set of scalar products between the two sets of axes. The axes need not be orthogonal: the map can be used to stretch or shear a surface.