Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
356 chris 1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2
<!--NewPage-->
3
<HTML>
4
<HEAD>
5
<!-- Generated by javadoc (build 1.6.0_26) on Sun Jan 27 20:37:06 CET 2013 -->
6
<TITLE>
7
MathUtils (libgdx API)
8
</TITLE>
9
 
10
<META NAME="date" CONTENT="2013-01-27">
11
 
12
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
13
 
14
<SCRIPT type="text/javascript">
15
function windowTitle()
16
{
17
    if (location.href.indexOf('is-external=true') == -1) {
18
        parent.document.title="MathUtils (libgdx API)";
19
    }
20
}
21
</SCRIPT>
22
<NOSCRIPT>
23
</NOSCRIPT>
24
 
25
</HEAD>
26
 
27
<BODY BGCOLOR="white" onload="windowTitle();">
28
<HR>
29
 
30
 
31
<!-- ========= START OF TOP NAVBAR ======= -->
32
<A NAME="navbar_top"><!-- --></A>
33
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35
<TR>
36
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37
<A NAME="navbar_top_firstrow"><!-- --></A>
38
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39
  <TR ALIGN="center" VALIGN="top">
40
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48
  </TR>
49
</TABLE>
50
</TD>
51
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52
 
53
                                libgdx API
54
                                <style>
55
                                body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
56
                                pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
57
                                h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%;  font-weight:bold }
