Hello world!
So I have been using Houdini for a while, for work I am (for the first time) attempting to utilize wrangles and Vex. I'm now going on day three of trying to figure it out. I have a friend who knows Python and he helped me with the math and such, it's just now in the wrong language. I need help converting it into Vex.
Here is the python code
def func(N):
s = ''
for i in range(N):
angle = 360 * (i + 1) // N
s += ""
return s
for i in range(15):
print(func(i))
Converting Python to Vex
1842 2 0-
- Chelsea Newman
- Member
- 2 posts
- Joined: Oct. 2014
- Offline
-
- tamte
- Member
- 9380 posts
- Joined: July 2007
- Offline
your code doesn't produce anything as the function func() just accumulates nothing into s since
so angle is not even used
I assume that line was supposed to be something like this
then the equivalent VEX code would be something like this (run in detail mode):
s += ""so angle is not even used
I assume that line was supposed to be something like this
s += "%s " % anglethen the equivalent VEX code would be something like this (run in detail mode):
string func(int N){ string s = ""; for (int i=0; i<N; i++){ int angle = 360 * (i + 1) / N; s += itoa(angle) + " "; } return s; } for (int i=0; i<15; i++){ printf("%s\n", func(i)); }
Tomas Slancik
CG Supervisor
Framestore, NY
CG Supervisor
Framestore, NY
-
- Chelsea Newman
- Member
- 2 posts
- Joined: Oct. 2014
- Offline
-
- Quick Links

