53 lines
1.0 KiB
Awk
53 lines
1.0 KiB
Awk
|
|
#
|
|
# Input for this script is generated by 'exportbloubs.f90'
|
|
#
|
|
# this code is (C) 2022 tTh
|
|
#
|
|
|
|
BEGIN {
|
|
count = 0
|
|
bx = by = bz = 0.0
|
|
print "// GENERATED FILE, DON'T TOUCH IT !"
|
|
print "// --------------------------------"
|
|
print
|
|
print "#declare Bloubs = object\n{"
|
|
print "union\t{"
|
|
}
|
|
|
|
{
|
|
age = $5
|
|
merged = $6
|
|
|
|
color = "Cyan"
|
|
if (merged) {
|
|
if (age > 150) color = "Orange"
|
|
else color = "Yellow"
|
|
}
|
|
else {
|
|
if (age > 150) color = "DarkGreen"
|
|
else color = "Aquamarine"
|
|
}
|
|
if (age < 18) color = "Gray40"
|
|
if (age < 9) color = "Blue"
|
|
|
|
bx += $1
|
|
by += $2
|
|
bz += $3
|
|
pigment = "pigment { color " color " }"
|
|
printf "\tsphere { <%f, %f, %f>, %f \n\t\t%s }\n", \
|
|
$1, $2, $3, $4, pigment
|
|
count++
|
|
}
|
|
|
|
END {
|
|
# print "\t}\n"
|
|
print "\t} // end of union\n"
|
|
print "finish { phong 0.57 specular 0.67 }\n"
|
|
print "}\n"
|
|
print "#declare Nb_Bloubs = ", count, ";\n"
|
|
print "#declare Bary_X = ", bx/count, ";";
|
|
print "#declare Bary_Y = ", by/count, ";";
|
|
print "#declare Bary_Z = ", bz/count, ";";
|
|
}
|