-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4d8032
commit 0d5767f
Showing
51 changed files
with
7,863 additions
and
64 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
<!DOCTYPE html> | ||
<html class="writer-html5" lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>pathfinding3d.core.world — pathfinding3d</title> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/css/theme.css?v=19f00094" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/graphviz.css?v=eafc0fe6" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/copybutton.css?v=76b2166b" /> | ||
<link rel="stylesheet" type="text/css" href="../../../_static/custom.css?v=71f9a9e8" /> | ||
|
||
|
||
<link rel="shortcut icon" href="../../../_static/favicon.ico"/> | ||
<!--[if lt IE 9]> | ||
<script src="../../../_static/js/html5shiv.min.js"></script> | ||
<![endif]--> | ||
|
||
<script src="../../../_static/jquery.js?v=5d32c60e"></script> | ||
<script src="../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script> | ||
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js?v=5ed476db"></script> | ||
<script src="../../../_static/doctools.js?v=888ff710"></script> | ||
<script src="../../../_static/sphinx_highlight.js?v=4825356b"></script> | ||
<script src="../../../_static/clipboard.min.js?v=a7894cd8"></script> | ||
<script src="../../../_static/copybutton.js?v=f281be69"></script> | ||
<script src="../../../_static/js/theme.js"></script> | ||
<link rel="index" title="Index" href="../../../genindex.html" /> | ||
<link rel="search" title="Search" href="../../../search.html" /> | ||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
<div class="wy-grid-for-nav"> | ||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> | ||
<div class="wy-side-scroll"> | ||
<div class="wy-side-nav-search" style="background: white" > | ||
|
||
|
||
|
||
<a href="../../../index.html" class="icon icon-home"> | ||
pathfinding3d | ||
<img src="../../../_static/logo.png" class="logo" alt="Logo"/> | ||
</a> | ||
<div class="version"> | ||
0.7.1 | ||
</div> | ||
<div role="search"> | ||
<form id="rtd-search-form" class="wy-form" action="../../../search.html" method="get"> | ||
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" /> | ||
<input type="hidden" name="check_keywords" value="yes" /> | ||
<input type="hidden" name="area" value="default" /> | ||
</form> | ||
</div> | ||
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> | ||
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p> | ||
<ul> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../INTRO.html">Pathfinding3D</a><ul> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../INTRO.html#introduction">Introduction</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../INSTALL.html">Installation</a><ul> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../INSTALL.html#requirements">Requirements</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../INSTALL.html#pypi">PyPI</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../INSTALL.html#for-development-purposes-please-use-editable-mode">For development purposes please use editable mode</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../USAGE.html">Usage</a><ul> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../USAGE.html#basic-usage">Basic usage</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../USAGE.html#steps-portals-bridges">Steps/Portals/Bridges</a><ul> | ||
<li class="toctree-l3"><a class="reference internal" href="../../../USAGE.html#toy-example-connecting-two-building-storeys-with-a-bridge">Toy Example: Connecting Two Building Storeys with a Bridge</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../USAGE.html#visualizing-the-path">Visualizing the Path</a><ul> | ||
<li class="toctree-l3"><a class="reference internal" href="../../../USAGE.html#prerequisites">Prerequisites</a></li> | ||
<li class="toctree-l3"><a class="reference internal" href="../../../USAGE.html#example-with-open3d">Example with Open3D</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../USAGE.html#example-with-any-angle-of-movement">Example with any angle of movement</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../CHANGELOG.html">Change Log</a><ul> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id1">0.7.1</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id2">0.7.0</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id3">0.6.2</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id4">0.6.1</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id5">0.6.0</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id6">0.5.1</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id7">0.5.0</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id8">0.4.1</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id9">0.4.0</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id10">0.3.1</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id11">0.3</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id12">0.2</a></li> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../CHANGELOG.html#id13">0.1</a></li> | ||
</ul> | ||
</li> | ||
<li class="toctree-l1"><a class="reference internal" href="../../../modules.html">pathfinding3d</a><ul> | ||
<li class="toctree-l2"><a class="reference internal" href="../../../pathfinding3d.html">pathfinding3d package</a><ul> | ||
<li class="toctree-l3"><a class="reference internal" href="../../../pathfinding3d.html#subpackages">Subpackages</a><ul> | ||
<li class="toctree-l4"><a class="reference internal" href="../../../pathfinding3d.core.html">pathfinding3d.core package</a></li> | ||
<li class="toctree-l4"><a class="reference internal" href="../../../pathfinding3d.finder.html">pathfinding3d.finder package</a></li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
|
||
</div> | ||
</div> | ||
</nav> | ||
|
||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" style="background: white" > | ||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> | ||
<a href="../../../index.html">pathfinding3d</a> | ||
</nav> | ||
|
||
<div class="wy-nav-content"> | ||
<div class="rst-content style-external-links"> | ||
<div role="navigation" aria-label="Page navigation"> | ||
<ul class="wy-breadcrumbs"> | ||
<li><a href="../../../index.html" class="icon icon-home" aria-label="Home"></a></li> | ||
<li class="breadcrumb-item"><a href="../../index.html">Module code</a></li> | ||
<li class="breadcrumb-item active">pathfinding3d.core.world</li> | ||
<li class="wy-breadcrumbs-aside"> | ||
</li> | ||
</ul> | ||
<hr/> | ||
</div> | ||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> | ||
<div itemprop="articleBody"> | ||
|
||
<h1>Source code for pathfinding3d.core.world</h1><div class="highlight"><pre> | ||
<span></span><span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Dict</span><span class="p">,</span> <span class="n">List</span> | ||
|
||
<span class="kn">from</span> <span class="nn">.grid</span> <span class="kn">import</span> <span class="n">Grid</span> | ||
<span class="kn">from</span> <span class="nn">.node</span> <span class="kn">import</span> <span class="n">GridNode</span> | ||
|
||
|
||
<span class="c1"># a world connects grids but can have multiple grids.</span> | ||
<div class="viewcode-block" id="World"><a class="viewcode-back" href="../../../pathfinding3d.core.world.html#pathfinding3d.core.world.World">[docs]</a><span class="k">class</span> <span class="nc">World</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> A world connects grids but can have multiple grids.</span> | ||
<span class="sd"> """</span> | ||
|
||
<div class="viewcode-block" id="World.__init__"><a class="viewcode-back" href="../../../pathfinding3d.core.world.html#pathfinding3d.core.world.World.__init__">[docs]</a> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">grids</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">int</span><span class="p">,</span> <span class="n">Grid</span><span class="p">]):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Initialize a new world.</span> | ||
|
||
<span class="sd"> Parameters</span> | ||
<span class="sd"> ----------</span> | ||
<span class="sd"> grids : Dict[int, Grid]</span> | ||
<span class="sd"> grids in this world</span> | ||
<span class="sd"> """</span> | ||
<span class="bp">self</span><span class="o">.</span><span class="n">grids</span> <span class="o">=</span> <span class="n">grids</span></div> | ||
|
||
<div class="viewcode-block" id="World.neighbors"><a class="viewcode-back" href="../../../pathfinding3d.core.world.html#pathfinding3d.core.world.World.neighbors">[docs]</a> <span class="k">def</span> <span class="nf">neighbors</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node</span><span class="p">:</span> <span class="n">GridNode</span><span class="p">,</span> <span class="n">diagonal_movement</span><span class="p">:</span> <span class="nb">int</span><span class="p">)</span> <span class="o">-></span> <span class="n">List</span><span class="p">[</span><span class="n">GridNode</span><span class="p">]:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Get neighbors of the given node.</span> | ||
|
||
<span class="sd"> Parameters</span> | ||
<span class="sd"> ----------</span> | ||
<span class="sd"> node : GridNode</span> | ||
<span class="sd"> node to get neighbors from</span> | ||
<span class="sd"> diagonal_movement : int</span> | ||
<span class="sd"> if diagonal movement is allowed</span> | ||
<span class="sd"> (see enum in diagonal_movement)</span> | ||
|
||
<span class="sd"> Returns</span> | ||
<span class="sd"> -------</span> | ||
<span class="sd"> List[GridNode]</span> | ||
<span class="sd"> neighbors of the given node</span> | ||
<span class="sd"> """</span> | ||
|
||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">grids</span><span class="p">[</span><span class="n">node</span><span class="o">.</span><span class="n">grid_id</span><span class="p">]</span><span class="o">.</span><span class="n">neighbors</span><span class="p">(</span><span class="n">node</span><span class="p">,</span> <span class="n">diagonal_movement</span><span class="o">=</span><span class="n">diagonal_movement</span><span class="p">)</span></div> | ||
|
||
<div class="viewcode-block" id="World.calc_cost"><a class="viewcode-back" href="../../../pathfinding3d.core.world.html#pathfinding3d.core.world.World.calc_cost">[docs]</a> <span class="k">def</span> <span class="nf">calc_cost</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">node_a</span><span class="p">:</span> <span class="n">GridNode</span><span class="p">,</span> <span class="n">node_b</span><span class="p">:</span> <span class="n">GridNode</span><span class="p">,</span> <span class="n">weighted</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-></span> <span class="nb">float</span><span class="p">:</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Calculate the cost between two nodes.</span> | ||
|
||
<span class="sd"> Parameters</span> | ||
<span class="sd"> ----------</span> | ||
<span class="sd"> node_a : GridNode</span> | ||
<span class="sd"> first node</span> | ||
<span class="sd"> node_b : GridNode</span> | ||
<span class="sd"> second node</span> | ||
<span class="sd"> weighted : bool</span> | ||
<span class="sd"> wether to use weights or not</span> | ||
|
||
<span class="sd"> Returns</span> | ||
<span class="sd"> -------</span> | ||
<span class="sd"> float</span> | ||
<span class="sd"> cost between the two nodes</span> | ||
<span class="sd"> """</span> | ||
<span class="c1"># TODO: if node_a.grid_id != node_b.grid_id calculate distance between</span> | ||
<span class="c1"># grids as well, for now we ignore switching grids</span> | ||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">grids</span><span class="p">[</span><span class="n">node_a</span><span class="o">.</span><span class="n">grid_id</span><span class="p">]</span><span class="o">.</span><span class="n">calc_cost</span><span class="p">(</span><span class="n">node_a</span><span class="p">,</span> <span class="n">node_b</span><span class="p">,</span> <span class="n">weighted</span><span class="o">=</span><span class="n">weighted</span><span class="p">)</span></div> | ||
|
||
<div class="viewcode-block" id="World.cleanup"><a class="viewcode-back" href="../../../pathfinding3d.core.world.html#pathfinding3d.core.world.World.cleanup">[docs]</a> <span class="k">def</span> <span class="nf">cleanup</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | ||
<span class="w"> </span><span class="sd">"""</span> | ||
<span class="sd"> Cleanup all grids in this world.</span> | ||
<span class="sd"> """</span> | ||
<span class="k">for</span> <span class="n">grid</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">grids</span><span class="o">.</span><span class="n">values</span><span class="p">():</span> | ||
<span class="n">grid</span><span class="o">.</span><span class="n">cleanup</span><span class="p">()</span></div></div> | ||
</pre></div> | ||
|
||
</div> | ||
</div> | ||
<footer> | ||
|
||
<hr/> | ||
|
||
<div role="contentinfo"> | ||
<p>© Copyright 2024, Harisankar Babu.</p> | ||
</div> | ||
|
||
|
||
|
||
</footer> | ||
</div> | ||
</div> | ||
</section> | ||
</div> | ||
<script> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable(true); | ||
}); | ||
</script> | ||
|
||
</body> | ||
</html> |
Oops, something went wrong.