--- title: Rotating ---

To rotate a single point, see makerjs.point.fromPolar and makerjs.point.rotate depending on what you are trying to achieve.

You can rotate paths and models with these functions:

Each of these functions return the original object, so that we can "chain" on the same line of code.

Rotate path example:

{% highlight javascript %} //render a rotated line var makerjs = require('makerjs'); var line1 = new makerjs.paths.Line([0, 0], [100, 0]); var line2 = new makerjs.paths.Line([0, 0], [100, 0]); var paths = [line1, makerjs.path.rotate(line2, -30, [100, 0])]; var svg = makerjs.exporter.toSVG(paths); document.write(svg); {% endhighlight %}

Rotate model example:

{% highlight javascript %} //render a rotated rectangle var makerjs = require('makerjs'); var rect1 = new makerjs.models.Rectangle(40, 80); makerjs.model.rotate(rect1, 45, [0, 0]); var svg = makerjs.exporter.toSVG(rect1); document.write(svg); {% endhighlight %}