forked from libtcod/python-tcod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtdl.map-module.html
More file actions
executable file
·283 lines (266 loc) · 11.9 KB
/
tdl.map-module.html
File metadata and controls
executable file
·283 lines (266 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>tdl.map</title>
<link rel="stylesheet" href="epydoc.css" type="text/css" />
<script type="text/javascript" src="epydoc.js"></script>
</head>
<body bgcolor="white" text="black" link="blue" vlink="#204080"
alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="tdl-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://code.google.com/p/python-tdl/">python-tdl</a></th>
</tr></table></th>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="100%">
<span class="breadcrumbs">
<a href="tdl-module.html">Package tdl</a> ::
Module map
</span>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<!-- hide/show private -->
<tr><td align="right"><span class="options"
>[<a href="frames.html" target="_top">frames</a
>] | <a href="tdl.map-module.html"
target="_top">no frames</a>]</span></td></tr>
</table>
</td>
</tr>
</table>
<!-- ==================== MODULE DESCRIPTION ==================== -->
<h1 class="epydoc">Module map</h1><p class="nomargin-top"><span class="codelink"><a href="tdl.map-pysrc.html">source code</a></span></p>
<p>Rogue-like map utilitys such as line-of-sight, field-of-view, and
path-finding.</p>
<!-- ==================== CLASSES ==================== -->
<a name="section-Classes"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td align="left" colspan="2" class="table-header">
<span class="table-header">Classes</span></td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="tdl.map.Map-class.html" class="summary-name">Map</a><br />
Fast field-of-view and path-finding on stored data.
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<a href="tdl.map.AStar-class.html" class="summary-name">AStar</a><br />
A* pathfinder
</td>
</tr>
</table>
<!-- ==================== FUNCTIONS ==================== -->
<a name="section-Functions"></a>
<table class="summary" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td align="left" colspan="2" class="table-header">
<span class="table-header">Functions</span></td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type">set((x, y), ...)</span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="tdl.map-module.html#quick_fov" class="summary-sig-name">quick_fov</a>(<span class="summary-sig-arg">x</span>,
<span class="summary-sig-arg">y</span>,
<span class="summary-sig-arg">callback</span>,
<span class="summary-sig-arg">fov</span>=<span class="summary-sig-default"><code class="variable-quote">'</code><code class="variable-string">PERMISSIVE</code><code class="variable-quote">'</code></span>,
<span class="summary-sig-arg">radius</span>=<span class="summary-sig-default">7.5</span>,
<span class="summary-sig-arg">lightWalls</span>=<span class="summary-sig-default">True</span>,
<span class="summary-sig-arg">sphere</span>=<span class="summary-sig-default">True</span>)</span><br />
All field-of-view functionality in one call.</td>
<td align="right" valign="top">
<span class="codelink"><a href="tdl.map-pysrc.html#quick_fov">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="15%" align="right" valign="top" class="summary">
<span class="summary-type"> </span>
</td><td class="summary">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td><span class="summary-sig"><a href="tdl.map-module.html#bresenham" class="summary-sig-name">bresenham</a>(<span class="summary-sig-arg">x1</span>,
<span class="summary-sig-arg">y1</span>,
<span class="summary-sig-arg">x2</span>,
<span class="summary-sig-arg">y2</span>)</span><br />
Return a list of points in a bresenham line.</td>
<td align="right" valign="top">
<span class="codelink"><a href="tdl.map-pysrc.html#bresenham">source code</a></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- ==================== FUNCTION DETAILS ==================== -->
<a name="section-FunctionDetails"></a>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
<td align="left" colspan="2" class="table-header">
<span class="table-header">Function Details</span></td>
</tr>
</table>
<a name="quick_fov"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">quick_fov</span>(<span class="sig-arg">x</span>,
<span class="sig-arg">y</span>,
<span class="sig-arg">callback</span>,
<span class="sig-arg">fov</span>=<span class="sig-default"><code class="variable-quote">'</code><code class="variable-string">PERMISSIVE</code><code class="variable-quote">'</code></span>,
<span class="sig-arg">radius</span>=<span class="sig-default">7.5</span>,
<span class="sig-arg">lightWalls</span>=<span class="sig-default">True</span>,
<span class="sig-arg">sphere</span>=<span class="sig-default">True</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="tdl.map-pysrc.html#quick_fov">source code</a></span>
</td>
</tr></table>
<p>All field-of-view functionality in one call.</p>
<p>Before using this call be sure to make a function, lambda, or method
that takes 2 positional parameters and returns True if light can pass
through the tile or False for light-blocking tiles and for indexes that
are out of bounds of the dungeon.</p>
<p>This function is 'quick' as in no hassle but can quickly become a very
slow function call if a large radius is used or the callback provided
itself isn't optimized.</p>
<p>Always check if the index is in bounds both in the callback and in the
returned values. These values can go into the negatives as well.</p>
<dl class="fields">
<dt>Parameters:</dt>
<dd><ul class="nomargin-top">
<li><strong class="pname"><code>x</code></strong> (int) - x center of the field-of-view</li>
<li><strong class="pname"><code>y</code></strong> (int) - y center of the field-of-view</li>
<li><strong class="pname"><code>callback</code></strong> (function) - This should be a function that takes two positional arguments x,y
and returns True if the tile at that position is transparent or
False if the tile blocks light or is out of bounds.</li>
<li><strong class="pname"><code>fov</code></strong> (string) - The type of field-of-view to be used. Available types are:
<p>'BASIC', 'DIAMOND', 'SHADOW', 'RESTRICTIVE', 'PERMISSIVE',
'PERMISSIVE0', 'PERMISSIVE1', ..., 'PERMISSIVE8'</p></li>
<li><strong class="pname"><code>radius</code></strong> (float) - Raduis of the field-of-view.
<p>When sphere is True a floating point can be used to fine-tune
the range. Otherwise the radius is just rounded up.</p>
<p>Be careful as a large radius has an exponential affect on how
long this function takes.</p></li>
<li><strong class="pname"><code>lightWalls</code></strong> (boolean) - Include or exclude wall tiles in the field-of-view.</li>
<li><strong class="pname"><code>sphere</code></strong> (boolean) - True for a spherical field-of-view. False for a square one.</li>
</ul></dd>
<dt>Returns: set((x, y), ...)</dt>
<dd>Returns a set of (x, y) points that are within the field-of-view.</dd>
</dl>
</td></tr></table>
</div>
<a name="bresenham"></a>
<div>
<table class="details" border="1" cellpadding="3"
cellspacing="0" width="100%" bgcolor="white">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr valign="top"><td>
<h3 class="epydoc"><span class="sig"><span class="sig-name">bresenham</span>(<span class="sig-arg">x1</span>,
<span class="sig-arg">y1</span>,
<span class="sig-arg">x2</span>,
<span class="sig-arg">y2</span>)</span>
</h3>
</td><td align="right" valign="top"
><span class="codelink"><a href="tdl.map-pysrc.html#bresenham">source code</a></span>
</td>
</tr></table>
<p>Return a list of points in a bresenham line.</p>
<p>Implementation hastily copied from RogueBasin.</p>
<dl class="fields">
<dt>Returns:</dt>
<dd>Returns a list of (x, y) points, including both the start and
endpoints.</dd>
</dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
bgcolor="#a0c0ff" cellspacing="0">
<tr valign="middle">
<!-- Home link -->
<th> <a
href="tdl-module.html">Home</a> </th>
<!-- Tree link -->
<th> <a
href="module-tree.html">Trees</a> </th>
<!-- Index link -->
<th> <a
href="identifier-index.html">Indices</a> </th>
<!-- Help link -->
<th> <a
href="help.html">Help</a> </th>
<!-- Project homepage -->
<th class="navbar" align="right" width="100%">
<table border="0" cellpadding="0" cellspacing="0">
<tr><th class="navbar" align="center"
><a class="navbar" target="_top" href="http://code.google.com/p/python-tdl/">python-tdl</a></th>
</tr></table></th>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
<tr>
<td align="left" class="footer">
<a href="epydoc-log.html">Generated by Epydoc
3.0.1 on Sat May 28 16:09:37 2016</a>
</td>
<td align="right" class="footer">
<a target="mainFrame" href="http://epydoc.sourceforge.net"
>http://epydoc.sourceforge.net</a>
</td>
</tr>
</table>
<script type="text/javascript">
<!--
// Private objects are initially displayed (because if
// javascript is turned off then we want them to be
// visible); but by default, we want to hide them. So hide
// them unless we have a cookie that says to show them.
checkCookie();
// -->
</script>
</body>
</html>