Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Creating a SPIRAL of stars in Excel
Keepitcool
Unfortunately that mail address is full of spam (32 pages the other day!).Anything futher send to: biggest (underscore) ears (at) hotmail (dot) com I'm going to spend a while looking into this lot tonight - I think its a cool way to learn excel Just wish I could remember my triginomitery - can't even remember what sin and cos are !! (will find out though) Anything else cool please forward J keepitcool wrote in message . .. Jason, I've tried emailing you with an "improved" version. bounced :) small wonder! This may be of interest for the math/theory.. http://www.2dcurves.com/spiral/spirallo.html Fixed: plotting of stars: centre rather than topleft. Added: accelerator starting angle starting radius direction Just experiment a little with the settings.. Option Explicit Sub DrawSpiral() Const nStars = 100 'Stars to plot Const nPower = 0.95 'Quadratic accelerator Const nCircles = 4 'Full Rotation (# circles) Const nCircle0 = 0.25 'Starting Rotation (# circles) Const bClockWise = True 'Direction Const rInner = 0.25 'InnerRadius/OuterRadius Const sMin = 5 'Starting size of star Const sMax = 20 'Ending size of stars Dim i&, j! 'Counter Dim x!, y! 'Positions Dim s!, k! 'Size, Angle Dim x0!, y0!, r0!, rN! 'Origin, Radii '' Note: '' Evenly distributed '' nStars/nCircels = even '' nPower = 1 '' '' Npower '' 1 will accelerate segment length '' < 1 will decelerate segment length With Worksheets.Add(befo=Sheets(1)) .Name = "Spiral" & Format(Time, "hhmmss") With [a1:g30] 'Origin x0 = (.Left + .Width) / 2 y0 = (.Top + .Height) / 2 'Radii rN = WorksheetFunction.Min(x0 - .Left, y0 - .Top) - sMax / 2 r0 = rInner * rN End With With .Shapes For i = 1 To nStars 'Distribution j = (i - 1) ^ nPower / (nStars - 1) ^ nPower 'Star Size s = sMin + (sMax - sMin) * j 'Angle k = 2 * WorksheetFunction.pi * _ (nCircle0 + nCircles * j) * -bClockWise x = x0 - s / 2 + Cos(k) * ((rN - r0 - s / 2) * j + r0 + s / 2) y = y0 - s / 2 + Sin(k) * ((rN - r0 - s / 2) * j + r0 + s / 2) .AddShape msoShape5pointStar, x, y, s, s Next End With With .DrawingObjects.Group .Name = "Spiral" .ShapeRange.Fill.ForeColor.RGB = vbRed .ShapeRange.Line.Visible = msoFalse End With End With End Sub keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool keepitcool wrote: i said "mathemagician" :) i'm fairly good with numbers, but alas no formal training. the thing is.. in this code the angle increment is linear which with a low number of stars looks awful. Whereas formally for a spiral the linesegment length should be fixed, so the stars distribution is not on "spokes"/fixed angles but more like wound string will the stars at fixed intervals. I'll need to find a more elaborate algorithm somewhere. Might give it a whirl later today. :) keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool (jason) wrote: Subject: creating a SPIRAL of stars in Excel From: (jason) Date: 5 Oct 2003 06:40:07 -0700 Newsgroups: microsoft.public.excel.programming "not much of a mathematician" - hmmmmm - think u may be more of a mathematician than you think! Thanks KeepitCool J keepitcool wrote in message .. . yep.. im not really a mathemagician.. and it took some puzzling but! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to determine the angle within hexagonal spiral? | Excel Discussion (Misc queries) | |||
Data Points Joined by Spiral !! | Charts and Charting in Excel | |||
how can I change input statement to show only stars for password **** | Excel Discussion (Misc queries) | |||
Cubic Parabola or Cubic Spiral | Excel Worksheet Functions | |||
creating a SPIRAL of stars in Excel | Excel Programming |