Friday, October 15, 2010

Smoothstep function

We have smooth step function in almost all application here is an example how to write a smoothstep function manualy

smoothstep = x*x – sin(x)

here is a graphical representation for smoothstep graph and python code




Friday, October 8, 2010

How to find Random points inside a given triangle

According to Bary Centric Coordinates it says if a triangle with points A, B, C is on a 2D or 3D dimension then a point inside triangle

N(point inside triangle) = ((t1*A)+(t2*B)+(t3*C))

where t1, t2, t3 is any radom value between 0 and 1 but also a condition exist ie

t1+t2+t3 =1

here is a sample code with a graphical representation code



this can be even used inside other softwares like maya, houdini also like imagine you have to genereate curves between 3 selected points etc...

** Note: To run the sample python code matplotlib graphics library is required.