[futurebasic] Re: [FB] X-FB? Calculations for Points on Circle (Barrel problem)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 2008 : Group Archive : Group : All Groups

From: Max Taylor <maxclass@...>
Date: Tue, 14 Oct 2008 17:22:56 -0700
On Oct 14, 2008, at 10:54 AM, Robert Covington wrote:


> I need to know a simple way to figure out 2 approaches to laminating  
> up a barrel shaped entity, as (1) might end up being needed even if  
> the original (2) was the goal. :)

Robert,

This should solve your problem in a simple to understand way.

If you have any problem with the code running (I fully tested it) I'll  
send it back channel as an attachment.

Enjoy.

Max Taylor


/*
File: BarrelStaves
From: Max Taylor
Date: 20081014 4:52 PM

This code is Copyleft and in the Public Domain.

FYI, The individual slats of a barrel are called "Staves".

Purpose:

Quickly calculate the exact size requirements of the
individual staves required to produce a barrel with
a given number of sides based upon the maximum width
of each individual stave.

This is all assuming that the sides of the barrel are
straight and not curved. Many planters are made like this.

The calculations for these valuse are based upon the exact
same type of calculations that are used to calculate all of
the strut lengths for Geodesic Domes and were first derived
by "Richard Buckminster Fuller" [Bucky] and his gang back in
the 1930's.

I have a program called "GeoCalc" that generates geodesic
domes of any size and any frequency and breakdown.

Hope this is of help.

*/

dim as double gCF, gQ

dim as double StaveWidth
dim as double MaxStaveWidth
dim as long NumberOfStaves

dim as double Diameter
dim as double Radius
dim as double Circumference
dim as double CentralAngle
dim as double AxialAngle
dim as double ChordFactor

// Conversion Factor = .017453293  [SIN/ATN returns radians]
gCF  = ATN(1) / 45

// Equal to one Radian or 180 / π = 57.295779513 [inverse]
gQ   = 1 / gCF


/*
  * Input Values are in inches/meters, etc.
  *
  * This should probably have some edit fields for entry
  * but should provide all the values you require.
  *
  * Test this with a stave width of 20 to make a square.
  */

MaxStaveWidth = 4

Diameter = 24

/*
  * Get Radius, Circumference, # of Staves and Central Angle
  */

Radius = Diameter / 2

Circumference = Diameter * pi

/*
  * We round up here so all staves are equal in size.
  */

NumberOfStaves = int(( Circumference / MaxStaveWidth ) + .5 )

CentralAngle = 360 / NumberOfStaves

/*
  * Calculate the Chord Factor which is a value that when
  * multiplied by any Radius gives you the exact width
  * of every Stave.
  *
  * Once you have a Chord Factor for any given Central Angle
  * you can calculate the exact distance between your dots
  * (stave width) by simply multiplying the radius times
  * the Chord Factor. The number of staves will not change
  * but the widths will.
  *
  * This is the length between the two dots in your diagram.
  */

ChordFactor = 2 * ( sin( (CentralAngle / 2) * gCF ) )


/*
  * Once the Central Angle is known the angle of the cuts
  * on the sides of the staves is calcultaed as follows.
  *
  * Since every triangle, on a flat plane must have three
  * angles that add up to 180 degrees you simply subtract
  * the known angle from 180 and divide the remainder by 2.
  *
  * This is known as the AxialAngle.
  */

AxialAngle = ( 180 - CentralAngle ) / 2

print "List of values for this barrel"
print "-------------------------------------"
Print "Diameter of barrel is:"; Diameter
print "Radius of the barrel is: ";Radius
print "Number of staves are: "; NumberOfStaves
print "Central angle is equal to: "; CentralAngle
print
print "The Chrod Factor applies to all staves since"
print "they are all equal in width."
print "-------------------------------------"
print "Chord Factor value is: "; ChordFactor
print
print "Width of each stave is: "; ChordFactor * Radius
print "Side or Axial angles are: ";AxialAngle

do
handleevents
until gFBQuit

end