58
                                .TableHeadingColor { background:#EEEEFF; }
59
                                a { text-decoration:none }
60
                                a:hover { text-decoration:underline }
61
                                a:link, a:visited { color:blue }
62
                                table { border:0px }
63
                                .TableRowColor td:first-child { border-left:1px solid black }
64
                                .TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
65
                                hr { border:0px; border-bottom:1px solid #333366; }
66
                                </style>
67
                        </EM>
68
</TD>
69
</TR>
70
 
71
<TR>
72
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
73
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Intersector.SplitTriangle.html" title="class in com.badlogic.gdx.math"><B>PREV CLASS</B></A>&nbsp;
74
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Matrix3.html" title="class in com.badlogic.gdx.math"><B>NEXT CLASS</B></A></FONT></TD>
75
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
76
  <A HREF="../../../../index.html?com/badlogic/gdx/math/MathUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
77
&nbsp;<A HREF="MathUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
78
&nbsp;<SCRIPT type="text/javascript">
79
  <!--
80
  if(window==top) {
81
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
82
  }
83
  //-->
84
</SCRIPT>
85
<NOSCRIPT>
86
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
87
</NOSCRIPT>
88
 
89
 
90
</FONT></TD>
91
</TR>
92
<TR>
93
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
94
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
95
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
96
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
97
</TR>
98
</TABLE>
99
<A NAME="skip-navbar_top"></A>
100
<!-- ========= END OF TOP NAVBAR ========= -->
101
 
102
<HR>
103
<!-- ======== START OF CLASS DATA ======== -->
104
<H2>
105
<FONT SIZE="-1">
106
com.badlogic.gdx.math</FONT>
107
<BR>
108
Class MathUtils</H2>
109
<PRE>
110
java.lang.Object
111
  <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.badlogic.gdx.math.MathUtils</B>
112
</PRE>
113
<HR>
114
<DL>
115
<DT><PRE>public class <B>MathUtils</B><DT>extends java.lang.Object</DL>
116
</PRE>
117
 
118
<P>
119
Utility and fast math functions.
120
 <p>
121
 Thanks to Riven on JavaGaming.org for the basis of sin/cos/atan2/floor/ceil.
122
<P>
123
 
124
<P>
125
<DL>
126
<DT><B>Author:</B></DT>
127
  <DD>Nathan Sweet</DD>
128
</DL>
129
<HR>
130
 
131
<P>
132
<!-- =========== FIELD SUMMARY =========== -->
133
 
134
<A NAME="field_summary"><!-- --></A>
135
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
136
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
137
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
138
<B>Field Summary</B></FONT></TH>
139
</TR>
140
<TR BGCOLOR="white" CLASS="TableRowColor">
141
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
142
<CODE>static&nbsp;float</CODE></FONT></TD>
143
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#degRad">degRad</A></B></CODE>
144
 
145
<BR>
146
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
147
</TR>
148
<TR BGCOLOR="white" CLASS="TableRowColor">
149
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
150
<CODE>static&nbsp;float</CODE></FONT></TD>
151
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#degreesToRadians">degreesToRadians</A></B></CODE>
152
 
153
<BR>
154
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
155
</TR>
156
<TR BGCOLOR="white" CLASS="TableRowColor">
157
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
158
<CODE>static&nbsp;float</CODE></FONT></TD>
159
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#nanoToSec">nanoToSec</A></B></CODE>
160
 
161
<BR>
162
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
163
</TR>
164
<TR BGCOLOR="white" CLASS="TableRowColor">
165
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
166
<CODE>static&nbsp;float</CODE></FONT></TD>
167
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#PI">PI</A></B></CODE>
168
 
169
<BR>
170
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
171
</TR>
172
<TR BGCOLOR="white" CLASS="TableRowColor">
173
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
174
<CODE>static&nbsp;float</CODE></FONT></TD>
175
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#radDeg">radDeg</A></B></CODE>
176
 
177
<BR>
178
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
179
</TR>
180
<TR BGCOLOR="white" CLASS="TableRowColor">
181
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
182
<CODE>static&nbsp;float</CODE></FONT></TD>
183
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#radiansToDegrees">radiansToDegrees</A></B></CODE>
184
 
185
<BR>
186
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
187
</TR>
188
<TR BGCOLOR="white" CLASS="TableRowColor">
189
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
190
<CODE>static&nbsp;java.util.Random</CODE></FONT></TD>
191
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random">random</A></B></CODE>
192
 
193
<BR>
194
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
195
</TR>
196
</TABLE>
197
&nbsp;
198
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
199
 
200
<A NAME="constructor_summary"><!-- --></A>
201
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
202
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
203
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
204
<B>Constructor Summary</B></FONT></TH>
205
</TR>
206
<TR BGCOLOR="white" CLASS="TableRowColor">
207
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#MathUtils()">MathUtils</A></B>()</CODE>
208
 
209
<BR>
210
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
211
</TR>
212
</TABLE>
213
&nbsp;
214
<!-- ========== METHOD SUMMARY =========== -->
215
 
216
<A NAME="method_summary"><!-- --></A>
217
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
218
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
219
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
220
<B>Method Summary</B></FONT></TH>
221
</TR>
222
<TR BGCOLOR="white" CLASS="TableRowColor">
223
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
224
<CODE>static&nbsp;float</CODE></FONT></TD>
225
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#atan2(float, float)">atan2</A></B>(float&nbsp;y,
226
      float&nbsp;x)</CODE>
227
 
228
<BR>
229
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns atan2 in radians from a lookup table.</TD>
230
</TR>
231
<TR BGCOLOR="white" CLASS="TableRowColor">
232
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
233
<CODE>static&nbsp;int</CODE></FONT></TD>
234
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#ceil(float)">ceil</A></B>(float&nbsp;x)</CODE>
235
 
236
<BR>
237
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the smallest integer greater than or equal to the specified float.</TD>
238
</TR>
239
<TR BGCOLOR="white" CLASS="TableRowColor">
240
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
241
<CODE>static&nbsp;int</CODE></FONT></TD>
242
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#ceilPositive(float)">ceilPositive</A></B>(float&nbsp;x)</CODE>
243
 
244
<BR>
245
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the smallest integer greater than or equal to the specified float.</TD>
246
</TR>
247
<TR BGCOLOR="white" CLASS="TableRowColor">
248
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
249
<CODE>static&nbsp;float</CODE></FONT></TD>
250
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#clamp(float, float, float)">clamp</A></B>(float&nbsp;value,
251
      float&nbsp;min,
252
      float&nbsp;max)</CODE>
253
 
