Published grammar
This page uses the same scene-first presentation as the gallery viewer while also showing the source grammar text.
//------------------------------------------------
// Symmetric airfoil grammar using DSX alignment
// DSX applies to the opposite X side of the cube
// First segment thickness stabilized
//------------------------------------------------
Start -> Wing(0.8 0.8 4 0.2 0.3)
Wing(x y n dx dz) n -> T(dx*0.52 0 dz) S(x y 1) [ GDSZ(x y 1) GDTZ(dx 0 0) SymmetricAirfoil(28 1.2 0.12 dz) ]
//------------------------------------------------
// SymmetricAirfoil(segmentCount chord thickness zThickness)
// thick is the symmetric NACA thickness ratio
//------------------------------------------------
SymmetricAirfoil(n chord thick zt) ->
UpperSurface(0 n chord thick zt)
LowerSurface(0 n chord thick zt)
//------------------------------------------------
// Upper surface
//------------------------------------------------
UpperSurface(i n chord thick zt) ->
?(i<n) Upper(i n chord thick zt) : End
Upper(i n chord thick zt) ->
UpperStrip(i n chord thick zt)
UpperSurface(i+1 n chord thick zt)
UpperStrip(i n chord thick zt) ->
[
T(
-(chord*0.5)+((i/n)*chord)
0
0
)
SegmentUpper(i n chord thick zt)
]
SegmentUpper(i n chord thick zt) ->
?(i+1<n) SegmentUpperBody(i n chord thick zt) : End
SegmentUpperBody(i n chord thick zt) ->
[
S(
(chord/n)
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
zt
)
DSX(
1
(
max(
(chord*5*thick*(0.2969*sqrt(i/n)-0.1260*(i/n)-0.3516*(i/n)^2+0.2843*(i/n)^3-0.1015*(i/n)^4))
0.002
)
/
(
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
+0.000001
)
)
1
)
T(
(chord/(2*n))
(
(
max(
(chord*5*thick*(0.2969*sqrt(i/n)-0.1260*(i/n)-0.3516*(i/n)^2+0.2843*(i/n)^3-0.1015*(i/n)^4))
0.002
)
+
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
)/2
)
0
)
[ A(180 1) I(Cube smoothConcrete 1) ]
]
//------------------------------------------------
// Lower surface
//------------------------------------------------
LowerSurface(i n chord thick zt) ->
?(i<n) Lower(i n chord thick zt) : End
Lower(i n chord thick zt) ->
LowerStrip(i n chord thick zt)
LowerSurface(i+1 n chord thick zt)
LowerStrip(i n chord thick zt) ->
[
T(
-(chord*0.5)+((i/n)*chord)
0
0
)
SegmentLower(i n chord thick zt)
]
SegmentLower(i n chord thick zt) ->
?(i+1<n) SegmentLowerBody(i n chord thick zt) : End
SegmentLowerBody(i n chord thick zt) ->
[
S(
(chord/n)
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
zt
)
DSX(
1
(
max(
(chord*5*thick*(0.2969*sqrt(i/n)-0.1260*(i/n)-0.3516*(i/n)^2+0.2843*(i/n)^3-0.1015*(i/n)^4))
0.002
)
/
(
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
+0.000001
)
)
1
)
T(
(chord/(2*n))
-(
(
max(
(chord*5*thick*(0.2969*sqrt(i/n)-0.1260*(i/n)-0.3516*(i/n)^2+0.2843*(i/n)^3-0.1015*(i/n)^4))
0.002
)
+
max(
(chord*5*thick*(0.2969*sqrt((i+1)/n)-0.1260*((i+1)/n)-0.3516*((i+1)/n)^2+0.2843*((i+1)/n)^3-0.1015*((i+1)/n)^4))
0.002
)
)/2
)
0
)
[ A(180 1) I(Cube smoothConcrete 1) ]
]
End ->