<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (version 1.7.0_17) on Sun Nov 03 15:35:42 CET 2013 -->
<title>Vector2 (libgdx API)
</title>
<meta name="date" content="2013-11-03">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Vector2 (libgdx API)";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.
</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview
</a></li>
<li><a href="package-summary.html">Package
</a></li>
<li class="navBarCell1Rev">Class
</li>
<li><a href="class-use/Vector2.html">Use
</a></li>
<li><a href="package-tree.html">Tree
</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated
</a></li>
<li><a href="../../../../index-all.html">Index
</a></li>
<li><a href="../../../../help-doc.html">Help
</a></li>
</ul>
<div class="aboutLanguage"><em>
libgdx API
<style>
body, td, th { font-family:Helvetica, Tahoma, Arial, sans-serif; font-size:10pt }
pre, code, tt { font-size:9pt; font-family:Lucida Console, Courier New, sans-serif }
h1, h2, h3, .FrameTitleFont, .FrameHeadingFont, .TableHeadingColor font { font-size:105%; font-weight:bold }
.TableHeadingColor { background:#EEEEFF; }
a { text-decoration:none }
a:hover { text-decoration:underline }
a:link, a:visited { color:blue }
table { border:0px }
.TableRowColor td:first-child { border-left:1px solid black }
.TableRowColor td { border:0px; border-bottom:1px solid black; border-right:1px solid black }
hr { border:0px; border-bottom:1px solid #333366; }
</style>
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math"><span class="strong">Prev Class
</span></a></li>
<li><a href="../../../../com/badlogic/gdx/math/Vector3.html" title="class in com.badlogic.gdx.math"><span class="strong">Next Class
</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/badlogic/gdx/math/Vector2.html" target="_top">Frames
</a></li>
<li><a href="Vector2.html" target="_top">No Frames
</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes
</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:
</li>
<li>Nested
|
</li>
<li><a href="#field_summary">Field
</a> |
</li>
<li><a href="#constructor_summary">Constr
</a> |
</li>
<li><a href="#method_summary">Method
</a></li>
</ul>
<ul class="subNavList">
<li>Detail:
</li>
<li><a href="#field_detail">Field
</a> |
</li>
<li><a href="#constructor_detail">Constr
</a> |
</li>
<li><a href="#method_detail">Method
</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.badlogic.gdx.math
</div>
<h2 title="Class Vector2" class="title">Class Vector2
</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object
</li>
<li>
<ul class="inheritance">
<li>com.badlogic.gdx.math.Vector2
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:
</dt>
<dd><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>>, java.io.Serializable
</dd>
</dl>
<hr>
<br>
<pre>public class
<span class="strong">Vector2
</span>
extends java.lang.Object
implements java.io.Serializable,
<a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></pre>
<div class="block">Encapsulates a 2D vector. Allows chaining methods by returning a reference to itself
</div>
<dl><dt><span class="strong">Author:
</span></dt>
<dd>badlogicgames@gmail.com
</dd>
<dt><span class="strong">See Also:
</span></dt><dd><a href="../../../../serialized-form.html#com.badlogic.gdx.math.Vector2">Serialized Form
</a></dd></dl>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_summary">
<!-- -->
</a>
<h3>Field Summary
</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields
</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type
</th>
<th class="colLast" scope="col">Field and Description
</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#x">x
</a></strong></code>
<div class="block">the x-component of this vector
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#X">X
</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#y">y
</a></strong></code>
<div class="block">the y-component of this vector
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#Y">Y
</a></strong></code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#Zero">Zero
</a></strong></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_summary">
<!-- -->
</a>
<h3>Constructor Summary
</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors
</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description
</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#Vector2()">Vector2
</a></strong>()
</code>
<div class="block">Constructs a new vector at (0,0)
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#Vector2(float, float)">Vector2
</a></strong>(float
x,
float
y)
</code>
<div class="block">Constructs a vector with the given components
</div>
</td>
</tr>
<tr class="altColor">
<td class="colOne"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#Vector2(com.badlogic.gdx.math.Vector2)">Vector2
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Constructs a vector from the given vector
</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary
</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods
</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type
</th>
<th class="colLast" scope="col">Method and Description
</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#add(float, float)">add
</a></strong>(float
x,
float
y)
</code>
<div class="block">Adds the given components to this vector
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#add(com.badlogic.gdx.math.Vector2)">add
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Adds the given vector to this vector
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#angle()">angle
</a></strong>()
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#clamp(float, float)">clamp
</a></strong>(float
min,
float
max)
</code>
<div class="block">Clamps this vector's length to given value
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#cpy()">cpy
</a></strong>()
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#crs(float, float)">crs
</a></strong>(float
x,
float
y)
</code>
<div class="block">Calculates the 2D cross product between this and the given vector.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#crs(com.badlogic.gdx.math.Vector2)">crs
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Calculates the 2D cross product between this and the given vector.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#div(float)">div
</a></strong>(float
value)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#div(float, float)">div
</a></strong>(float
vx,
float
vy)
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#div(com.badlogic.gdx.math.Vector2)">div
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> other)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#dot(com.badlogic.gdx.math.Vector2)">dot
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#dst(float, float)">dst
</a></strong>(float
x,
float
y)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#dst(com.badlogic.gdx.math.Vector2)">dst
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#dst2(float, float)">dst2
</a></strong>(float
x,
float
y)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#dst2(com.badlogic.gdx.math.Vector2)">dst2
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">This is much faster to calculate than
<a href="../../../../com/badlogic/gdx/math/Vector.html#dst(T)"><code>Vector.dst(Vector)
</code></a>
It avoids a calculating square root, so it is mostly useful for comparisons
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#epsilonEquals(float, float, float)">epsilonEquals
</a></strong>(float
x,
float
y,
float
epsilon)
</code>
<div class="block">Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>boolean
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#epsilonEquals(com.badlogic.gdx.math.Vector2, float)">epsilonEquals
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> obj,
float
epsilon)
</code>
<div class="block">Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#equals(java.lang.Object)">equals
</a></strong>(java.lang.Object
obj)
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#hashCode()">hashCode
</a></strong>()
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#len()">len
</a></strong>()
</code> </td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>float
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#len2()">len2
</a></strong>()
</code> </td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#lerp(com.badlogic.gdx.math.Vector2, float)">lerp
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> target,
float
alpha)
</code>
<div class="block">Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1].
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#limit(float)">limit
</a></strong>(float
limit)
</code>
<div class="block">Limits this vector's length to given value
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#mul(float)">mul
</a></strong>(float
scalar)
</code>
<div class="block"><strong>Deprecated.
</strong>
<div class="block"><i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float)"><code>scl(float)
</code></a> instead.
</i></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#mul(float, float)">mul
</a></strong>(float
x,
float
y)
</code>
<div class="block"><strong>Deprecated.
</strong>
<div class="block"><i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float, float)"><code>scl(float, float)
</code></a> instead.
</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#mul(com.badlogic.gdx.math.Matrix3)">mul
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Matrix3.html" title="class in com.badlogic.gdx.math">Matrix3
</a> mat)
</code>
<div class="block">Left-multiplies this vector by the given matrix
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#mul(com.badlogic.gdx.math.Vector2)">mul
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block"><strong>Deprecated.
</strong>
<div class="block"><i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(com.badlogic.gdx.math.Vector2)"><code>scl(Vector2)
</code></a> instead.
</i></div>
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#nor()">nor
</a></strong>()
</code>
<div class="block">Normalizes this vector.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#rotate(float)">rotate
</a></strong>(float
degrees)
</code>
<div class="block">Rotates the Vector2 by the given angle, counter-clockwise assuming the y-axis points up.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float)">scl
</a></strong>(float
scalar)
</code>
<div class="block">Multiplies this vector by a scalar
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float, float)">scl
</a></strong>(float
x,
float
y)
</code>
<div class="block">Multiplies this vector by a scalar
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(com.badlogic.gdx.math.Vector2)">scl
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Multiplies this vector by a vector
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#set(float, float)">set
</a></strong>(float
x,
float
y)
</code>
<div class="block">Sets the components of this vector
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#set(com.badlogic.gdx.math.Vector2)">set
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Sets this vector from the given vector
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#setAngle(float)">setAngle
</a></strong>(float
degrees)
</code>
<div class="block">Sets the angle of the vector in degrees relative to the x-axis, towards the positive y-axis (typically counter-clockwise).
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#sub(float, float)">sub
</a></strong>(float
x,
float
y)
</code>
<div class="block">Substracts the other vector from this vector.
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a></code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#sub(com.badlogic.gdx.math.Vector2)">sub
</a></strong>(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</code>
<div class="block">Subtracts the given vector from this vector.
</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String
</code></td>
<td class="colLast"><code><strong><a href="../../../../com/badlogic/gdx/math/Vector2.html#toString()">toString
</a></strong>()
</code> </td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class
java.lang.Object
</h3>
<code>clone, finalize, getClass, notify, notifyAll, wait, wait, wait
</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field_detail">
<!-- -->
</a>
<h3>Field Detail
</h3>
<a name="X">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>X
</h4>
<pre>public static final
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> X
</pre>
</li>
</ul>
<a name="Y">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Y
</h4>
<pre>public static final
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> Y
</pre>
</li>
</ul>
<a name="Zero">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Zero
</h4>
<pre>public static final
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> Zero
</pre>
</li>
</ul>
<a name="x">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>x
</h4>
<pre>public
float x
</pre>
<div class="block">the x-component of this vector
</div>
</li>
</ul>
<a name="y">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>y
</h4>
<pre>public
float y
</pre>
<div class="block">the y-component of this vector
</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor_detail">
<!-- -->
</a>
<h3>Constructor Detail
</h3>
<a name="Vector2()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Vector2
</h4>
<pre>public
Vector2()
</pre>
<div class="block">Constructs a new vector at (0,0)
</div>
</li>
</ul>
<a name="Vector2(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>Vector2
</h4>
<pre>public
Vector2(float
x,
float
y)
</pre>
<div class="block">Constructs a vector with the given components
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component
</dd><dd><code>y
</code> - The y-component
</dd></dl>
</li>
</ul>
<a name="Vector2(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>Vector2
</h4>
<pre>public
Vector2(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Constructs a vector from the given vector
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The vector
</dd></dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail
</h3>
<a name="cpy()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>cpy
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> cpy()
</pre>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#cpy()">cpy
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Returns:
</span></dt><dd>a copy of this vector
</dd></dl>
</li>
</ul>
<a name="len()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>len
</h4>
<pre>public
float
len()
</pre>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#len()">len
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Returns:
</span></dt><dd>The euclidian length
</dd></dl>
</li>
</ul>
<a name="len2()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>len2
</h4>
<pre>public
float
len2()
</pre>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#len2()">len2
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Returns:
</span></dt><dd>The squared euclidian length
</dd></dl>
</li>
</ul>
<a name="set(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> set(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Sets this vector from the given vector
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#set(T)">set
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="set(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>set
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> set(float
x,
float
y)
</pre>
<div class="block">Sets the components of this vector
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component
</dd><dd><code>y
</code> - The y-component
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="sub(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sub
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> sub(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Subtracts the given vector from this vector.
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#sub(T)">sub
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="nor()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>nor
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> nor()
</pre>
<div class="block">Normalizes this vector. Does nothing if it is zero.
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#nor()">nor
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="add(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> add(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Adds the given vector to this vector
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#add(T)">add
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="add(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>add
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> add(float
x,
float
y)
</pre>
<div class="block">Adds the given components to this vector
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component
</dd><dd><code>y
</code> - The y-component
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="dot(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dot
</h4>
<pre>public
float
dot(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#dot(T)">dot
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>The dot product between this and the other vector
</dd></dl>
</li>
</ul>
<a name="scl(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>scl
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> scl(float
scalar)
</pre>
<div class="block">Multiplies this vector by a scalar
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#scl(float)">scl
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>scalar
</code> - The scalar
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="mul(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mul
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> mul(float
scalar)
</pre>
<div class="block"><span class="strong">Deprecated.
</span> <i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float)"><code>scl(float)
</code></a> instead.
</i></div>
</li>
</ul>
<a name="scl(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>scl
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> scl(float
x,
float
y)
</pre>
<div class="block">Multiplies this vector by a scalar
</div>
<dl><dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="mul(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mul
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> mul(float
x,
float
y)
</pre>
<div class="block"><span class="strong">Deprecated.
</span> <i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(float, float)"><code>scl(float, float)
</code></a> instead.
</i></div>
</li>
</ul>
<a name="scl(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>scl
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> scl(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Multiplies this vector by a vector
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#scl(T)">scl
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="mul(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mul
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> mul(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block"><span class="strong">Deprecated.
</span> <i>Use
<a href="../../../../com/badlogic/gdx/math/Vector2.html#scl(com.badlogic.gdx.math.Vector2)"><code>scl(Vector2)
</code></a> instead.
</i></div>
</li>
</ul>
<a name="div(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>div
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> div(float
value)
</pre>
</li>
</ul>
<a name="div(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>div
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> div(float
vx,
float
vy)
</pre>
</li>
</ul>
<a name="div(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>div
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> div(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> other)
</pre>
</li>
</ul>
<a name="dst(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dst
</h4>
<pre>public
float
dst(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#dst(T)">dst
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the distance between this and the other vector
</dd></dl>
</li>
</ul>
<a name="dst(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dst
</h4>
<pre>public
float
dst(float
x,
float
y)
</pre>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component of the other vector
</dd><dd><code>y
</code> - The y-component of the other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the distance between this and the other vector
</dd></dl>
</li>
</ul>
<a name="dst2(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dst2
</h4>
<pre>public
float
dst2(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block"><strong>Description copied from interface:
<code><a href="../../../../com/badlogic/gdx/math/Vector.html#dst2(T)">Vector
</a></code></strong></div>
<div class="block">This is much faster to calculate than
<a href="../../../../com/badlogic/gdx/math/Vector.html#dst(T)"><code>Vector.dst(Vector)
</code></a>
It avoids a calculating square root, so it is mostly useful for comparisons
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#dst2(T)">dst2
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - The other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the squared distance between this and the other vector
</dd></dl>
</li>
</ul>
<a name="dst2(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>dst2
</h4>
<pre>public
float
dst2(float
x,
float
y)
</pre>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component of the other vector
</dd><dd><code>y
</code> - The y-component of the other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the squared distance between this and the other vector
</dd></dl>
</li>
</ul>
<a name="limit(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>limit
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> limit(float
limit)
</pre>
<div class="block">Limits this vector's length to given value
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#limit(float)">limit
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>limit
</code> - Max length
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="clamp(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>clamp
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> clamp(float
min,
float
max)
</pre>
<div class="block">Clamps this vector's length to given value
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#clamp(float, float)">clamp
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>min
</code> - Min length
</dd><dd><code>max
</code> - Max length
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="toString()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>toString
</h4>
<pre>public
java.lang.String
toString()
</pre>
<dl>
<dt><strong>Overrides:
</strong></dt>
<dd><code>toString
</code> in class
<code>java.lang.Object
</code></dd>
</dl>
</li>
</ul>
<a name="sub(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>sub
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> sub(float
x,
float
y)
</pre>
<div class="block">Substracts the other vector from this vector.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - The x-component of the other vector
</dd><dd><code>y
</code> - The y-component of the other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining
</dd></dl>
</li>
</ul>
<a name="mul(com.badlogic.gdx.math.Matrix3)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>mul
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> mul(
<a href="../../../../com/badlogic/gdx/math/Matrix3.html" title="class in com.badlogic.gdx.math">Matrix3
</a> mat)
</pre>
<div class="block">Left-multiplies this vector by the given matrix
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>mat
</code> - the matrix
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>this vector
</dd></dl>
</li>
</ul>
<a name="crs(com.badlogic.gdx.math.Vector2)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>crs
</h4>
<pre>public
float
crs(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> v)
</pre>
<div class="block">Calculates the 2D cross product between this and the given vector.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>v
</code> - the other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the cross product
</dd></dl>
</li>
</ul>
<a name="crs(float, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>crs
</h4>
<pre>public
float
crs(float
x,
float
y)
</pre>
<div class="block">Calculates the 2D cross product between this and the given vector.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> - the x-coordinate of the other vector
</dd><dd><code>y
</code> - the y-coordinate of the other vector
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>the cross product
</dd></dl>
</li>
</ul>
<a name="angle()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>angle
</h4>
<pre>public
float
angle()
</pre>
<dl><dt><span class="strong">Returns:
</span></dt><dd>the angle in degrees of this vector (point) relative to the x-axis.
Angles are towards the positive y-axis (typically counter-clockwise) and between 0 and 360.
</dd></dl>
</li>
</ul>
<a name="setAngle(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAngle
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> setAngle(float
degrees)
</pre>
<div class="block">Sets the angle of the vector in degrees relative to the x-axis, towards the positive y-axis (typically counter-clockwise).
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>degrees
</code> - The angle to set.
</dd></dl>
</li>
</ul>
<a name="rotate(float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>rotate
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> rotate(float
degrees)
</pre>
<div class="block">Rotates the Vector2 by the given angle, counter-clockwise assuming the y-axis points up.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>degrees
</code> - the angle in degrees
</dd></dl>
</li>
</ul>
<a name="lerp(com.badlogic.gdx.math.Vector2, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>lerp
</h4>
<pre>public
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> lerp(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> target,
float
alpha)
</pre>
<div class="block">Linearly interpolates between this vector and the target vector by alpha which is in the range [0,1]. The result is stored
in this vector.
</div>
<dl>
<dt><strong>Specified by:
</strong></dt>
<dd><code><a href="../../../../com/badlogic/gdx/math/Vector.html#lerp(T, float)">lerp
</a></code> in interface
<code><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math">Vector
</a><<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a>></code></dd>
<dt><span class="strong">Parameters:
</span></dt><dd><code>target
</code> - The target vector
</dd><dd><code>alpha
</code> - The interpolation coefficient
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>This vector for chaining.
</dd></dl>
</li>
</ul>
<a name="hashCode()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>hashCode
</h4>
<pre>public
int
hashCode()
</pre>
<dl>
<dt><strong>Overrides:
</strong></dt>
<dd><code>hashCode
</code> in class
<code>java.lang.Object
</code></dd>
</dl>
</li>
</ul>
<a name="equals(java.lang.Object)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>equals
</h4>
<pre>public
boolean
equals(java.lang.Object
obj)
</pre>
<dl>
<dt><strong>Overrides:
</strong></dt>
<dd><code>equals
</code> in class
<code>java.lang.Object
</code></dd>
</dl>
</li>
</ul>
<a name="epsilonEquals(com.badlogic.gdx.math.Vector2, float)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>epsilonEquals
</h4>
<pre>public
boolean
epsilonEquals(
<a href="../../../../com/badlogic/gdx/math/Vector2.html" title="class in com.badlogic.gdx.math">Vector2
</a> obj,
float
epsilon)
</pre>
<div class="block">Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>obj
</code> -
</dd><dd><code>epsilon
</code> -
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>whether the vectors are the same.
</dd></dl>
</li>
</ul>
<a name="epsilonEquals(float, float, float)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>epsilonEquals
</h4>
<pre>public
boolean
epsilonEquals(float
x,
float
y,
float
epsilon)
</pre>
<div class="block">Compares this vector with the other vector, using the supplied epsilon for fuzzy equality testing.
</div>
<dl><dt><span class="strong">Parameters:
</span></dt><dd><code>x
</code> -
</dd><dd><code>y
</code> -
</dd><dd><code>epsilon
</code> -
</dd>
<dt><span class="strong">Returns:
</span></dt><dd>whether the vectors are the same.
</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview
</a></li>
<li><a href="package-summary.html">Package
</a></li>
<li class="navBarCell1Rev">Class
</li>
<li><a href="class-use/Vector2.html">Use
</a></li>
<li><a href="package-tree.html">Tree
</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated
</a></li>
<li><a href="../../../../index-all.html">Index
</a></li>
<li><a href="../../../../help-doc.html">Help
</a></li>
</ul>
<div class="aboutLanguage"><em>libgdx API
</em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/badlogic/gdx/math/Vector.html" title="interface in com.badlogic.gdx.math"><span class="strong">Prev Class
</span></a></li>
<li><a href="../../../../com/badlogic/gdx/math/Vector3.html" title="class in com.badlogic.gdx.math"><span class="strong">Next Class
</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/badlogic/gdx/math/Vector2.html" target="_top">Frames
</a></li>
<li><a href="Vector2.html" target="_top">No Frames
</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes
</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary:
</li>
<li>Nested
|
</li>
<li><a href="#field_summary">Field
</a> |
</li>
<li><a href="#constructor_summary">Constr
</a> |
</li>
<li><a href="#method_summary">Method
</a></li>
</ul>
<ul class="subNavList">
<li>Detail:
</li>
<li><a href="#field_detail">Field
</a> |
</li>
<li><a href="#constructor_detail">Constr
</a> |
</li>
<li><a href="#method_detail">Method
</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>
<div style="font-size:9pt"><i>
Copyright
© 2010-2013 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)
</i></div>
</small></p>
</body>
</html>