254
<BR>
255
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
256
</TR>
257
<TR BGCOLOR="white" CLASS="TableRowColor">
258
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
259
<CODE>static&nbsp;int</CODE></FONT></TD>
260
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#clamp(int, int, int)">clamp</A></B>(int&nbsp;value,
261
      int&nbsp;min,
262
      int&nbsp;max)</CODE>
263
 
264
<BR>
265
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
266
</TR>
267
<TR BGCOLOR="white" CLASS="TableRowColor">
268
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
269
<CODE>static&nbsp;short</CODE></FONT></TD>
270
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#clamp(short, short, short)">clamp</A></B>(short&nbsp;value,
271
      short&nbsp;min,
272
      short&nbsp;max)</CODE>
273
 
274
<BR>
275
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
276
</TR>
277
<TR BGCOLOR="white" CLASS="TableRowColor">
278
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
279
<CODE>static&nbsp;float</CODE></FONT></TD>
280
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#cos(float)">cos</A></B>(float&nbsp;radians)</CODE>
281
 
282
<BR>
283
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the cosine in radians.</TD>
284
</TR>
285
<TR BGCOLOR="white" CLASS="TableRowColor">
286
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
287
<CODE>static&nbsp;float</CODE></FONT></TD>
288
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#cosDeg(float)">cosDeg</A></B>(float&nbsp;degrees)</CODE>
289
 
290
<BR>
291
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the cosine in radians.</TD>
292
</TR>
293
<TR BGCOLOR="white" CLASS="TableRowColor">
294
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
295
<CODE>static&nbsp;int</CODE></FONT></TD>
296
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#floor(float)">floor</A></B>(float&nbsp;x)</CODE>
297
 
298
<BR>
299
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the largest integer less than or equal to the specified float.</TD>
300
</TR>
301
<TR BGCOLOR="white" CLASS="TableRowColor">
302
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
303
<CODE>static&nbsp;int</CODE></FONT></TD>
304
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#floorPositive(float)">floorPositive</A></B>(float&nbsp;x)</CODE>
305
 
306
<BR>
307
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the largest integer less than or equal to the specified float.</TD>
308
</TR>
309
<TR BGCOLOR="white" CLASS="TableRowColor">
310
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
311
<CODE>static&nbsp;boolean</CODE></FONT></TD>
312
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#isPowerOfTwo(int)">isPowerOfTwo</A></B>(int&nbsp;value)</CODE>
313
 
314
<BR>
315
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
316
</TR>
317
<TR BGCOLOR="white" CLASS="TableRowColor">
318
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
319
<CODE>static&nbsp;int</CODE></FONT></TD>
320
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#nextPowerOfTwo(int)">nextPowerOfTwo</A></B>(int&nbsp;value)</CODE>
321
 
322
<BR>
323
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the next power of two.</TD>
324
</TR>
325
<TR BGCOLOR="white" CLASS="TableRowColor">
326
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
327
<CODE>static&nbsp;float</CODE></FONT></TD>
328
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random()">random</A></B>()</CODE>
329
 
330
<BR>
331
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
332
</TR>
333
<TR BGCOLOR="white" CLASS="TableRowColor">
334
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
335
<CODE>static&nbsp;float</CODE></FONT></TD>
336
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random(float)">random</A></B>(float&nbsp;range)</CODE>
337
 
338
<BR>
339
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random number between 0 (inclusive) and the specified value (inclusive).</TD>
340
</TR>
341
<TR BGCOLOR="white" CLASS="TableRowColor">
342
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
343
<CODE>static&nbsp;float</CODE></FONT></TD>
344
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random(float, float)">random</A></B>(float&nbsp;start,
345
       float&nbsp;end)</CODE>
346
 
347
<BR>
348
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random number between start (inclusive) and end (inclusive).</TD>
349
</TR>
350
<TR BGCOLOR="white" CLASS="TableRowColor">
351
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
352
<CODE>static&nbsp;int</CODE></FONT></TD>
353
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random(int)">random</A></B>(int&nbsp;range)</CODE>
354
 
355
<BR>
356
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random number between 0 (inclusive) and the specified value (inclusive).</TD>
357
</TR>
358
<TR BGCOLOR="white" CLASS="TableRowColor">
359
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
360
<CODE>static&nbsp;int</CODE></FONT></TD>
361
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#random(int, int)">random</A></B>(int&nbsp;start,
362
       int&nbsp;end)</CODE>
363
 
364
<BR>
365
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a random number between start (inclusive) and end (inclusive).</TD>
366
</TR>
367
<TR BGCOLOR="white" CLASS="TableRowColor">
368
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
369
<CODE>static&nbsp;boolean</CODE></FONT></TD>
370
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#randomBoolean()">randomBoolean</A></B>()</CODE>
371
 
372
<BR>
373
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
374
</TR>
375
<TR BGCOLOR="white" CLASS="TableRowColor">
376
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
377
<CODE>static&nbsp;int</CODE></FONT></TD>
378
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#round(float)">round</A></B>(float&nbsp;x)</CODE>
379
 
380
<BR>
381
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the closest integer to the specified float.</TD>
382
</TR>
383
<TR BGCOLOR="white" CLASS="TableRowColor">
384
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
385
<CODE>static&nbsp;int</CODE></FONT></TD>
386
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#roundPositive(float)">roundPositive</A></B>(float&nbsp;x)</CODE>
387
 
388
<BR>
389
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the closest integer to the specified float.</TD>
390
</TR>
391
<TR BGCOLOR="white" CLASS="TableRowColor">
392
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
393
<CODE>static&nbsp;float</CODE></FONT></TD>
394
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#sin(float)">sin</A></B>(float&nbsp;radians)</CODE>
395
 
396
<BR>
397
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the sine in radians.</TD>
398
</TR>
399
<TR BGCOLOR="white" CLASS="TableRowColor">
400
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
401
<CODE>static&nbsp;float</CODE></FONT></TD>
402
<TD><CODE><B><A HREF="../../../../com/badlogic/gdx/math/MathUtils.html#sinDeg(float)">sinDeg</A></B>(float&nbsp;degrees)</CODE>
403
 
404
<BR>
405
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the sine in radians.</TD>
406
</TR>
407
</TABLE>
408
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
409
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
410
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
411
<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
412
</TR>
413
<TR BGCOLOR="white" CLASS="TableRowColor">
414
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
415
</TR>
416
</TABLE>
417
&nbsp;
418
<P>
419
 
420
<!-- ============ FIELD DETAIL =========== -->
421
 
422
<A NAME="field_detail"><!-- --></A>
423
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
424
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
425
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
426
<B>Field Detail</B></FONT></TH>
427
</TR>
428
</TABLE>
429
 
430
<A NAME="nanoToSec"><!-- --></A><H3>
431
nanoToSec</H3>
432
<PRE>
433
public static final float <B>nanoToSec</B></PRE>
434
<DL>
435
<DL>
436
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.nanoToSec">Constant Field Values</A></DL>
437
</DL>
438
<HR>
439
 
440
<A NAME="PI"><!-- --></A><H3>
441
PI</H3>
442
<PRE>
443
public static final float <B>PI</B></PRE>
444
<DL>
445
<DL>
446
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.PI">Constant Field Values</A></DL>
447
</DL>
448
<HR>
449
 
450
<A NAME="radiansToDegrees"><!-- --></A><H3>
451
radiansToDegrees</H3>
452
<PRE>
453
public static final float <B>radiansToDegrees</B></PRE>
454
<DL>
455
<DL>
456
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.radiansToDegrees">Constant Field Values</A></DL>
457
</DL>
458
<HR>
459
 
460
<A NAME="radDeg"><!-- --></A><H3>
461
radDeg</H3>
462
<PRE>
463
public static final float <B>radDeg</B></PRE>
464
<DL>
465
<DL>
466
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.radDeg">Constant Field Values</A></DL>
467
</DL>
468
<HR>
469
 
470
<A NAME="degreesToRadians"><!-- --></A><H3>
471
degreesToRadians</H3>
472
<PRE>
473
public static final float <B>degreesToRadians</B></PRE>
474
<DL>
475
<DL>
476
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.degreesToRadians">Constant Field Values</A></DL>
477
</DL>
478
<HR>
479
 
