From ea05fd74b17ce49624465ec088a41198d406707c Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Sat, 10 Oct 2015 18:46:33 +0100 Subject: [PATCH] [meshops] add stream wrapper ctor aliases, update doc strings --- geom-meshops/src/meshio.org | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/geom-meshops/src/meshio.org b/geom-meshops/src/meshio.org index 1d5ca914..78819f65 100644 --- a/geom-meshops/src/meshio.org +++ b/geom-meshops/src/meshio.org @@ -3,6 +3,7 @@ * Contents :toc_4_gh: - [[#thinggeommeshio][thi.ng.geom.mesh.io]] - [[#configuration-parameters][Configuration parameters]] + - [[#stream-wrappers][Stream wrappers]] - [[#stl][STL]] - [[#ply][PLY]] - [[#obj][OBJ]] @@ -17,12 +18,25 @@ (def ^:dynamic *precision* 5) #+END_SRC + +** Stream wrappers + +#+BEGIN_SRC clojure :noweb-ref wrappers + (def output-stream + "Alias for thi.ng.dstruct.streams/output-stream" + streams/output-stream) + + (def input-stream + "Alias for thi.ng.dstruct.streams/input-stream" + streams/input-stream) +#+END_SRC + ** STL #+BEGIN_SRC clojure :noweb-ref stl (defn write-stl - "Writes the given mesh as binary STL to output stream. Mesh is - automatically tessellated into triangles." + "Writes the given mesh as binary STL to output stream wrapper. Mesh + is automatically tessellated into triangles. Returns stream wrapper" [out mesh] (let [faces (g/faces mesh) fnormals (g/face-normals mesh true)] @@ -37,7 +51,8 @@ out)) (defn read-stl - "Reads faces from binary STL inputstream and adds them to given (or new) mesh." + "Reads faces from binary STL input stream wrapper and adds them to + given (or new) mesh." ([in] (read-stl in (bm/basic-mesh))) ([in mesh] @@ -57,9 +72,9 @@ #+BEGIN_SRC clojure :noweb-ref ply (defn write-ply - "Writes the given mesh as binary PLY to output stream. For - compatibility with external tools mesh should already have been - tessellated before calling this fn." + "Writes the given mesh as binary PLY to output stream wrapper. + For compatibility with some external tools, the mesh should already have been + tessellated before calling this fn. Returns stream wrapper." [out mesh] (let [vertices (g/vertices mesh) vindex (zipmap vertices (range)) @@ -98,6 +113,8 @@ #+BEGIN_SRC clojure :noweb-ref obj (defn write-obj + "Writes mesh as Waveform OBJ format to output stream wrapper. + Returns stream wrapper." [out {:keys [vertices vnormals faces]}] (let [vertices (keys vertices) vnorms? (not (nil? (seq vnormals))) @@ -136,6 +153,8 @@ #+BEGIN_SRC clojure :noweb-ref off (defn write-off + "Writes mesh as OFF format to output stream wrapper. + Returns stream wrapper." [out mesh] (let [vertices (g/vertices mesh) faces (g/faces mesh) @@ -152,7 +171,8 @@ out (str (count fverts) " " (str/join " " (map vindex fverts)) - "\n"))))) + "\n"))) + out)) #+END_SRC ** Complete namespace definition @@ -174,6 +194,8 @@ <> + <> + <> <>