ScriptSpot

Forum topic · General Scripting

Inverted Archs

By JokerMartini · 2013-03-14

Description

So I'm working on generating positions in this circular fashion and I've the outer circle and linear parts working. I'm not sure how to get the inverted archs to work appropriately. I was hoping to get some help on that. If you look at the picture I got the green and yellow parts working but not sure how to calculate the red? Script is below.

http:\\www.jokermartini.com/myStuff/circle.jpg

Feel free to play around and change up the columns variable to any number higher than 3.

steps = 6
height = 0.0
width = 30.0
len = 30
radiusX = 15
radiusY = 15
fourCorners = #()
rounded = .5

delete objects
/* Create Circle */
columns = 4 --don't got lower than 3
columnAngle = 360.0 / columns
subCounter = 0

clearlistener()
/* Create Corner Points */
for c = 1 to columns do
(
calcX = radiusX * cos((c-1) * columnAngle)
calcY = radiusY * sin((c-1) * columnAngle)

cornerPos = [calcX,calcY,height]
point pos:cornerPos size:4 wirecolor:blue
append fourCorners cornerPos
subCounter += 1

/* Create Sub Points */
subColumns = (steps*columns+columns)
subAngle = 360.0 / subColumns
for s = 1 to steps do
(
/* Circular Calculations */
subCounter += 1
calcXRadial = radiusX * cos((subCounter-1) * subAngle)
calcYRadial = radiusY * sin((subCounter-1) * subAngle)
circularPos = [calcXRadial,calcYRadial,height]
point pos:circularPos size:2 wirecolor:green

/* Linear Calculations */
calcXLinear = radiusX * cos((c) * columnAngle)
calcYLinear = radiusY * sin((c) * columnAngle)
nextCorner = [calcXLinear,calcYLinear,height]
linearPos = (cornerPos + ((nextCorner-cornerPos)*(((s as float)/(steps+1)))))
point pos:linearPos size:2 wirecolor:yellow
append fourCorners circularPos

/* Inverted Circular Calculations */
)
)

Comments (2)

JokerMartini · 2013-03-14

Thanks bud.

:)

barigazy · 2013-03-14

A simple solution how to get position of "MIRROR-RED" point.