480
<A NAME="degRad"><!-- --></A><H3>
481
degRad</H3>
482
<PRE>
483
public static final float <B>degRad</B></PRE>
484
<DL>
485
<DL>
486
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#com.badlogic.gdx.math.MathUtils.degRad">Constant Field Values</A></DL>
487
</DL>
488
<HR>
489
 
490
<A NAME="random"><!-- --></A><H3>
491
random</H3>
492
<PRE>
493
public static java.util.Random <B>random</B></PRE>
494
<DL>
495
<DL>
496
</DL>
497
</DL>
498
 
499
<!-- ========= CONSTRUCTOR DETAIL ======== -->
500
 
501
<A NAME="constructor_detail"><!-- --></A>
502
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
503
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
504
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
505
<B>Constructor Detail</B></FONT></TH>
506
</TR>
507
</TABLE>
508
 
509
<A NAME="MathUtils()"><!-- --></A><H3>
510
MathUtils</H3>
511
<PRE>
512
public <B>MathUtils</B>()</PRE>
513
<DL>
514
</DL>
515
 
516
<!-- ============ METHOD DETAIL ========== -->
517
 
518
<A NAME="method_detail"><!-- --></A>
519
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
520
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
521
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
522
<B>Method Detail</B></FONT></TH>
523
</TR>
524
</TABLE>
525
 
526
<A NAME="sin(float)"><!-- --></A><H3>
527
sin</H3>
528
<PRE>
529
public static final float <B>sin</B>(float&nbsp;radians)</PRE>
530
<DL>
531
<DD>Returns the sine in radians.
532
<P>
533
<DD><DL>
534
</DL>
535
</DD>
536
</DL>
537
<HR>
538
 
539
<A NAME="cos(float)"><!-- --></A><H3>
540
cos</H3>
541
<PRE>
542
public static final float <B>cos</B>(float&nbsp;radians)</PRE>
543
<DL>
544
<DD>Returns the cosine in radians.
545
<P>
546
<DD><DL>
547
</DL>
548
</DD>
549
</DL>
550
<HR>
551
 
552
<A NAME="sinDeg(float)"><!-- --></A><H3>
553
sinDeg</H3>
554
<PRE>
555
public static final float <B>sinDeg</B>(float&nbsp;degrees)</PRE>
556
<DL>
557
<DD>Returns the sine in radians.
558
<P>
559
<DD><DL>
560
</DL>
561
</DD>
562
</DL>
563
<HR>
564
 
565
<A NAME="cosDeg(float)"><!-- --></A><H3>
566
cosDeg</H3>
567
<PRE>
568
public static final float <B>cosDeg</B>(float&nbsp;degrees)</PRE>
569
<DL>
570
<DD>Returns the cosine in radians.
571
<P>
572
<DD><DL>
573
</DL>
574
</DD>
575
</DL>
576
<HR>
577
 
578
<A NAME="atan2(float, float)"><!-- --></A><H3>
579
atan2</H3>
580
<PRE>
581
public static final float <B>atan2</B>(float&nbsp;y,
582
                                float&nbsp;x)</PRE>
583
<DL>
584
<DD>Returns atan2 in radians from a lookup table.
585
<P>
586
<DD><DL>
587
</DL>
588
</DD>
589
</DL>
590
<HR>
591
 
592
<A NAME="random(int)"><!-- --></A><H3>
593
random</H3>
594
<PRE>
595
public static final int <B>random</B>(int&nbsp;range)</PRE>
596
<DL>
597
<DD>Returns a random number between 0 (inclusive) and the specified value (inclusive).
598
<P>
599
<DD><DL>
600
</DL>
601
</DD>
602
</DL>
603
<HR>
604
 
605
<A NAME="random(int, int)"><!-- --></A><H3>
606
random</H3>
607
<PRE>
608
public static final int <B>random</B>(int&nbsp;start,
609
                               int&nbsp;end)</PRE>
610
<DL>
611
<DD>Returns a random number between start (inclusive) and end (inclusive).
612
<P>
613
<DD><DL>
614
</DL>
615
</DD>
616
</DL>
617
<HR>
618
 
