[Plugin] Function Plotter

[Plugin] Function Plotter

Postby remus » Tue Oct 13, 2009 4:13 pm

Code: Select all
def f(x,y)

(Math.sin(x*y))

end

n= -30
m= 30

pts = []

for x in n..m

  for y in n..m

    x2 = x.to_f/10

    y2 = y.to_f/10

    z = f(x2,y2)

    pts.push([x2,y2,z])

  end
Sketchup.active_model.entities.add_curve(pts)

pts.clear

end

#Sketchup.active_model.entities.add_curve(pts)

#pts.each {|x| Sketchup.active_model.entities.add_cpoint(x)}


quite optimistic to call it a plugin, but its good fun.

Just plug a function of x and y in to the top def, put your range in to n and m and run the whole lot through jims webconsole.

Makes lots of pretty patterns :)
0
Last edited by thomthom on Tue Dec 08, 2009 9:40 pm, edited 1 time in total.
Reason: Just cleaning up and organizing the Plugin forum. Correcting [Plugin] tag

remus 
 

Re: [plugin] Function Plotter

Postby TIG » Tue Oct 13, 2009 4:36 pm

Now just 'mesh' it :D

Very good...

See also 'K_tools.rb' for similar ideas...
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: almog44, JUNGHEE, oheimala, sketchy22 and 14 guests

Visit our sponsors: