Table of Contents

Class ObjWriter

Namespace
GeometryHelper.Export
Assembly
GeometryHelper.dll

Writes geometry in space as a Wavefront OBJ file, to look at in any 3D viewer.

public sealed class ObjWriter
Inheritance
ObjWriter
Inherited Members

Remarks

Every shape added becomes an object of its own, named as given, so a viewer lists them separately: a body as the mesh of where its material ends, a ball as the mesh of its surface, a face as its triangles, a chain as a line, a point as a dot. A polygon that turns the same way at every corner is one face, any other its triangles; a circle, an arc, an ellipse or a spline is a line of chords no further from the curve than the chord tolerance asked for, a chord shorter than the point tolerance written all the same. Coordinates are written exactly, as a text that reads back to the very double on .NET Framework and on .NET 10 alike (the digits may differ between the two, a negative nought is -0 on both), so what is looked at is what was computed, however far from the origin.

new ObjWriter().Add(plate, "plate").Add(bolt, "bolt").Save("clash.obj");

Methods

Add(GeoAabb3, string)

Adds a box as its twelve triangles.

Add(GeoArc3, double, string)

Adds an arc as a line, cut into chords no further than a tolerance from it.

Add(GeoCircle3, double, string)

Adds a circle as a closed line, cut into chords no further than a tolerance from it.

Add(GeoEllipse3, double, string)

Adds an ellipse as a closed line, cut into chords no further than a tolerance from it.

Add(GeoFace3, Tolerance, string)

Adds a face, holes left open, triangulated within a tolerance.

Add(GeoFace3, string)

Adds a face, holes left open.

Add(GeoLine3, string)

Adds a segment as a line.

Add(GeoObb3, string)

Adds an oriented box as its twelve triangles.

Add(GeoPoint3, string)

Adds a point, which a viewer shows as a dot.

Add(GeoPolygon3, Tolerance, string)

Adds a polygon as Add(GeoPolygon3, string) does, its triangles, where it has them, cut within a tolerance.

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.

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.

Add(GeoPolyline3, string)

Adds a chain as a line through its vertices.

Add(GeoPolylineArc3, double, string)

Adds a chain with bends as a line, each bend cut into chords no further than a tolerance from it.

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.

Add(GeoSolid3, Tolerance, string)

Adds a body: the mesh of where its material ends, openings cut in, triangulated within a tolerance.

Add(GeoSolid3, string)

Adds a body: the mesh of where its material ends, openings cut in.

Add(GeoSphere3, double, string)

Adds a ball as the mesh of its surface, cut into triangles no further than a tolerance from it.

Add(GeoSpline3, double, string)

Adds a spline as a line, cut into chords no further than a tolerance from it.

Add(GeoTriangle3, string)

Adds a triangle as a face of its own.

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.

Add(GeoCell3, string)

Adds one cell of a body cut into a grid, the mesh of its material.

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.

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.

Add(IEnumerable<GeoTriangle3>, string)

Adds a mesh of triangles.

Save(string)

Writes the file to a path, replacing whatever is there.

ToString()

Gets the file as text.

WriteTo(TextWriter)

Writes the file to a writer.