MCPcopy Create free account
hub / github.com/microsoft/SandDance / scaleTranslateRotate

Function scaleTranslateRotate

docs/tests/v2/es6/js/sanddance.js:116508–116527  ·  view source on GitHub ↗
(k, dx, dy, alpha)

Source from the content-addressed store, hash-verified

116506}
116507
116508function scaleTranslateRotate(k, dx, dy, alpha) {
116509 var cosAlpha = (0, _math.cos)(alpha),
116510 sinAlpha = (0, _math.sin)(alpha),
116511 a = cosAlpha * k,
116512 b = sinAlpha * k,
116513 ai = cosAlpha / k,
116514 bi = sinAlpha / k,
116515 ci = (sinAlpha * dy - cosAlpha * dx) / k,
116516 fi = (sinAlpha * dx + cosAlpha * dy) / k;
116517
116518 function transform(x, y) {
116519 return [a * x - b * y + dx, dy - b * x - a * y];
116520 }
116521
116522 transform.invert = function (x, y) {
116523 return [ai * x - bi * y + ci, fi - bi * x - ai * y];
116524 };
116525
116526 return transform;
116527}
116528
116529function projection(project) {
116530 return projectionMutator(function () {

Callers 1

recenterFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected