# Drawing Sine Curve?

Hello.
I am looking how to draw a surface defined by a function.

The closest I have managed are multiple “steps”, each step being defined by (i.e.) Z=sin(X).
Ideally I would like a scalable group, that could then return key values.

Is this possible with DC, or solely the realm of Ruby?

1 Like

Try a plugin to get the graph (which then can be scaled).
example:http: Smustard(TM) - the Companion to Sketchup(TM) - GraphIt

I was thinking of another one but haven’t found it yet.

p.s. the created graph represents the graph in segmented form in SketchUp and is plain geometry, edges forming a segmented curve. So be careful with a scaled version as to what math equation that will represent! Or just input a second math equation in the plugin.

1 Like

There have been similar requests before. Search the forum for ‘sine curve’ and you will find four other posts on this or a related subject. They may be helpful.

PolyGen?

Thanks - I did search beforehand.
It seems that all the solutions have been ruby based - nothing DC.

the copy in the copies function works for maths formula and graphs

sine wave.skp (164.3 KB)

2 Likes

Thank you

Interesting. Is it supposed to look like this?

it is just an example on how to use copy as a variable to form a shape or a set of points, y=sin(copy) is like y=sin(x), its a starting point where further development like rotating and sizing the copy length can join the “dots”, like the arc tool the number of segments will get closer to the perfect, So with the sample, the range, pitch, frequency are things one can explore in ones development of the function.

3 Likes

Thanks pcmoor, that is very interesting. That is along the lines of what I am trying to do.
I’ll play around with this.

Is there any way to join the segments to make a surface (segment starts at x=n, ends at x=n+1)?

Thanks again.

Try the Draw Metal LLC Taper maker, Curve maker and Stock maker plugins for Sketchup. Be aware the length of a sine curve cannot calculated by use of your equation. For that you will have to use a ellipitic integeral since there is no closed form solution for that if you want accurate number.

one could produce the segmented path along the sine curve, then attach a DC form for the follow me tool. I created a ligature based on this concept

http://sketchucation.com/forums/viewtopic.php?f=289&t=63649

in forming the path, as per a previous post…

then you add sides and base to form a surface then extrude that

Not sure if this is the same .rb as posted above.
It was created via a request I made in SketchUcation years ago.
I used it to create the path of a huge floating sewer line. Worked great.

Sine_wave.rb:

require “sketchup”

module JF
def self.draw_sine_wave
pr = %w( Length Amplitude Segments )
de = [10, 5, 24]

``````    ret = UI.inputbox(pr, de)
return unless ret
#a = 10.0.feet
#b = 250.0.feet
b, a, s = ret.map{|e| e.to_l}
pts = []
0.step(b, b/s) do |x|
y = a * Math::sin( (x / b) * 2 * Math::PI)
pts << [x, y]
end
Sketchup.active_model.start_operation("Sine Wave")
entities = grp.entities
Sketchup.active_model.commit_operation

end
``````

end