619
<A NAME="randomBoolean()"><!-- --></A><H3>
620
randomBoolean</H3>
621
<PRE>
622
public static final boolean <B>randomBoolean</B>()</PRE>
623
<DL>
624
<DD><DL>
625
</DL>
626
</DD>
627
</DL>
628
<HR>
629
 
630
<A NAME="random()"><!-- --></A><H3>
631
random</H3>
632
<PRE>
633
public static final float <B>random</B>()</PRE>
634
<DL>
635
<DD><DL>
636
</DL>
637
</DD>
638
</DL>
639
<HR>
640
 
641
<A NAME="random(float)"><!-- --></A><H3>
642
random</H3>
643
<PRE>
644
public static final float <B>random</B>(float&nbsp;range)</PRE>
645
<DL>
646
<DD>Returns a random number between 0 (inclusive) and the specified value (inclusive).
647
<P>
648
<DD><DL>
649
</DL>
650
</DD>
651
</DL>
652
<HR>
653
 
654
<A NAME="random(float, float)"><!-- --></A><H3>
655
random</H3>
656
<PRE>
657
public static final float <B>random</B>(float&nbsp;start,
658
                                 float&nbsp;end)</PRE>
659
<DL>
660
<DD>Returns a random number between start (inclusive) and end (inclusive).
661
<P>
662
<DD><DL>
663
</DL>
664
</DD>
665
</DL>
666
<HR>
667
 
668
<A NAME="nextPowerOfTwo(int)"><!-- --></A><H3>
669
nextPowerOfTwo</H3>
670
<PRE>
671
public static int <B>nextPowerOfTwo</B>(int&nbsp;value)</PRE>
672
<DL>
673
<DD>Returns the next power of two. Returns the specified value if the value is already a power of two.
674
<P>
675
<DD><DL>
676
</DL>
677
</DD>
678
</DL>
679
<HR>
680
 
681
<A NAME="isPowerOfTwo(int)"><!-- --></A><H3>
682
isPowerOfTwo</H3>
683
<PRE>
684
public static boolean <B>isPowerOfTwo</B>(int&nbsp;value)</PRE>
685
<DL>
686
<DD><DL>
687
</DL>
688
</DD>
689
</DL>
690
<HR>
691
 
692
<A NAME="clamp(int, int, int)"><!-- --></A><H3>
693
clamp</H3>
694
<PRE>
695
public static int <B>clamp</B>(int&nbsp;value,
696
                        int&nbsp;min,
697
                        int&nbsp;max)</PRE>
698
<DL>
699
<DD><DL>
700
</DL>
701
</DD>
702
</DL>
703
<HR>
704
 
705
<A NAME="clamp(short, short, short)"><!-- --></A><H3>
706
clamp</H3>
707
<PRE>
708
public static short <B>clamp</B>(short&nbsp;value,
709
                          short&nbsp;min,
710
                          short&nbsp;max)</PRE>
711
<DL>
712
<DD><DL>
713
</DL>
714
</DD>
715
</DL>
716
<HR>
717
 
718
<A NAME="clamp(float, float, float)"><!-- --></A><H3>
719
clamp</H3>
720
<PRE>
721
public static float <B>clamp</B>(float&nbsp;value,
722
                          float&nbsp;min,
723
                          float&nbsp;max)</PRE>
724
<DL>
725
<DD><DL>
726
</DL>
727
</DD>
728
</DL>
729
<HR>
730
 
731
<A NAME="floor(float)"><!-- --></A><H3>
732
floor</H3>
733
<PRE>
734
public static int <B>floor</B>(float&nbsp;x)</PRE>
735
<DL>
736
<DD>Returns the largest integer less than or equal to the specified float. This method will only properly floor floats from
737
 -(2^14) to (Float.MAX_VALUE - 2^14).
738
<P>
739
<DD><DL>
740
</DL>
741
</DD>
742
</DL>
743
<HR>
744
 
