Tuesday, July 22, 2014

Day 330 - POW Customizable Function Bracelet

Today we kick the math up a notch and use a combination of two trigonometric functions to define a bracelet curve. POW!


Thingiverse link: http://www.thingiverse.com/thing:426034

Settings: MakerBot Replicator 2 with .3mm/low resolution and raft.

Technical notes, math flavor: The main thing that characterized each of our previous bracelet designs was a change of frequency. The TRI bracelet (Day 320) used a trigonometric function with a very low frequency of 3:

1+sin(3t). 

The SUN bracelet (Day 328) allowed a variable frequency:

1+sin(frequency*t). 

The RIB bracelet (Day 329) used a very high frequency of 72:

1+sin(72*t).

This time we're going to not only change the frequency, but also fundamentally change the function by incorporating a cosine as well:

1+sin(2*frequency*t)*cos(frequency*t). 

Notice that the frequencies for the sine and cosine functions are different; this is what gives our bracelet its interesting shape.

Technical notes, OpenSCAD flavor: Below is the full code for the POW bracelet. We've separated the code for the wave function and the wrapping of the wave function, and used the more complicated trigonometric function described above.

// mathgrrl function bracelet - POW design

/////////////////////////////////////////////////////////
// resolution parameters

$fn = 24*1;
step = .25*1; // smaller means finer

// Thickness, in mm 
th = .4;

/////////////////////////////////////////////////////////
// size parameters

// Diameter of the bracelet, in mm 
diameter = 60; 
radius = diameter/2;

// Height of the bracelet, in mm 
height = 10;

/////////////////////////////////////////////////////////
// style parameters

// Amplitude of the wave, in mm
amplitude = 6;

// Frequency of the wave 
frequency = 12;

/////////////////////////////////////////////////////////
// define the wave function

function f(t) = 1+sin(2*frequency*t)*cos(frequency*t);

/////////////////////////////////////////////////////////
// define the wrapped wave function

function g(t) =  
   [ (radius+amplitude*f(t))*cos(t),
     (radius+amplitude*f(t))*sin(t),
     0
   ];

/////////////////////////////////////////////////////////
// renders

// the bracelet
linear_extrude(height=height,slices=height/.4)
function_trace(rad=th, step=step, end=360);

/////////////////////////////////////////////////////////
// module for tracing out a function

module function_trace(rad, step, end) {
 for (t=[0: step: end+step]) {
  hull() {
   translate(g(t)) circle(rad);
   translate(g(t+step)) circle(rad);
       }
   }
};

No comments:

Post a Comment