Spiderweb in Matlab

4 views (last 30 days)
Jake Leung
Jake Leung on 5 Mar 2011
Hi guys,
Do you know how to plot a spiderweb in matlab? I was thinking of doing it in polar coordinates with about 8 poles (i.e. theta =45). my problem is now with the lines connecting the poles.
Thanks.

Answers (1)

Walter Roberson
Walter Roberson on 5 Mar 2011
Would you be looking for straight lines between the ribs, or lines that are gently cantilevered by the action of gravity on the stretchy spider silk?
Cantilevered lines might be difficult to compute realistically, but a gentle parabola might be good enough for your purposes.
Straight lines do not have nice equations in polar coordinates.
Unless you have good reasons to stick with polar coordinates, I suggest that you work in rectangular coordinates: then all you have to do is to determine points of correspondence on two adjacent arms and line() the two together (for the straight line case.)
Pick a distance along y=0, forming the implicit vector (0,0) to (x(n),0) . Rotate the vector by the angle of a rib to get the corresponding point on the rib; rotate the vector by the angle of the next rib to get the corresponding point there, and join the two rib points together with line().
I think if you proceed with the above, you will come out with x1 = x*cos(theta1) and y1 = x*sin(theta1), and x2 = x*cos(theta2) and y2 = x*sin(theta2) .
If I am correct, then it becomes obvious how to optimize this procedure: pre-calculate cos(theta) and sin(theta) for each of the rib angles, and then for any particular distance x, multiply the pre-calculated trig values by x.
Real spider webs often have lines between the ribs that do not go around to all of the ribs, and sometimes have several in a row that are half-offset with respect to each other, such as
_
_|-
_|-
|-
Real spider webs also often have minor ribs (usually lighter-weight) that start and stop part way along rather than extending to the full diameter.

Categories

Find more on Polar Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!