Saturday, July 12, 2014

Day 320 - TRI Customizable Function Bracelet

Today we have the first of many posts in a customizable bracelet series, with a bracelet design called TRI. It has a nice wavy shape that is based on a trigonometric function:


The wavy shape makes this bracelet sit very nicely on your wrist. If you get it sized just right then it will fit over one of your hands but not the other, due to the way your thumb joint fits through the twist. In this picture the white TRI bracelets are .4mm thick, the pink one is a very sturdy .8mm thick, and the army green one is a wispy .2mm thick (I expect it to break soon):


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

Sizing hints: I've got big hands for a lady so mine is sized at 65mm diameter and is the "Large" demo model at the link above; that's probably the average man size for this bracelet. I'd wager that average woman size is 60mm, which is "Medium" at the link above, and that average child's size is 55mm, which is "Small". But you can size it however you like in the Customizer link, and make whatever works for you!

Settings: Printed on a MakerBot Replicator Mini with what from now on I will call ".3 vanilla", by which I mean Standard settings with raft but no supports, and all options at default except for bumping layer thickness up to .3mm.

Technical notes, printing flavor: The TRI bracelet is what made the sizable pile of fails on Day 312. My original motivation was to make bracelet designs that are already the desired thickness, as opposed to solid filled-in discs whose shell thickness had to be set within your printer's software. I had some trouble figuring out how to print bracelets like emmett's classic Stretchlet bracelet when they were in this type of hockey-puck format:


Although I now know how to deal with this, I wanted to make some bracelets that people could print right away on whatever machine they were on, and even if they were beginners. Another reason I wanted to move away from the printing-shells-of-hockey-pucks method is that when I remove infill, floor, and roof to print such a bracelet, my machine prints a raft all across the inside even though there is nothing to be printed there. This leads to a lot of wasted plastic, not to mention wasted time. It took a while for me to figure out how to reliably construct a bracelet shell, and in the end of course it came down to some math!

Technical notes, math flavor: The key idea is to know exactly what curve you want to trace out, and then to trace it out with a particular desired thickness. If you don't trace out the curve at exactly the scale you need then the thickness will be corrupted when you scale afterwards. The path that makes the rounded triangle cross-section of this bracelet is defined by a parametric curve whose components are based on the trigonometric function 1+sin(3t):


The sine function moves up and down in a wave that is controlled by the numbers in the expression. The multiplier 3 determines the frequency of the graph, that is, the number of times the graph makes a full up-and-down cycle as we move from 0 to 2*pi. Normally the sine function would have heights varying from -1 to 1, but the "1+" in the function above shifts things up so that the graph instead has heights between 0 and 2.

We can modify this function further to get a transformation that will match style and size parameters like wrist size (here 60mm diameter) and wiggly-ness (here "4"):


The constant multiple of 4 determines the graph's amplitude, which is the vertical distance from its center to the top of its peaks; the graph of 4(1+sin(3t)) would have heights varying from 0 to 8. Finally, the 60 determines a shift upwards 60 units, which is why the graph above has heights varying from 60 to 68.

To wrap this curve around a circle we create a parametric curve whose first coordinate is the function above times the cosine function, and whose second coordinate is the function above times the sine function. Think of it as a weighted version of the parametric curve (cos t, sin t) that traces out the unit circle, with our function 60+4(1+sin(3t)) providing the "weight" on the two coordinates, pushing the shape in and out.


Technical notes, OpenSCAD flavor: The code for the TRI bracelet uses the module function_trace to trace out the parametric curve we discussed above. Specifically, function_trace creates a series of tiny circles along the parametric curve and then connects adjacent circles. The diameter of the circles is determined by the thickness parameter. The resulting 2-dimensional shape is then extruded with linear_extrude while twisting 30 degrees. In the Customizer you can enter your own custom values for thickness, diameter, and height to size and style the TRI bracelet.

// mathgrrl function bracelet - TRI MODEL

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

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

// Thickness, in mm (recommend between .2 and .8)
th = .4;

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

// Diameter of the bracelet, in mm (should exceed the wide diameter of your wrist so that you can get the bracelet over your hand)
diameter = 60; 

radius = diameter/2;

// Height of the bracelet, in mm (along your wrist)
height = 20;

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

function g(t) =  
   [ (radius+4*(1+sin(3*t)))*cos(t),
     (radius+4*(1+sin(3*t)))*sin(t),
     0
   ];

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

// the bracelet
linear_extrude(height=height,twist=30,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);
       }
   }
};

UPDATE/CORRECTION: In the WolframAlpha images above, I should have used a translation of 30, not 60, because RADIUS IS NOT DIAMETER SAY IT WITH ME NOW.

No comments:

Post a Comment