<p>I<a href="https://i.sstatic.net/E0px9.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E0px9.jpg" alt="enter image description here"></a> want to do a non-linear transformation of a svg in python. My specific problem is to transform a rectangular svg image into a frustum like image, for which i have a mathematical equation of the form (x',y') = f(x,y).</p>

<p>So far, I've been able to find a javascript library called warp.js (<a href="https://github.com/benjamminf/warpjs" rel="nofollow noreferrer">https://github.com/benjamminf/warpjs</a>), which supports application of generic point-wise transformation on svg. But I'm unable to find any such tools for python or C++ except for basic transformation like skew, rotation etc.</p>

<p>Any help would be greatly appreciated. Thanks!</p>

CC BY-SA 4.0
2020-01-26T17:35:46.063Z
What you have above is a polar coordinate mapping, you can code it yourself.
lightxbulb
CC BY-SA 4.0
2020-01-27T05:49:19.167Z
@lightxbulb not entirely trivial though.
joojaa
CC BY-SA 4.0
2020-01-27T15:32:25.370Z
Yeah, I can code it but I can't find any libraries to provide basic tools to code with. I looked into pycairo but it only supports affine transformations. Looked into lib2geom, couldn't understand it's different representations of vector components. The documentation did not seem descriptive enough.
user11799
<c++><vector-graphics>
Non linear transformation of vector graphic
user11799
# Non linear transformation of vector graphic

(Asked by: username_0 on 2020-01-26)

I[![enter image description here](https://i.sstatic.net/E0px9.jpg)](https://i.sstatic.net/E0px9.jpg) want to do a non-linear transformation of a svg in python. My specific problem is to transform a rectangular svg image into a frustum like image, for which i have a mathematical equation of the form (x',y') = f(x,y).

So far, I've been able to find a javascript library called warp.js (<https://github.com/benjamminf/warpjs>), which supports application of generic point-wise transformation on svg. But I'm unable to find any such tools for python or C++ except for basic transformation like skew, rotation etc.

Any help would be greatly appreciated. Thanks!

**Tags:** c++, vector-graphics

> **Comments:**
> **username_1**: What you have above is a polar coordinate mapping, you can code it yourself.  
> **username_2**: @username_1 not entirely trivial though.  
> **username_0**: Yeah, I can code it but I can't find any libraries to provide basic tools to code with. I looked into pycairo but it only supports affine transformations. Looked into lib2geom, couldn't understand it's different representations of vector components. The documentation did not seem descriptive enough.  

---

## 0 answers

