-
Notifications
You must be signed in to change notification settings - Fork 7.1k
/
Rotate.js
30 lines (26 loc) · 878 Bytes
/
Rotate.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/**
* @author Richard Davey <rich@phaser.io>
* @copyright 2013-2024 Phaser Studio Inc.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
var RotateAroundXY = require('./RotateAroundXY');
var InCenter = require('./InCenter');
/**
* Rotates a Triangle about its incenter, which is the point at which its three angle bisectors meet.
*
* @function Phaser.Geom.Triangle.Rotate
* @since 3.0.0
*
* @generic {Phaser.Geom.Triangle} O - [triangle,$return]
*
* @param {Phaser.Geom.Triangle} triangle - The Triangle to rotate.
* @param {number} angle - The angle by which to rotate the Triangle, in radians.
*
* @return {Phaser.Geom.Triangle} The rotated Triangle.
*/
var Rotate = function (triangle, angle)
{
var point = InCenter(triangle);
return RotateAroundXY(triangle, point.x, point.y, angle);
};
module.exports = Rotate;