I've been messing around with equations to create bridge arches but I cannot figure out why one equation will not work in CityEngine.
I've been using Desmos graphing to figure out my equations and you'll see here that I have 3 graphs which I have designed to be similar lengths and heights:
I can successfully get the two parabolic functions to work under an extrude but I cannot get the sine wave to work under the extrude.
@Hidden
attr segment = 1
@Hidden
attr BridgeSpanL = geometry.du(0,unitSpace)
const Pi = 3.14159
const Bx = Pi/BridgeSpanL
@StartRule
BridgeSpan-->
set(BridgeSpanL, geometry.du(0,unitSpace))
split(u,unitSpace,0){~segment: BridgeArch(BridgeSpanL,split.index)}*
BridgeArch(BridgeSpanL,n)-->
extrude(
//-(pow(split.index,2)/BridgeSpanL)+split.index //Parabolic Curve for typical Arch Bridge
//pow((split.index-(BridgeSpanL/2)),2)/BridgeSpanL // Inverse Parabolic Curve
//(BridgeSpanL/4)*(sin((Pi/BridgeSpanL)*split.index))
(BridgeSpanL/4)*sin(Bx*split.index)
)
Although I can get a sine or cosine wave to work, I cannot get the period/frequency of the sine wave to behave as I expect under the function. If I could, I think I could create some more interesting arch patterns.
Is it my code, my math (probably), or is this a bug or a limitation of the extrude?
Above: Parabolic equation working.
Above: Sine wave equation not working.
Above: Sine wave sort of working but without the a frequency parameter (Bπ or 1/Bπ)
Also, does Pi π have a built-in for CityEngine? I feel like it should.
The ESRI Fence code gave me a few new ideas about how to create arches. For the picket fence they manipulate the scope.sy of the horizontal span with some parabolic equations to achieve some unique forms. None using wave functions though.