Geometry

Header file geometry.h

The geometry classes use the vector classes. In this document, `vector', `point' and `centre' imply objects of type `Vector'.

Input/output

Surface class

General pattern:
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

Programming

Class `Line'

Parametric line, defined by a point `a' on the line and a direction vector `v'.

Class `Surface'

Class `Plane'

Class `Cylinder'

Class `Cone'

Class `Gencone'

Class `Sphere'

Class `Ellipsoid'

Class `Genellipsoid'

Class `Surface_function'

Class `Outside'

Class `Surface_subset'

Class `Surface_intersection'

Class `Surface_union'

Fitting surfaces to data

Point

Line

Plane

Sphere

Cylinder

Cone

Generalised cone

Ellipsoid

Generalised ellipsoid

Subtended angle

3D: solid angle subtended at a point by a triangle

Calculates signed solid angle, positive when dot product of normal to triangle (defined by right hand screw) with vector from point to centre of tiangle is positive. Uses spherical trigonometry, i.e. works by projecting triangle onto unit sphere about point. Angle is calculated in steradians.

double angsub3d(
   const Vector3d& p, // position vector of point where angle is calculated
   const Vector3d& a, // position vector of first point of triangle
   const Vector3d& b, // position vector of second point of triangle
   const Vector3d& c, // position vector of third point of triangle
   const double eps = 1.0e-8 // numerical bandwidth: small triangle
)

2D: angle subtended at a point by a straight line

Finds the angle subtended at a point in moving from one end of a straight line to the other. The line is specified by the endpoints. Requires a bandwidth to detect if the point is coincident with either end of the line.

double angsub2d(
   const Vector2d& p, // position vector of point
   const Vector2d& a, // position vector of first end of line
   const Vector2d& b, // position vector of second end of line
   const double eps = 1.0e-8 // numerical bandwidth: line ends close to point
)