Geometry isn't working at all, but my head is spinning!

This commit is contained in:
Simon Brooke 2020-05-24 16:05:04 +01:00
parent 8a2cb942e6
commit 223bf1ce77
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
21 changed files with 212 additions and 75 deletions

View file

@ -5,7 +5,7 @@ A Clojure library designed to assist in computing walkmaps for games.
## Introduction ## Introduction
This library is written in support of work on This library is written in support of work on
[The Great Game](https://simon-brooke.github.io/the-great-game/codox/), but is [The Great Game](https://simon-brooke.github.io/the-great-game/codox/Pathmaking.html), but is
separate because it may be of some use in other settings. separate because it may be of some use in other settings.
## Usage ## Usage
@ -20,10 +20,6 @@ Lein dependency:
[walkmap "0.1.0-SNAPSHOT"] [walkmap "0.1.0-SNAPSHOT"]
Using:
(require '[walkmap.core :refer :all])
### Converting heightmaps to STL ### Converting heightmaps to STL
Doesn't work yet, and is not a priority. Use Doesn't work yet, and is not a priority. Use
@ -31,12 +27,14 @@ Doesn't work yet, and is not a priority. Use
### Reading binary STL files ### Reading binary STL files
(require '[walkmap.stl :refer [decode-binary-stl]])
(decode-binary-stl "path/to/input-file.stl") (decode-binary-stl "path/to/input-file.stl")
Works, seems good. Works, seems good.
### Writing ASCII STL files ### Writing ASCII STL files
(require '[walkmap.stl :refer [write-ascii-stl]])
(write-ascii-stl "path/to/output-file.ascii.stl" stl-structure) (write-ascii-stl "path/to/output-file.ascii.stl" stl-structure)
Works, seems good, agrees with Python implementation except for different Works, seems good, agrees with Python implementation except for different
@ -44,13 +42,11 @@ number of places of decimals printed.
### Converting STL to SVG ### Converting STL to SVG
(stl-to-svg stl-structure) (require '[walkmap.svg :refer [stl->svg]])
(stl->svg stl-structure)
Works for smaller test files. I'm not yet confident it works for arbitrary Works, seems good. Returns a [hiccup](https://github.com/weavejester/hiccup)
sized STL structures. Returns a [Dali](https://github.com/stathissideris/dali) representation of the SVG.
structure representing an SVG drawing, which can be printed with
(dali.io/render-svg structure)
**NOTE THAT** the SVG data does not contain height information, which the **NOTE THAT** the SVG data does not contain height information, which the
STL data does contain. Thus gradient information can only be obtained from STL data does contain. Thus gradient information can only be obtained from
@ -58,13 +54,14 @@ the STL.
### Converting STL file to SVG or SVG file ### Converting STL file to SVG or SVG file
(binary-stl-file-to-svg "path/to/input-file.stl") (require '[walkmap.core :refer [binary-stl-file->svg]])
(binary-stl-file->svg "path/to/input-file.stl")
Works for smaller test files. I'm not yet confident it works for arbitrary Works, seems good. Returns a [hiccup](https://github.com/weavejester/hiccup)
sized STL structures. Returns a [Dali](https://github.com/stathissideris/dali) representation of the SVG.
structure representing an SVG drawing, as above.
(binary-stl-file-to-svg "path/to/input-file.stl" "path-to-output-file.svg") (require '[walkmap.core :refer [binary-stl-file->svg]])
(binary-stl-file->svg "path/to/input-file.stl" "path-to-output-file.svg")
As above, but, as a side effect, writes the SVG to the specified output file. As above, but, as a side effect, writes the SVG to the specified output file.
Works for smaller test files, as above. Works for smaller test files, as above.

View file

@ -1,9 +1,7 @@
# Introduction to walkmap # Introduction to walkmap
## Introduction
This library is written in support of work on This library is written in support of work on
[The Great Game](https://simon-brooke.github.io/the-great-game/codox/), but is [The Great Game](https://simon-brooke.github.io/the-great-game/codox/Pathmaking.html), but is
separate because it may be of some use in other settings. separate because it may be of some use in other settings.
## Usage ## Usage
@ -18,10 +16,6 @@ Lein dependency:
[walkmap "0.1.0-SNAPSHOT"] [walkmap "0.1.0-SNAPSHOT"]
Using:
(require '[walkmap.core :refer :all])
### Converting heightmaps to STL ### Converting heightmaps to STL
Doesn't work yet, and is not a priority. Use Doesn't work yet, and is not a priority. Use
@ -29,12 +23,14 @@ Doesn't work yet, and is not a priority. Use
### Reading binary STL files ### Reading binary STL files
(require '[walkmap.stl :refer [decode-binary-stl]])
(decode-binary-stl "path/to/input-file.stl") (decode-binary-stl "path/to/input-file.stl")
Works, seems good. Works, seems good.
### Writing ASCII STL files ### Writing ASCII STL files
(require '[walkmap.stl :refer [write-ascii-stl]])
(write-ascii-stl "path/to/output-file.ascii.stl" stl-structure) (write-ascii-stl "path/to/output-file.ascii.stl" stl-structure)
Works, seems good, agrees with Python implementation except for different Works, seems good, agrees with Python implementation except for different
@ -42,13 +38,11 @@ number of places of decimals printed.
### Converting STL to SVG ### Converting STL to SVG
(stl-to-svg stl-structure) (require '[walkmap.svg :refer [stl->svg]])
(stl->svg stl-structure)
Works for smaller test files. I'm not yet confident it works for arbitrary Works, seems good. Returns a [hiccup](https://github.com/weavejester/hiccup)
sized STL structures. Returns a [Dali](https://github.com/stathissideris/dali) representation of the SVG.
structure representing an SVG drawing, which can be printed with
(dali.io/render-svg structure)
**NOTE THAT** the SVG data does not contain height information, which the **NOTE THAT** the SVG data does not contain height information, which the
STL data does contain. Thus gradient information can only be obtained from STL data does contain. Thus gradient information can only be obtained from
@ -56,13 +50,14 @@ the STL.
### Converting STL file to SVG or SVG file ### Converting STL file to SVG or SVG file
(binary-stl-file-to-svg "path/to/input-file.stl") (require '[walkmap.core :refer [binary-stl-file->svg]])
(binary-stl-file->svg "path/to/input-file.stl")
Works for smaller test files. I'm not yet confident it works for arbitrary Works, seems good. Returns a [hiccup](https://github.com/weavejester/hiccup)
sized STL structures. Returns a [Dali](https://github.com/stathissideris/dali) representation of the SVG.
structure representing an SVG drawing, as above.
(binary-stl-file-to-svg "path/to/input-file.stl" "path-to-output-file.svg") (require '[walkmap.core :refer [binary-stl-file->svg]])
(binary-stl-file->svg "path/to/input-file.stl" "path-to-output-file.svg")
As above, but, as a side effect, writes the SVG to the specified output file. As above, but, as a side effect, writes the SVG to the specified output file.
Works for smaller test files, as above. Works for smaller test files, as above.
@ -119,4 +114,3 @@ Public License, v. 2.0 are satisfied: GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or (at your the Free Software Foundation, either version 2 of the License, or (at your
option) any later version, with the GNU Classpath Exception which is available option) any later version, with the GNU Classpath Exception which is available
at https://www.gnu.org/software/classpath/license.html. at https://www.gnu.org/software/classpath/license.html.

File diff suppressed because one or more lines are too long

View file

@ -1,8 +1,7 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>Introduction to walkmap</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1 "><a href="walkmap.core.html"><div class="inner"><span>walkmap.core</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-walkmap" name="introduction-to-walkmap"></a>Introduction to walkmap</h1> <html><head><meta charset="UTF-8" /><title>Introduction to walkmap</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 current"><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="document" id="content"><div class="doc"><div class="markdown"><h1><a href="#introduction-to-walkmap" name="introduction-to-walkmap"></a>Introduction to walkmap</h1>
<h2><a href="#introduction" name="introduction"></a>Introduction</h2> <p>This library is written in support of work on <a href="https://simon-brooke.github.io/the-great-game/codox/Pathmaking.html">The Great Game</a>, but is separate because it may be of some use in other settings.</p>
<p>This library is written in support of work on <a href="https://simon-brooke.github.io/the-great-game/codox/">The Great Game</a>, but is separate because it may be of some use in other settings.</p>
<h2><a href="#usage" name="usage"></a>Usage</h2> <h2><a href="#usage" name="usage"></a>Usage</h2>
<p>What works:</p> <p>What works:</p>
<p>No clojars repo yet, build the jar yourself with</p> <p>No clojars repo yet, build the jar yourself with</p>
@ -11,31 +10,31 @@
<p>Lein dependency:</p> <p>Lein dependency:</p>
<pre><code>[walkmap "0.1.0-SNAPSHOT"] <pre><code>[walkmap "0.1.0-SNAPSHOT"]
</code></pre> </code></pre>
<p>Using:</p>
<pre><code>(require '[walkmap.core :refer :all])
</code></pre>
<h3><a href="#converting-heightmaps-to-stl" name="converting-heightmaps-to-stl"></a>Converting heightmaps to STL</h3> <h3><a href="#converting-heightmaps-to-stl" name="converting-heightmaps-to-stl"></a>Converting heightmaps to STL</h3>
<p>Doesnt work yet, and is not a priority. Use <a href="https://github.com/fogleman/hmm">hmm</a> instead.</p> <p>Doesnt work yet, and is not a priority. Use <a href="https://github.com/fogleman/hmm">hmm</a> instead.</p>
<h3><a href="#reading-binary-stl-files" name="reading-binary-stl-files"></a>Reading binary STL files</h3> <h3><a href="#reading-binary-stl-files" name="reading-binary-stl-files"></a>Reading binary STL files</h3>
<pre><code>(decode-binary-stl "path/to/input-file.stl") <pre><code>(require '[walkmap.stl :refer [decode-binary-stl]])
(decode-binary-stl "path/to/input-file.stl")
</code></pre> </code></pre>
<p>Works, seems good.</p> <p>Works, seems good.</p>
<h3><a href="#writing-ascii-stl-files" name="writing-ascii-stl-files"></a>Writing ASCII STL files</h3> <h3><a href="#writing-ascii-stl-files" name="writing-ascii-stl-files"></a>Writing ASCII STL files</h3>
<pre><code>(write-ascii-stl "path/to/output-file.ascii.stl" stl-structure) <pre><code>(require '[walkmap.stl :refer [write-ascii-stl]])
(write-ascii-stl "path/to/output-file.ascii.stl" stl-structure)
</code></pre> </code></pre>
<p>Works, seems good, agrees with Python implementation except for different number of places of decimals printed.</p> <p>Works, seems good, agrees with Python implementation except for different number of places of decimals printed.</p>
<h3><a href="#converting-stl-to-svg" name="converting-stl-to-svg"></a>Converting STL to SVG</h3> <h3><a href="#converting-stl-to-svg" name="converting-stl-to-svg"></a>Converting STL to SVG</h3>
<pre><code>(stl-to-svg stl-structure) <pre><code>(require '[walkmap.svg :refer [stl-&gt;svg]])
</code></pre> (stl-&gt;svg stl-structure)
<p>Works for smaller test files. Im not yet confident it works for arbitrary sized STL structures. Returns a <a href="https://github.com/stathissideris/dali">Dali</a> structure representing an SVG drawing, which can be printed with</p>
<pre><code>(dali.io/render-svg structure)
</code></pre> </code></pre>
<p>Works, seems good. Returns a <a href="https://github.com/weavejester/hiccup">hiccup</a> representation of the SVG.</p>
<p><strong>NOTE THAT</strong> the SVG data does not contain height information, which the STL data does contain. Thus gradient information can only be obtained from the STL.</p> <p><strong>NOTE THAT</strong> the SVG data does not contain height information, which the STL data does contain. Thus gradient information can only be obtained from the STL.</p>
<h3><a href="#converting-stl-file-to-svg-or-svg-file" name="converting-stl-file-to-svg-or-svg-file"></a>Converting STL file to SVG or SVG file</h3> <h3><a href="#converting-stl-file-to-svg-or-svg-file" name="converting-stl-file-to-svg-or-svg-file"></a>Converting STL file to SVG or SVG file</h3>
<pre><code>(binary-stl-file-to-svg "path/to/input-file.stl") <pre><code>(require '[walkmap.core :refer [binary-stl-file-&gt;svg]])
(binary-stl-file-&gt;svg "path/to/input-file.stl")
</code></pre> </code></pre>
<p>Works for smaller test files. Im not yet confident it works for arbitrary sized STL structures. Returns a <a href="https://github.com/stathissideris/dali">Dali</a> structure representing an SVG drawing, as above.</p> <p>Works, seems good. Returns a <a href="https://github.com/weavejester/hiccup">hiccup</a> representation of the SVG.</p>
<pre><code>(binary-stl-file-to-svg "path/to/input-file.stl" "path-to-output-file.svg") <pre><code>(require '[walkmap.core :refer [binary-stl-file-&gt;svg]])
(binary-stl-file-&gt;svg "path/to/input-file.stl" "path-to-output-file.svg")
</code></pre> </code></pre>
<p>As above, but, as a side effect, writes the SVG to the specified output file. Works for smaller test files, as above.</p> <p>As above, but, as a side effect, writes the SVG to the specified output file. Works for smaller test files, as above.</p>
<h3><a href="#merging-exclusion-maps-and-reserved-area-maps" name="merging-exclusion-maps-and-reserved-area-maps"></a>Merging exclusion maps and reserved area maps</h3> <h3><a href="#merging-exclusion-maps-and-reserved-area-maps" name="merging-exclusion-maps-and-reserved-area-maps"></a>Merging exclusion maps and reserved area maps</h3>

View file

@ -1,4 +1,4 @@
<!DOCTYPE html PUBLIC "" <!DOCTYPE html PUBLIC ""
""> "">
<html><head><meta charset="UTF-8" /><title>walkmap.core documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1 current"><a href="walkmap.core.html"><div class="inner"><span>walkmap.core</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.core.html#var-binary-stl"><div class="inner"><span>binary-stl</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-binary-stl-file-to-svg"><div class="inner"><span>binary-stl-file-to-svg</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-binary-stl-to-ascii"><div class="inner"><span>binary-stl-to-ascii</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-decode-binary-stl"><div class="inner"><span>decode-binary-stl</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-facet"><div class="inner"><span>facet</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-stl-to-svg"><div class="inner"><span>stl-to-svg</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-vect"><div class="inner"><span>vect</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-write-ascii-stl"><div class="inner"><span>write-ascii-stl</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.core</h1><div class="doc"><div class="markdown"><p>At this stage, primarily utility functions dealing with stereolithography (STL) files. Not a stable API yet!</p></div></div><div class="public anchor" id="var-binary-stl"><h3>binary-stl</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>A codec for binary STL files</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L27">view source</a></div></div><div class="public anchor" id="var-binary-stl-file-to-svg"><h3>binary-stl-file-to-svg</h3><div class="usage"><code>(binary-stl-file-to-svg in-filename)</code><code>(binary-stl-file-to-svg in-filename out-filename)</code></div><div class="doc"><div class="markdown"><p>Given only an <code>in-filename</code>, parse the indicated file, expected to be binary STL, and return an equivalent SVG structure. Given both <code>in-filename</code> and <code>out-filename</code>, as side-effect write the SVG to the indicated output file.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L145">view source</a></div></div><div class="public anchor" id="var-binary-stl-to-ascii"><h3>binary-stl-to-ascii</h3><div class="usage"><code>(binary-stl-to-ascii in-filename)</code><code>(binary-stl-to-ascii in-filename out-filename)</code></div><div class="doc"><div class="markdown"><p>Convert the binary STL file indicated by <code>in-filename</code>, and write it to <code>out-filename</code>, if specified; otherwise, to a file with the same basename as <code>in-filename</code> but the extension <code>.ascii.stl</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L83">view source</a></div></div><div class="public anchor" id="var-decode-binary-stl"><h3>decode-binary-stl</h3><div class="usage"><code>(decode-binary-stl filename)</code></div><div class="doc"><div class="markdown"><p>Parse a binary STL file from this <code>filename</code> and return an STL structure representing its contents.</p> <html><head><meta charset="UTF-8" /><title>walkmap.core documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch current"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.core.html#var-*sea-level*"><div class="inner"><span>*sea-level*</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-binary-stl-file-.3Esvg"><div class="inner"><span>binary-stl-file-&gt;svg</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-cull-ocean-facets"><div class="inner"><span>cull-ocean-facets</span></div></a></li><li class="depth-1"><a href="walkmap.core.html#var-ocean.3F"><div class="inner"><span>ocean?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.core</h1><div class="doc"><div class="markdown"><p>At this stage, primarily utility functions dealing with stereolithography (STL) files. Not a stable API yet!</p></div></div><div class="public anchor" id="var-*sea-level*"><h3>*sea-level*</h3><h4 class="dynamic">dynamic</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>The sea level on heightmaps were currently handling. If characters are to be able to swin in the sea, we must model the sea bottom, so we need heightmaps which cover at least the continental shelf. However, the sea bottom is not walkable territory and can be culled from walkmaps.</p>
<p><strong>NOTE</strong> that weve no way of verifying that the input file is binary STL data, if it is not this will run but will return garbage.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L34">view source</a></div></div><div class="public anchor" id="var-facet"><h3>facet</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>A codec for a vector within a binary STL file.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L20">view source</a></div></div><div class="public anchor" id="var-stl-to-svg"><h3>stl-to-svg</h3><div class="usage"><code>(stl-to-svg stl)</code></div><div class="doc"><div class="markdown"><p>Convert this in-memory <code>stl</code> structure, as read by <code>decode-binary-stl</code>, into an in-memory (Dali) SVG structure, and return it.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L110">view source</a></div></div><div class="public anchor" id="var-vect"><h3>vect</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>A codec for vectors within a binary STL file.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L13">view source</a></div></div><div class="public anchor" id="var-write-ascii-stl"><h3>write-ascii-stl</h3><div class="usage"><code>(write-ascii-stl filename stl)</code><code>(write-ascii-stl filename stl solidname)</code></div><div class="doc"><div class="markdown"><p>Write an <code>stl</code> structure as read by <code>decode-binary-stl</code> to this <code>filename</code> as ASCII encoded STL.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L57">view source</a></div></div></div></body></html> <p><strong>Note</strong> must be a floating point number. <code>(= 0 0.0)</code> returns <code>false</code>!</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L12">view source</a></div></div><div class="public anchor" id="var-binary-stl-file-.3Esvg"><h3>binary-stl-file-&gt;svg</h3><div class="usage"><code>(binary-stl-file-&gt;svg in-filename)</code><code>(binary-stl-file-&gt;svg in-filename out-filename)</code></div><div class="doc"><div class="markdown"><p>Given only an <code>in-filename</code>, parse the indicated file, expected to be binary STL, and return an equivalent SVG structure. Given both <code>in-filename</code> and <code>out-filename</code>, as side-effect write the SVG to the indicated output file.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L34">view source</a></div></div><div class="public anchor" id="var-cull-ocean-facets"><h3>cull-ocean-facets</h3><div class="usage"><code>(cull-ocean-facets stl)</code></div><div class="doc"><div class="markdown"><p>Ye cannae walk on water. Remove all facets from this <code>stl</code> structure which are at sea level.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L28">view source</a></div></div><div class="public anchor" id="var-ocean.3F"><h3>ocean?</h3><div class="usage"><code>(ocean? facet)</code></div><div class="doc"><div class="markdown"><p>Of a <code>facet</code>, is the altitude of every vertice equal to <code>*sea-level*</code>?</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/core.clj#L21">view source</a></div></div></div></body></html>

View file

@ -0,0 +1,3 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.edge documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch current"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.edge.html#var-edge.3F"><div class="inner"><span>edge?</span></div></a></li><li class="depth-1"><a href="walkmap.edge.html#var-path-.3Eedges"><div class="inner"><span>path-&gt;edges</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.edge</h1><div class="doc"><div class="markdown"><p>Essentially the specification for things we shall consider to be an edge. An edge is a line segment having just a start and an end, with no intervening nodes.</p></div></div><div class="public anchor" id="var-edge.3F"><h3>edge?</h3><div class="usage"><code>(edge? o)</code></div><div class="doc"><div class="markdown"><p>True if <code>o</code> satisfies the conditions for a path. A path shall be a map having the keys <code>:start</code> and <code>:end</code>, such that the values of each of those keys shall be a vertex.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/edge.clj#L9">view source</a></div></div><div class="public anchor" id="var-path-.3Eedges"><h3>path-&gt;edges</h3><div class="usage"><code>(path-&gt;edges o)</code></div><div class="doc"><div class="markdown"><p>if <code>o</code> is a path, a polygon, or a sequence of vertices, return a sequence of edges representing that path, polygon or sequence.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/edge.clj#L19">view source</a></div></div></div></body></html>

View file

@ -0,0 +1,3 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.geometry documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch current"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.geometry.html#var-collinear.3F"><div class="inner"><span>collinear?</span></div></a></li><li class="depth-1"><a href="walkmap.geometry.html#var-on.3F"><div class="inner"><span>on?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.geometry</h1><div class="doc"><div class="markdown"><p><strong>TODO</strong>: write docs</p></div></div><div class="public anchor" id="var-collinear.3F"><h3>collinear?</h3><div class="usage"><code>(collinear? v1 v2 v3)</code></div><div class="doc"><div class="markdown"><p>True if these vertices <code>v1</code>, <code>v2</code>, <code>v3</code> are colinear; false otherwise.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/geometry.clj#L9">view source</a></div></div><div class="public anchor" id="var-on.3F"><h3>on?</h3><div class="usage"><code>(on? e v)</code></div><div class="doc"><div class="markdown"><p>True if the vertex <code>v</code> is on the edge <code>e</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/geometry.clj#L42">view source</a></div></div></div></body></html>

View file

@ -0,0 +1,4 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.path documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch current"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.path.html#var-path.3F"><div class="inner"><span>path?</span></div></a></li><li class="depth-1"><a href="walkmap.path.html#var-polygon-.3Epath"><div class="inner"><span>polygon-&gt;path</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.path</h1><div class="doc"><div class="markdown"><p>Essentially the specification for things we shall consider to be path.</p></div></div><div class="public anchor" id="var-path.3F"><h3>path?</h3><div class="usage"><code>(path? o)</code></div><div class="doc"><div class="markdown"><p>True if <code>o</code> satisfies the conditions for a path. A path shall be a map having the key <code>:nodes</code>, whose value shall be a sequence of vertices as defined in <code>walkmap.polygon</code>.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/path.clj#L6">view source</a></div></div><div class="public anchor" id="var-polygon-.3Epath"><h3>polygon-&gt;path</h3><div class="usage"><code>(polygon-&gt;path o)</code></div><div class="doc"><div class="markdown"><p>If <code>o</code> is a polygon, return an equivalent path. Whats different about a path is that in polygons there is an implicit edge between the first vertex and the last. In paths, there isnt, so we need to add that edge explicitly.</p>
<p>If <code>o</code> is not a polygon, will throw an exception.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/path.clj#L18">view source</a></div></div></div></body></html>

View file

@ -0,0 +1,3 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.polygon documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch current"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.polygon.html#var-polygon.3F"><div class="inner"><span>polygon?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.polygon</h1><div class="doc"><div class="markdown"><p>Essentially the specification for things we shall consider to be polygons.</p></div></div><div class="public anchor" id="var-polygon.3F"><h3>polygon?</h3><div class="usage"><code>(polygon? o)</code></div><div class="doc"><div class="markdown"><p>True if <code>o</code> satisfies the conditions for a polygon. A polygon shall be a map which has a value for the key <code>:vertices</code>, where that value is a sequence of vertices.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/polygon.clj#L5">view source</a></div></div></div></body></html>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,3 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.svg documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch current"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.svg.html#var-stl-.3Esvg"><div class="inner"><span>stl-&gt;svg</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.svg</h1><div class="doc"><div class="markdown"><p>Utility functions for writing stereolithography (STL) files (and possibly, later, other geometry files of interest to us) as scalable vector graphics (SVG).</p></div></div><div class="public anchor" id="var-stl-.3Esvg"><h3>stl-&gt;svg</h3><div class="usage"><code>(stl-&gt;svg stl)</code></div><div class="doc"><div class="markdown"><p>Convert this in-memory <code>stl</code> structure, as read by <code>decode-binary-stl</code>, into an in-memory (Dali) SVG structure, and return it.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/svg.clj#L15">view source</a></div></div></div></body></html>

View file

@ -0,0 +1,5 @@
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>walkmap.vertex documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Walkmap</span> <span class="project-version">0.1.0-SNAPSHOT</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="intro.html"><div class="inner"><span>Introduction to walkmap</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>walkmap</span></div></div></li><li class="depth-2 branch"><a href="walkmap.core.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 branch"><a href="walkmap.edge.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>edge</span></div></a></li><li class="depth-2 branch"><a href="walkmap.geometry.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>geometry</span></div></a></li><li class="depth-2 branch"><a href="walkmap.path.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>path</span></div></a></li><li class="depth-2 branch"><a href="walkmap.polygon.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>polygon</span></div></a></li><li class="depth-2 branch"><a href="walkmap.stl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>stl</span></div></a></li><li class="depth-2 branch"><a href="walkmap.svg.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>svg</span></div></a></li><li class="depth-2 current"><a href="walkmap.vertex.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vertex</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="walkmap.vertex.html#var-ensure2d"><div class="inner"><span>ensure2d</span></div></a></li><li class="depth-1"><a href="walkmap.vertex.html#var-ensure3d"><div class="inner"><span>ensure3d</span></div></a></li><li class="depth-1"><a href="walkmap.vertex.html#var-vertex.3F"><div class="inner"><span>vertex?</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">walkmap.vertex</h1><div class="doc"><div class="markdown"><p>Essentially the specification for things we shall consider to be vertices.</p></div></div><div class="public anchor" id="var-ensure2d"><h3>ensure2d</h3><div class="usage"><code>(ensure2d o)</code></div><div class="doc"><div class="markdown"><p>If <code>o</code> is a vertex, set its <code>:z</code> value to zero; else throw an exception.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/vertex.clj#L34">view source</a></div></div><div class="public anchor" id="var-ensure3d"><h3>ensure3d</h3><div class="usage"><code>(ensure3d o)</code><code>(ensure3d o dflt)</code></div><div class="doc"><div class="markdown"><p>Given a vertex <code>o</code>, if <code>o</code> has a <code>:z</code> value, just return <code>o</code>; otherwise return a vertex like <code>o</code> but having thie <code>dflt</code> value as the value of its <code>:z</code> key, or zero as the value of its <code>:z</code> key if <code>dflt</code> is not specified.</p>
<p>If <code>o</code> is not a vertex, throws an exception.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/vertex.clj#L20">view source</a></div></div><div class="public anchor" id="var-vertex.3F"><h3>vertex?</h3><div class="usage"><code>(vertex? o)</code></div><div class="doc"><div class="markdown"><p>True if <code>o</code> satisfies the conditions for a vertex. That is, essentially, that it must rerpresent a two- or three- dimensional vector. A vertex is shall be a map having at least the keys <code>:x</code> and <code>:y</code>, where the value of those keys is a number. If the key <code>:z</code> is also present, its value must also be a number.</p>
<p>The name <code>vector?</code> was not used as that would clash with a function of that name in <code>clojure.core</code> whose semantics are entirely different.</p></div></div><div class="src-link"><a href="https://github.com/simon-brooke/walkmap/blob/master/src/walkmap/vertex.clj#L4">view source</a></div></div></div></body></html>

View file

@ -6,6 +6,7 @@
:source-uri "https://github.com/simon-brooke/walkmap/blob/master/{filepath}#L{line}"} :source-uri "https://github.com/simon-brooke/walkmap/blob/master/{filepath}#L{line}"}
:dependencies [[org.clojure/clojure "1.8.0"] :dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/math.numeric-tower "0.0.4"] [org.clojure/math.numeric-tower "0.0.4"]
[org.clojure/math.combinatorics "0.1.6"]
[com.taoensso/timbre "4.10.0"] [com.taoensso/timbre "4.10.0"]
[dali "0.7.4"] [dali "0.7.4"]
[hiccup "1.0.5"] [hiccup "1.0.5"]

View file

@ -39,7 +39,6 @@
(stl->svg (cull-ocean-facets (decode-binary-stl in-filename)))) (stl->svg (cull-ocean-facets (decode-binary-stl in-filename))))
([in-filename out-filename] ([in-filename out-filename]
(let [s (binary-stl-file->svg in-filename)] (let [s (binary-stl-file->svg in-filename)]
;; (svg/render-svg s out-filename)
(spit out-filename (html s)) (spit out-filename (html s))
s))) s)))

37
src/walkmap/edge.clj Normal file
View file

@ -0,0 +1,37 @@
(ns walkmap.edge
"Essentially the specification for things we shall consider to be an edge.
An edge is a line segment having just a start and an end, with no intervening
nodes."
(:require [walkmap.path :refer [path? polygon->path]]
[walkmap.polygon :refer [polygon?]]
[walkmap.vertex :refer [vertex?]]))
(defn edge?
"True if `o` satisfies the conditions for a path. A path shall be a map
having the keys `:start` and `:end`, such that the values of each of those
keys shall be a vertex."
[o]
(and
(map? o)
(vertex? (:start o))
(vertex? (:end o))))
(defn path->edges
"if `o` is a path, a polygon, or a sequence of vertices, return a sequence of
edges representing that path, polygon or sequence."
[o]
(cond
(seq? o)
(when
(and
(vertex? (first o))
(vertex? (first (rest o))))
(cons
{:start (first o)
:end (first (rest o))}
(path->edges (rest o))))
(path? o)
(path->edges (:nodes o))
(polygon? o)
(path->edges (polygon->path o))))

57
src/walkmap/geometry.clj Normal file
View file

@ -0,0 +1,57 @@
(ns walkmap.geometry
(:require [clojure.math.combinatorics :as combo]
[clojure.math.numeric-tower :as m]
[walkmap.edge :as edge]
[walkmap.path :refer [path? polygon->path]]
[walkmap.polygon :refer [polygon?]]
[walkmap.vertex :as vertex]))
(defn collinear?
"True if these vertices `v1`, `v2`, `v3` are colinear; false otherwise."
;; This is failing...
;; see http://www.ambrsoft.com/TrigoCalc/Line3D/LineColinear.htm
[v1 v2 v3]
(let [a (m/sqrt (+ (- (:x v2) (:x v1)) (- (:y v2) (:y v1)) (- (:z v2) (:z v1))))
b (m/sqrt (+ (- (:x v3) (:x v1)) (- (:y v3) (:y v1)) (- (:z v3) (:z v1))))
c (m/sqrt (+ (- (:x v3) (:x v2)) (- (:y v3) (:y v2)) (- (:z v3) (:z v2))))]
(not
(and
(> (+ a b) c)
(> (+ a c) b)
(> (+ b c) a)))))
;; (collinear? {:x 0 :y 0 :z 0} {:x 1 :y 1 :z 1} {:x 7 :y 7 :z 7})
;; (collinear? {:x 0 :y 0 :z 0} {:x 1 :y 2 :z 1} {:x 7 :y 7 :z 7})
;; (collinear? {:x 0 :y 0 :z 0} {:x 0 :y 2 :z 0} {:x 0 :y 3 :z 0})
;; (def v1 {:x 0 :y 0 :z 0})
;; (def v2 {:x 0 :y 2 :z 0})
;; (def v3 {:x 0 :y 7 :z 0})
;; (def a (m/sqrt (+ (- (:x v2) (:x v1)) (- (:y v2) (:y v1)) (- (:z v2) (:z v1)))))
;; a
;; (def b (m/sqrt (+ (- (:x v3) (:x v1)) (- (:y v3) (:y v1)) (- (:z v3) (:z v1)))))
;; b
;; (def c (m/sqrt (+ (- (:x v3) (:x v2)) (- (:y v3) (:y v2)) (- (:z v3) (:z v2)))))
;; c
;; (> (+ b c) a)
;; (> (+ a c) b)
;; (> (+ a c) c)
(defn on?
"True if the vertex `v` is on the edge `e`."
[e v]
(let [p (vertex/ensure3d (:start e))
q (vertex/ensure3d v)
r (vertex/ensure3d (:end e))]
(and
(collinear? p q r)
(<= (:x q) (max (:x p) (:x r)))
(>= (:x q) (min (:x p) (:x r)))
(<= (:y q) (max (:y p) (:y r)))
(>= (:y q) (min (:y p) (:y r)))
(<= (:z q) (max (:z p) (:z r)))
(>= (:z q) (min (:z p) (:z r))))))

View file

@ -1,6 +1,7 @@
(ns walkmap.path (ns walkmap.path
"Essentially the specification for things we shall consider to be path." "Essentially the specification for things we shall consider to be path."
(:require [walkmap.polygon :refer [polygon? vertex?]])) (:require [walkmap.polygon :refer [polygon?]]
[walkmap.vertex :refer [vertex?]]))
(defn path? (defn path?
"True if `o` satisfies the conditions for a path. A path shall be a map "True if `o` satisfies the conditions for a path. A path shall be a map

View file

@ -1,21 +1,6 @@
(ns walkmap.polygon (ns walkmap.polygon
"Essentially the specification for things we shall consider to be polygons.") "Essentially the specification for things we shall consider to be polygons."
(:require [walkmap.vertex :refer [vertex?]]))
(defn vertex?
"True if `o` satisfies the conditions for a vertex. That is, essentially,
that it must rerpresent a two- or three- dimensional vector. A vertex is
shall be a map having at least the keys `:x` and `:y`, where the value of
those keys is a number. If the key `:z` is also present, its value must also
be a number.
The name `vector?` was not used as that would clash with a function of that
name in `clojure.core` whose semantics are entirely different."
[o]
(and
(map? o)
(number? (:x o))
(number? (:y o))
(or (nil? (:z o)) (number? (:z o)))))
(defn polygon? (defn polygon?
"True if `o` satisfies the conditions for a polygon. A polygon shall be a "True if `o` satisfies the conditions for a polygon. A polygon shall be a

View file

@ -1,7 +1,7 @@
(ns walkmap.stl (ns walkmap.stl
"Utility functions dealing with stereolithography (STL) files. Not a stable API yet!" "Utility functions dealing with stereolithography (STL) files. Not a stable API yet!"
(:require [clojure.java.io :as io :refer [file output-stream input-stream]] (:require [clojure.java.io :as io :refer [file output-stream input-stream]]
;; [clojure.string :as s] [clojure.string :as s]
[me.raynes.fs :as fs] [me.raynes.fs :as fs]
[org.clojars.smee.binary.core :as b] [org.clojars.smee.binary.core :as b]
[taoensso.timbre :as l :refer [info error spy]] [taoensso.timbre :as l :refer [info error spy]]

View file

@ -1,10 +1,11 @@
(ns walkmap.stl (ns walkmap.svg
"Utility functions for writing stereolithography (STL) files (and possibly, "Utility functions for writing stereolithography (STL) files (and possibly,
later, other geometry files of interest to us) as scalable vector graphics later, other geometry files of interest to us) as scalable vector graphics
(SVG)." (SVG)."
(:require [clojure.string :as s] (:require [clojure.string :as s]
[taoensso.timbre :as l :refer [info error spy]] [taoensso.timbre :as l :refer [info error spy]]
[walkmap.polygon :refer [polygon? vertex?]])) [walkmap.polygon :refer [polygon?]]
[walkmap.vertex :refer [vertex?]]))
(defn- facet->svg-poly (defn- facet->svg-poly
[facet] [facet]

40
src/walkmap/vertex.clj Normal file
View file

@ -0,0 +1,40 @@
(ns walkmap.vertex
"Essentially the specification for things we shall consider to be vertices.")
(defn vertex?
"True if `o` satisfies the conditions for a vertex. That is, essentially,
that it must rerpresent a two- or three- dimensional vector. A vertex is
shall be a map having at least the keys `:x` and `:y`, where the value of
those keys is a number. If the key `:z` is also present, its value must also
be a number.
The name `vector?` was not used as that would clash with a function of that
name in `clojure.core` whose semantics are entirely different."
[o]
(and
(map? o)
(number? (:x o))
(number? (:y o))
(or (nil? (:z o)) (number? (:z o)))))
(defn ensure3d
"Given a vertex `o`, if `o` has a `:z` value, just return `o`; otherwise
return a vertex like `o` but having thie `dflt` value as the value of its
`:z` key, or zero as the value of its `:z` key if `dflt` is not specified.
If `o` is not a vertex, throws an exception."
([o]
(ensure3d o 0.0))
([o dflt]
(cond
(not (vertex? o)) (throw (Exception. "Not a vertex!"))
(:z o) o
:else (assoc o :z dflt))))
(defn ensure2d
"If `o` is a vertex, set its `:z` value to zero; else throw an exception."
[o]
(if
(vertex? o)
(assoc o :z 0.0)
(throw (Exception. "Not a vertex!"))))