Table of Contents

Method ToSolid

Namespace
GeometryHelper.Geometry
Assembly
GeometryHelper.dll

ToSolid(double)

Approximates the ball as a closed body of triangles, none of them further from the sphere than a chord tolerance.

public GeoSolid3 ToSolid(double chordTolerance)

Parameters

chordTolerance double

The largest gap allowed between a face and the sphere, in drawing units. Zero picks 0.2 % of the radius.

Returns

GeoSolid3

A closed body whose faces face outwards, every corner of them on the sphere.

Remarks

An icosahedron of twenty triangles, each cut into n by n smaller ones by lines parallel to its sides and every corner pushed out to the sphere, with the least n for which the sag of every triangle, the gap between its plane and the sphere at the nearest, is within the tolerance: a ball of radius 50 cut within 0.1 is 20 by 13 by 13, 3 380 triangles, and within 0.01 it is 20 by 39 by 39, 30 420, none of them further than that from the sphere. The corners lie on the sphere, so the body lies inside it and holds a little less than Volume: 0.036 % less at 0.01. A tolerance that needs more than 1 048 576 triangles is refused, as for the chords of a circle: radius 50 within 0.0001 would need three million. A ball of a radius below about 0.01 has triangles thinner than the point tolerance, and its body may be one the library calls open at the default tolerance.

A ball is clashed with a body through this one: ball.ToSolid(0.01) goes where any solid goes, and its clash is as exact as the tolerance. Whether the ball touches a body, and how far apart they are, are exact without it (CollidesWith(GeoSolid3) and DistanceTo(GeoSolid3)).

Exceptions

ArgumentException

Thrown when the ball is not valid, as a default one is.

InvalidOperationException

Thrown when the centre of the ball has a coordinate that is not a finite number.

ArgumentOutOfRangeException

Thrown when the tolerance is negative or not a finite number, or needs more than 1 048 576 triangles.