Method Add
- Namespace
- GeometryHelper.Export
- Assembly
- GeometryHelper.dll
Add(GeoSolid3, string)
Adds a body: the mesh of where its material ends, openings cut in.
public ObjWriter Add(GeoSolid3 solid, string name = null)
Parameters
Returns
- ObjWriter
This writer, for adding the next shape.
Exceptions
- ArgumentNullException
Thrown when the body is null.
Add(GeoSolid3, Tolerance, string)
Adds a body: the mesh of where its material ends, openings cut in, triangulated within a tolerance.
public ObjWriter Add(GeoSolid3 solid, Tolerance tolerance, string name = null)
Parameters
solidGeoSolid3The body.
toleranceToleranceThe tolerance the faces are triangulated within, in place of the global one.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
A slab 100 by 100 and 0.0008 thick, built within 1E-5, is meshed in its 12 triangles within 1E-5; at the global tolerance its four sides, 0.0008 high, count as too thin and are dropped, and the 4 triangles of its two big faces are what is left.
Exceptions
- ArgumentNullException
Thrown when the body is null.
Add(GeoFace3, string)
Adds a face, holes left open.
public ObjWriter Add(GeoFace3 face, string name = null)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown when the face is null.
Add(GeoFace3, Tolerance, string)
Adds a face, holes left open, triangulated within a tolerance.
public ObjWriter Add(GeoFace3 face, Tolerance tolerance, string name = null)
Parameters
faceGeoFace3The face.
toleranceToleranceThe tolerance the face is triangulated within, in place of the global one.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Exceptions
- ArgumentNullException
Thrown when the face is null.
Add(GeoPolygon3, string)
Adds a polygon: one face of its own corners when it turns the same way at every one, as a hexagon does, and its triangles when it does not, as an L does.
public ObjWriter Add(GeoPolygon3 polygon, string name = null)
Parameters
polygonGeoPolygon3namestring
Returns
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
Add(GeoPolygon3, Tolerance, string)
Adds a polygon as Add(GeoPolygon3, string) does, its triangles, where it has them, cut within a tolerance.
public ObjWriter Add(GeoPolygon3 polygon, Tolerance tolerance, string name = null)
Parameters
polygonGeoPolygon3The polygon.
toleranceToleranceThe tolerance the triangles are cut within, in place of the global one.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
An L-shaped polygon 100 by 100 with a square of 50 taken from a corner is 4 triangles covering 7 500, wound as the polygon is. Written as one face, a viewer would fan it from its first corner over the notch. A polygon that turns the same way at every corner but goes twice round, as a pentagram does, is not one face either.
The triangles are cut within the tolerance, so a polygon that is not one face and is thinner than the tolerance comes out as an object with no face at all, by design: an L-shaped polygon with arms 0.0004 wide, built within 1E-5, is empty at the global tolerance and 4 triangles within 1E-5, where an equally thin strip, which is one face, is written at either.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.
Add(GeoPoint3, string)
Adds a point, which a viewer shows as a dot.
public ObjWriter Add(GeoPoint3 point, string name = null)
Parameters
Returns
Add(GeoTriangle3, string)
Adds a triangle as a face of its own.
public ObjWriter Add(GeoTriangle3 triangle, string name = null)
Parameters
triangleGeoTriangle3namestring
Returns
Add(GeoAabb3, string)
Adds a box as its twelve triangles.
public ObjWriter Add(GeoAabb3 box, string name = null)
Parameters
Returns
Exceptions
- InvalidOperationException
Thrown when the box is empty, or flat on some axis.
Add(GeoObb3, string)
Adds an oriented box as its twelve triangles.
public ObjWriter Add(GeoObb3 box, string name = null)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown when the box is null.
- InvalidOperationException
Thrown when the box is flat on some axis.
Add(GeoCell3, string)
Adds one cell of a body cut into a grid, the mesh of its material.
public ObjWriter Add(GeoCell3 cell, string name = null)
Parameters
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
Named as Add(GeoCellGrid3, string) names it, name_i_j_k, and meshed at the global tolerance:
a cell cut within a tighter one is better added through its grid.
Exceptions
- ArgumentNullException
Thrown when the cell is null.
Add(IEnumerable<GeoTriangle3>, string)
Adds a mesh of triangles.
public ObjWriter Add(IEnumerable<GeoTriangle3> triangles, string name = null)
Parameters
trianglesIEnumerable<GeoTriangle3>namestring
Returns
Exceptions
- ArgumentNullException
Thrown when the triangles are null.
Add(GeoMesh3, string)
Adds the mesh of a flat shape, its faces sharing their vertices: a face that turns right at none of its corners as one polygon, so that a viewer shows the cells of a grid as they are, and any other as its triangles.
public ObjWriter Add(GeoMesh3 mesh, string name = null)
Parameters
Returns
Exceptions
- ArgumentNullException
Thrown when the mesh is null.
Add(GeoCellGrid3, string)
Adds the cells of a body, each an object of its own named after its indexes, so that a viewer lists them and shows or hides them one by one.
public ObjWriter Add(GeoCellGrid3 grid, string name = null)
Parameters
gridGeoCellGrid3The cells.
namestringWhat the objects' names start with; "cell" when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
A cell is written as the mesh of its body, name_i_j_k, and a second or later piece of one cell with its
number after, name_i_j_k_p.
Exceptions
- ArgumentNullException
Thrown when the grid is null.
Add(GeoPolyline3, string)
Adds a chain as a line through its vertices.
public ObjWriter Add(GeoPolyline3 polyline, string name = null)
Parameters
polylineGeoPolyline3namestring
Returns
Exceptions
- ArgumentNullException
Thrown when the chain is null.
Add(GeoPolylineArc3, double, string)
Adds a chain with bends as a line, each bend cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoPolylineArc3 chain, double chordTolerance, string name = null)
Parameters
chainGeoPolylineArc3chordTolerancedoublenamestring
Returns
Remarks
The tolerance is any number above nought, infinity included, which cuts each bend into one chord; the Wkt writers and the other chord overloads here refuse infinity.
On ordinary input the points are those of ToPolyline3(double): the same bends cut
into the same number of chords at the same places. Four things differ from it. The end of each arc is the edge's own
end point, where the library's last chord, worked out from the circle's angle, may miss it by a rounding; and an arc so
shallow that its circle cannot be placed, a bulge of 1E-200 having a centre that is not a number, is read as its chord.
An edge or a chord shorter than the
point tolerance is kept, where ToPolyline3 drops a point within that tolerance of the one before. The count
is worked out here from the arc sine, as the library works it out: a bend of radius 50 000 within 0.001 is
3 927 chords to a quarter turn, none more than 0.001 inside the bend. And at a knife-edge count the exact one may be a chord more than the library's, never
one fewer. No bend is cut into more than 1 048 576 chords, the chords of all of them together likewise.
Exceptions
- ArgumentNullException
Thrown when the chain is null.
- ArgumentOutOfRangeException
Thrown when the chord tolerance is nought, negative or not a number, or would need more than 1 048 576 chords.
Add(GeoPolygonArc3, double, string)
Adds a loop with bends as a closed line, each bend cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoPolygonArc3 loop, double chordTolerance, string name = null)
Parameters
loopGeoPolygonArc3chordTolerancedoublenamestring
Returns
Remarks
The line comes back to where it started, as OBJ has no closed line: its last vertex is its first. Each bend is cut on its own radius, so a long bend of a large radius is within the tolerance too: a loop with corners of radius 50 000, within 0.001, has 3 927 chords to a quarter turn of each. The chords of all its bends together are no more than 1 048 576.
Exceptions
- ArgumentNullException
Thrown when the loop is null.
- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 chords.
Add(GeoArc3, double, string)
Adds an arc as a line, cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoArc3 arc, double chordTolerance, string name = null)
Parameters
Returns
Remarks
The line runs from the start of the arc to its end, whichever way the arc turns. A quarter of a circle of radius 100 cut within 0.1 is 18 chords of about 8.7. The count is worked out from the arc sine: a quarter of radius 50 000 within 0.001 is 3 927 chords, none more than 0.001 inside the arc. No curve is cut into more than 1 048 576 chords.
Exceptions
- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 chords.
Add(GeoCircle3, double, string)
Adds a circle as a closed line, cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoCircle3 circle, double chordTolerance, string name = null)
Parameters
circleGeoCircle3chordTolerancedoublenamestring
Returns
Remarks
A circle of radius 100 cut within 0.1 is a line of 71 chords whose last vertex is its first. OBJ has no circle, and a viewer shows the line, not a disc. The count is worked out from the arc sine: a circle of radius 50 000 within 0.001 is 15 708 chords, none more than 0.001 inside it. No curve is cut into more than 1 048 576 chords.
Exceptions
- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 chords.
Add(GeoEllipse3, double, string)
Adds an ellipse as a closed line, cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoEllipse3 ellipse, double chordTolerance, string name = null)
Parameters
ellipseGeoEllipse3chordTolerancedoublenamestring
Returns
Remarks
The chords are spaced by the bend of the rim for up to 4 096 of them a turn, and evenly in the angle past that: an ellipse of radii 50 000 and 25 000 within 0.001 is 15 708 chords. No curve is cut into more than 1 048 576 chords.
Exceptions
- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 chords.
Add(GeoSpline3, double, string)
Adds a spline as a line, cut into chords no further than a tolerance from it.
public ObjWriter Add(GeoSpline3 spline, double chordTolerance, string name = null)
Parameters
splineGeoSpline3The spline.
chordTolerancedoubleThe largest gap allowed between a chord and the spline, in millimetres.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
The line runs from the start of the spline to its end, through the corners Flatten(double) cuts it at, every one kept, a chord shorter than the point tolerance among them, and its ends are the first and last control points exactly. OBJ has no curve: the circle of radius 100 that FromCircle(GeoCircle3) builds, within 0.01, is a line of 256 chords whose last vertex is its first. No spline is cut into more than 1 048 576 chords.
Exceptions
- ArgumentNullException
Thrown when the spline is null.
- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 chords.
Add(GeoSphere3, double, string)
Adds a ball as the mesh of its surface, cut into triangles no further than a tolerance from it.
public ObjWriter Add(GeoSphere3 sphere, double chordTolerance, string name = null)
Parameters
sphereGeoSphere3The ball.
chordTolerancedoubleThe largest gap allowed between a triangle and the sphere, in millimetres.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
The mesh is TriangulateSurface(double), as a body is written as its triangles: a ball of radius 50 within 0.1 is 3 380 triangles, every corner on the sphere, wound outwards. A tolerance that needs more than 1 048 576 triangles is refused; radius 50 within 0.0001 would need three million.
Exceptions
- ArgumentException
Thrown when the ball is not valid, as a
defaultone is.- ArgumentOutOfRangeException
Thrown when the chord tolerance is not a finite number above nought, or would need more than 1 048 576 triangles.
Add(GeoRay3, double, string)
Adds a ray as a line from its origin, for as far as a length: a ray has no end of its own.
public ObjWriter Add(GeoRay3 ray, double length, string name = null)
Parameters
rayGeoRay3The ray.
lengthdoubleHow far along the ray the line runs.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Exceptions
- ArgumentException
Thrown when the ray has no direction, as a
defaultone has.- ArgumentOutOfRangeException
Thrown when the length is negative, NaN or infinite.
Add(GeoXLine3, double, string)
Adds a line without ends as a line of a length, centred on its origin: the line has no end of its own.
public ObjWriter Add(GeoXLine3 xline, double length, string name = null)
Parameters
xlineGeoXLine3The line.
lengthdoubleHow long the drawn line is: half of it either side of the origin.
namestringWhat the viewer calls it; a number when none is given.
Returns
- ObjWriter
This writer, for adding the next shape.
Remarks
The line through (1, 2, 3) along Z, drawn 50 long, runs from (1, 2, -22) to (1, 2, 28).
Exceptions
- ArgumentException
Thrown when the line has no direction, as a
defaultone has.- ArgumentOutOfRangeException
Thrown when the length is negative, NaN or infinite.
Add(GeoLine3, string)
Adds a segment as a line.
public ObjWriter Add(GeoLine3 line, string name = null)