745
<A NAME="floorPositive(float)"><!-- --></A><H3>
746
floorPositive</H3>
747
<PRE>
748
public static int <B>floorPositive</B>(float&nbsp;x)</PRE>
749
<DL>
750
<DD>Returns the largest integer less than or equal to the specified float. This method will only properly floor floats that are
751
 positive. Note this method simply casts the float to int.
752
<P>
753
<DD><DL>
754
</DL>
755
</DD>
756
</DL>
757
<HR>
758
 
759
<A NAME="ceil(float)"><!-- --></A><H3>
760
ceil</H3>
761
<PRE>
762
public static int <B>ceil</B>(float&nbsp;x)</PRE>
763
<DL>
764
<DD>Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats from
765
 -(2^14) to (Float.MAX_VALUE - 2^14).
766
<P>
767
<DD><DL>
768
</DL>
769
</DD>
770
</DL>
771
<HR>
772
 
773
<A NAME="ceilPositive(float)"><!-- --></A><H3>
774
ceilPositive</H3>
775
<PRE>
776
public static int <B>ceilPositive</B>(float&nbsp;x)</PRE>
777
<DL>
778
<DD>Returns the smallest integer greater than or equal to the specified float. This method will only properly ceil floats that
779
 are positive.
780
<P>
781
<DD><DL>
782
</DL>
783
</DD>
784
</DL>
785
<HR>
786
 
787
<A NAME="round(float)"><!-- --></A><H3>
788
round</H3>
789
<PRE>
790
public static int <B>round</B>(float&nbsp;x)</PRE>
791
<DL>
792
<DD>Returns the closest integer to the specified float. This method will only properly round floats from -(2^14) to
793
 (Float.MAX_VALUE - 2^14).
794
<P>
795
<DD><DL>
796
</DL>
797
</DD>
798
</DL>
799
<HR>
800
 
801
<A NAME="roundPositive(float)"><!-- --></A><H3>
802
roundPositive</H3>
803
<PRE>
804
public static int <B>roundPositive</B>(float&nbsp;x)</PRE>
805
<DL>
806
<DD>Returns the closest integer to the specified float. This method will only properly round floats that are positive.
807
<P>
808
<DD><DL>
809
</DL>
810
</DD>
811
</DL>
812
<!-- ========= END OF CLASS DATA ========= -->
813
<HR>
814
 
815
 
816
<!-- ======= START OF BOTTOM NAVBAR ====== -->
817
<A NAME="navbar_bottom"><!-- --></A>
818
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
819
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
820
<TR>
821
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
822
<A NAME="navbar_bottom_firstrow"><!-- --></A>
823
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
824
  <TR ALIGN="center" VALIGN="top">
825
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
826
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
827
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
828
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/MathUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
829
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
830
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
831
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
832
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
833
  </TR>
834
</TABLE>
835
</TD>
836
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
837
libgdx API</EM>
838
</TD>
839
</TR>
840
 
841
<TR>
842
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
843
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Intersector.SplitTriangle.html" title="class in com.badlogic.gdx.math"><B>PREV CLASS</B></A>&nbsp;
844
&nbsp;<A HREF="../../../../com/badlogic/gdx/math/Matrix3.html" title="class in com.badlogic.gdx.math"><B>NEXT CLASS</B></A></FONT></TD>
845
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
846
  <A HREF="../../../../index.html?com/badlogic/gdx/math/MathUtils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
847
&nbsp;<A HREF="MathUtils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
848
&nbsp;<SCRIPT type="text/javascript">
849
  <!--
850
  if(window==top) {
851
    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
852
  }
853
  //-->
854
</SCRIPT>
855
<NOSCRIPT>
856
  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
857
</NOSCRIPT>
858
 
859
 
860
</FONT></TD>
861
</TR>
862
<TR>
863
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
864
  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
865
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
866
DETAIL:&nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
867
</TR>
868
</TABLE>
869
<A NAME="skip-navbar_bottom"></A>
870
<!-- ======== END OF BOTTOM NAVBAR ======= -->
871
 
872
<HR>
873
 
874
                                <div style="font-size:9pt"><i>
875
                                Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
876
                                </i></div>
877
 
878
</BODY>
879
</HTML>