Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to determine the angle within hexagonal spiral? Eric Excel Discussion (Misc queries) 22 December 31st 07 10:41 AM
Data Points Joined by Spiral !! monir Charts and Charting in Excel 0 July 21st 07 10:16 PM
how can I change input statement to show only stars for password **** SAM SEBAIHI Excel Discussion (Misc queries) 5 December 9th 06 06:34 PM
Cubic Parabola or Cubic Spiral Michael M Excel Worksheet Functions 0 August 7th 06 11:19 PM
creating a SPIRAL of stars in Excel jason Excel Programming 4 October 6th 03 11:59 AM


All times are GMT +1. The time now is 07:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"