How to draw a figure such as cycloid using the function

About advanced scenes, and the Thyme scripting language used in Algodoo.

How to draw a figure such as cycloid using the function

Postby mc2lv » Thu Jan 29, 2015 1:22 pm

Hello.Can I draw a figure by function using script ? If it's possible ,I wish to draw cycloid. Would you help me. Thank you.
mc2lv
 
Posts: 1
Joined: Mon Jan 26, 2015 4:19 am

Re: How to draw a figure such as cycloid using the function

Postby Kilinich » Thu Jan 29, 2015 2:36 pm

Sure, use scene.addPolygon for that.

Also, there is a thyme basics book:
http://ru.scribd.com/doc/49755166/Thyme-Tutorial-The-basic-and-advanced-techniques
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: How to draw a figure such as cycloid using the function

Postby Kilinich » Thu Jan 29, 2015 3:04 pm

Example (put code in console, press enter):

Code: Select all
{s:=[]; for(41, (i)=>{t := 2* math.pi/40 * i; s = s ++ [[t-math.sin(t),1-math.cos(t)]]}); scene.addPolygon{pos := [0,0]; surfaces := [s]}}()
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests