I'm trying to draw a figure8 shape from code (like in this picture below). Any ideas? I couldn't afford to pay attention in geometry and now I need it.
It's the formula part that I"m lost on. I'm not sure how to create the plot points with the given equation.
- this is the equation for Lemniscate of Bernoulli curve -
Cartesian equation:
(x^2 + y^2)^2 = a^2(x^2 - y^2)
Polar equation:
r^2 = a^2 cos (2θ)
[img]
http://www-history.mcs.st-and.ac.uk/Cur ... scate1.gif
[/img]
Math Help - Teardrop Shaped Figure 8
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Math Help - Teardrop Shaped Figure 8
This is a way of drawing a Lissajous Curve. I modified some code that I used to draw a spiral.
First draw a freehand graphic called "curve" (the default name!)
Put the following code into a button and see what happens.
on mouseUp
put round(2.1*pi) into ttop -- angles are measured in radians; this goes a bit more than 360 degrees
put 5 into tscale -- change this to make the graph bigger or smaller
repeat with r = 0 to ttop step 0.1
put 1 + 10* (r+5) into linenum -- counts in whole numbers
put linenum into line linenum of tline
-- calculate the x,y coordinates
put tscale * sin(r+pi/2) into x
put tscale * sin(2*r) into y
-- adjust the coordinates to values for the screen
put round(50*x +600) into tx
put round(300 - 50*Y,0) into ty
-- clip if necessary
if ty < 50 or ty > 650
then
put "" into line linenum of tpoints
else
put tx & comma & ty into line linenum of tpoints
end if
end repeat
set the points of grc "curve" to tpoints
end mouseUp
First draw a freehand graphic called "curve" (the default name!)
Put the following code into a button and see what happens.
on mouseUp
put round(2.1*pi) into ttop -- angles are measured in radians; this goes a bit more than 360 degrees
put 5 into tscale -- change this to make the graph bigger or smaller
repeat with r = 0 to ttop step 0.1
put 1 + 10* (r+5) into linenum -- counts in whole numbers
put linenum into line linenum of tline
-- calculate the x,y coordinates
put tscale * sin(r+pi/2) into x
put tscale * sin(2*r) into y
-- adjust the coordinates to values for the screen
put round(50*x +600) into tx
put round(300 - 50*Y,0) into ty
-- clip if necessary
if ty < 50 or ty > 650
then
put "" into line linenum of tpoints
else
put tx & comma & ty into line linenum of tpoints
end if
end repeat
set the points of grc "curve" to tpoints
end mouseUp