<commit_before>SAT.js
======

 - [Classes](#classes)
 - [Collision Tests](#tests)
 - [Examples](#examples)

About
-----

SAT.js is a simple JavaScript library for performing collision detection (and projection-based collision response) of simple 2D shapes.  It uses the [Separating Axis Theorem](http://en.wikipedia.org/wiki/Hyperplane_separation_theorem) (hence the name)

It supports detecting collisions between:
 - Circles (using Vornoi Regions.)
 - Convex Polygons (and simple Axis-Aligned Boxes, which are of course, convex polygons.)

It also supports checking whether a point is inside a circle or polygon.

It's released under the [MIT](http://en.wikipedia.org/wiki/MIT_License) license.

Current version: `0.5.0`. [Annotated source code](http://jriecken.github.io/sat-js/docs/SAT.html) is available.

Nicely compresses with the [Google Closure Compiler](https://developers.google.com/closure/compiler/) in **Advanced** mode to about 6KB (2KB gzipped)

To use it in node.js, you can run `npm install sat` and then use it with `var SAT = require('sat');`

<a name="classes"></a>
Classes
--------

SAT.js contains the following JavaScript classes:

### SAT.Vector (aliased as SAT.V)

This is a simple 2D vector/point class.  It is created by calling:
```javascript
// Create the vector (10,10) - If (x,y) not specified, defaults to (0,0).
var v = new SAT.Vector(10, 10)
```

It has the following properties:

 - `x` - The x-coordinate of the Vector.
 - `y` - The y-coordinate of the Vector.

It contains the following methods:

 - `copy(other)` - Copy the value of another Vector to this one.
 - `clone()` - Return a new vector with the same coordinates as this one.
 - `perp()` - Change this vector to be perpendicular to what it was before.
 - `rotate(angle)` - Rotate this vector counter-clockwise by the specified number of radians.
 - `reverse()` - Reverse this Vector.
 - `normalize()` - Make the Vector unit-lengthed.
 - `add(other)` - Add another Vector to this one.
 - `sub(other)` - Subtract another Vector from this one.
 - `scale(x,y)` - Scale this Vector in the X and Y directions.
 - `project(other)` - Project this Vector onto another one.
 - `projectN(other)` - Project this Vector onto a unit Vector.
 - `reflect(axis)` - Reflect this Vector on an arbitrary axis Vector.
 - `reflectN(axis)` - Reflect this Vector on an arbitrary axis unit Vector.
 - `dot(other)` - Get the dot product of this Vector and another.
 - `len2()` - Get the length squared of this Vector.
 - `len()` - Get the length of this Vector

### SAT.Circle

This is a simple circle with a center position and a radius.  It is created by calling:
```javascript
// Create a circle whose center is (10,10) with radius of 20
var c = new SAT.Circle(new Sat.Vector(10,10), 20);
```

It has the following properties:

 - `pos` - A Vector representing the center of the circle.
 - `r` - The radius of the circle


### SAT.Polygon

This is a **convex** polygon, whose points are specified in a counter-clockwise fashion.  It is created by calling:
```javascript
// Create a triangle at (0,0)
var p = new SAT.Polygon(new SAT.Vector(), [
  new SAT.Vector(),
  new SAT.Vector(100,0),
  new SAT.Vector(50,75)
]);
```

Note: The points are counter-clockwise *with respect to the coordinate system*. If you directly draw the points on a screen that has the origin at the top-left corner it will _appear_ visually that the points are being specified clockwise. This is just because of the inversion of the Y-axis when being displayed.

You can create a line segment by creating a `Polygon` that contains only 2 ppoints.

It has the following properties:

 - `pos` - The position of the polygon (all points are relative to this).<commit_msg>Fix typo in SAT.Circle docs. Fixes #25<commit_after>SAT.js
======

 - [Classes](#classes)
 - [Collision Tests](#tests)
 - [Examples](#examples)

About
-----

SAT.js is a simple JavaScript library for performing collision detection (and projection-based collision response) of simple 2D shapes.  It uses the [Separating Axis Theorem](http://en.wikipedia.org/wiki/Hyperplane_separation_theorem) (hence the name)

It supports detecting collisions between:
 - Circles (using Vornoi Regions.)
 - Convex Polygons (and simple Axis-Aligned Boxes, which are of course, convex polygons.)

It also supports checking whether a point is inside a circle or polygon.

It's released under the [MIT](http://en.wikipedia.org/wiki/MIT_License) license.

Current version: `0.5.0`. [Annotated source code](http://jriecken.github.io/sat-js/docs/SAT.html) is available.

Nicely compresses with the [Google Closure Compiler](https://developers.google.com/closure/compiler/) in **Advanced** mode to about 6KB (2KB gzipped)

To use it in node.js, you can run `npm install sat` and then use it with `var SAT = require('sat');`

<a name="classes"></a>
Classes
--------

SAT.js contains the following JavaScript classes:

### SAT.Vector (aliased as SAT.V)

This is a simple 2D vector/point class.  It is created by calling:
```javascript
// Create the vector (10,10) - If (x,y) not specified, defaults to (0,0).
var v = new SAT.Vector(10, 10)
```

It has the following properties:

 - `x` - The x-coordinate of the Vector.
 - `y` - The y-coordinate of the Vector.

It contains the following methods:

 - `copy(other)` - Copy the value of another Vector to this one.
 - `clone()` - Return a new vector with the same coordinates as this one.
 - `perp()` - Change this vector to be perpendicular to what it was before.
 - `rotate(angle)` - Rotate this vector counter-clockwise by the specified number of radians.
 - `reverse()` - Reverse this Vector.
 - `normalize()` - Make the Vector unit-lengthed.
 - `add(other)` - Add another Vector to this one.
 - `sub(other)` - Subtract another Vector from this one.
 - `scale(x,y)` - Scale this Vector in the X and Y directions.
 - `project(other)` - Project this Vector onto another one.
 - `projectN(other)` - Project this Vector onto a unit Vector.
 - `reflect(axis)` - Reflect this Vector on an arbitrary axis Vector.
 - `reflectN(axis)` - Reflect this Vector on an arbitrary axis unit Vector.
 - `dot(other)` - Get the dot product of this Vector and another.
 - `len2()` - Get the length squared of this Vector.
 - `len()` - Get the length of this Vector

### SAT.Circle

This is a simple circle with a center position and a radius.  It is created by calling:
```javascript
// Create a circle whose center is (10,10) with radius of 20
var c = new SAT.Circle(new SAT.Vector(10,10), 20);
```

It has the following properties:

 - `pos` - A Vector representing the center of the circle.
 - `r` - The radius of the circle


### SAT.Polygon

This is a **convex** polygon, whose points are specified in a counter-clockwise fashion.  It is created by calling:
```javascript
// Create a triangle at (0,0)
var p = new SAT.Polygon(new SAT.Vector(), [
  new SAT.Vector(),
  new SAT.Vector(100,0),
  new SAT.Vector(50,75)
]);
```

Note: The points are counter-clockwise *with respect to the coordinate system*. If you directly draw the points on a screen that has the origin at the top-left corner it will _appear_ visually that the points are being specified clockwise. This is just because of the inversion of the Y-axis when being displayed.

You can create a line segment by creating a `Polygon` that contains only 2 ppoints.

It has the following properties:

 - `pos` - The position of the polygon (all points are relative to this).
{'fraction_non_alphanumeric': 0.11117071208260694, 'fraction_numerical': 0.011264583612712887, 'mean_word_length': 3.7533460803059273, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1474589', 'n_tokens_mistral': 2322, 'n_tokens_neox': 2149, 'n_words': 989}