davidyannick Posted January 22, 2020 Share Posted January 22, 2020 I need to model a teardrop, the parametric equation is : How can I implememt this in VEX ? thx for your help Quote Link to comment Share on other sites More sharing options...
DonRomano Posted January 22, 2020 Share Posted January 22, 2020 Well i guess it's something like : float a = chf("a"); float b = chf("b"); float t = chf("t"); float x = a * (1 - sin(t)) * cos(t); float y = b * (sin(t) - 1); But depending on what you feed into the equation you may need to change from float to vector or vector4. https://www.sidefx.com/docs/houdini/vex/functions/cos.html Cheers, Quote Link to comment Share on other sites More sharing options...
davidyannick Posted January 22, 2020 Author Share Posted January 22, 2020 5 minutes ago, DonRomano said: Well i guess it's something like : float a = chf("a"); float b = chf("b"); float t = chf("t"); float x = a * (1 - sin(t)) * cos(t); float y = b * (sin(t) - 1); But depending on what you feed into the equation you may need to change from float to vector or vector4. https://www.sidefx.com/docs/houdini/vex/functions/cos.html Cheers, thx I've found, I had forgotten the domain of definition vector pos=0; int pt[]={}; float q=chf("q"); int i=0; for(float t=-$PI;t<$PI;t+=$PI/100){ float aa=pow(q,2)*pow(sin(t),2); float ab=pow((1-q+q*cos(t)),2); float ac=aa+ab; float ad=q*sin(t)/ac; pos.x=q*sin(t)-ad; float da=q*cos(t)+((1-q+q*cos(t))/ac); pos.y=da; pt[i]=addpoint(0,pos); i++; } Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted January 22, 2020 Share Posted January 22, 2020 (edited) Hi, (just as personal preference) if you want to avoid for loops for creating parametric functions, just define the function in vex and apply it on an existing line (1d) or grid (2d). teardrop.hipnc Edited January 22, 2020 by Aizatulin 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.