tapspace
Version:
A zoomable user interface lib for web apps
29 lines (24 loc) • 588 B
JavaScript
const fine = require('affineplane')
const box3 = fine.box3
module.exports = function (radians, origin) {
// @Box:rotateBy(radians, origin)
//
// Rotate the box around an origin point.
//
// Parameters:
// radians
// a number, the angle in rads
// origin
// a Point, the transform origin
//
// Return
// a Box, the rotated box
//
// Normalize
if (origin.transitRaw) {
origin = origin.transitRaw(this.basis)
}
const robox = box3.rotateBy(this.box, origin, radians)
const Box = this.constructor
return new Box(this.basis, robox)
}