<p>The algorithm is based on the "Vector rotation by transformation matrix", and this solution is based on a solution from Jens Geisler. The formula for clockwise rotation is:</p>

<p><a href="https://i.sstatic.net/hJGvP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/hJGvP.png" alt="Vector rotation"></a>  </p>

<p>More information about the vector rotation can be found <a href="https://en.wikipedia.org/wiki/Rotation_matrix" rel="nofollow noreferrer" title="Wikipedia">on Wikipedia</a>.</p>

CC BY-SA 3.0
2016-04-03T15:58:49.787Z
2016-05-27T03:52:47.447Z
2016-05-27T03:52:47.447Z
Maaajaaa
<p>I'm writing a paper about a plotter (I use a Prusa i3 with a custom "extruder" aka pen). And I'm supposed to write about the algorithms I/the plotter use(s). I tried reverse engineering, but since I'm not very experienced with this technique I wasn't successful. 
So I'm looking for <strong>the algorithm that <a href="http://reprap.org/wiki/Marlin" rel="nofollow">Marlin</a> uses for its G2/G3 commands</strong>.</p>

CC BY-SA 3.0
2016-04-02T09:21:18.300Z
Have you looked at [Marlin_main.cpp](https://github.com/MarlinFirmware/Marlin/blob/RC/Marlin/Marlin_main.cpp), specifically t,e ``plan_arc`` function?
Tom van der Zanden
<prusa-i3><reprap><g-code><algorithm>
Which algorithm does Marlin use to create arcs?
Maaajaaa
# Which algorithm does Marlin use to create arcs?

(Asked by: username_0 on 2016-04-01)

I'm writing a paper about a plotter (I use a Prusa i3 with a custom "extruder" aka pen). And I'm supposed to write about the algorithms I/the plotter use(s). I tried reverse engineering, but since I'm not very experienced with this technique I wasn't successful.
So I'm looking for **the algorithm that [Marlin](http://reprap.org/wiki/Marlin) uses for its G2/G3 commands**.

**Tags:** prusa-i3, reprap, g-code, algorithm

> **Comments:**
> **username_1**: Have you looked at [Marlin_main.cpp](https://github.com/MarlinFirmware/Marlin/blob/RC/Marlin/Marlin_main.cpp), specifically t,e ``plan_arc`` function?  

---

## 1 answers

### Answer by username_0 on 2016-04-03. Score: 4 | Accepted answer

The algorithm is based on the "Vector rotation by transformation matrix", and this solution is based on a solution from Jens Geisler. The formula for clockwise rotation is:

[![Vector rotation](https://i.sstatic.net/hJGvP.png)](https://i.sstatic.net/hJGvP.png)

More information about the vector rotation can be found [on Wikipedia](https://en.wikipedia.org/wiki/Rotation_matrix "Wikipedia").


---

