Commit 1c39d572 authored by Pierre Kraemer's avatar Pierre Kraemer

yeah..

parent 8e975db6
TypeDeScene Eux
Circle-250 7.9718
Circle-500 29.4626
Circle-1000 99.3581
\ No newline at end of file
Circle-250 8.68987
Circle-500 35.2113
Circle-1000 124.571
TypeDeScene NousAdapt
Circle-250 2.34102
Circle-500 5.49156
Circle-1000 23.706895
Circle-250 2.63193
Circle-500 7.39812
Circle-1000 26.5505
TypeDeScene NousStatic
Circle-250 2.46556
Circle-500 10.9064
Circle-1000 34.5659
\ No newline at end of file
Circle-250 2.49677
Circle-500 10.5604
Circle-1000 47.6007
TypeDeScene NousMaxSubdiv
Circle-250 1.95347
Circle-500 7.39246
Circle-1000 21.1772
\ No newline at end of file
Circle-250 2.37157
Circle-500 9.37886
Circle-1000 26.2879
#set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
#set output 'graphBenchCircles.svg'
set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
set output 'graphBenchCircles.svg'
set auto x
set grid
set yrange [0.1:*]
......@@ -9,9 +9,8 @@ set style fill solid border -2
set boxwidth 0.9
#set logscale y
#set xtic rotate by -50
plot 'LeurMethode.data' using 2:xtic(1) ti col, \
'NotreMethodeStatic.data' using 2 ti col, \
'NotreMethode.data' using 2 ti col, \
'NotreMethodeSansSimplif.data' using 2 ti col, \
'NotreMethodeSubdivMax.data' using 2 ti col
pause -1
\ No newline at end of file
plot 'Circle_LeurMethode.data' using 2:xtic(1) ti col, \
'Circle_NotreMethode.data' using 2 ti col, \
'Circle_NotreMethodeStatic.data' using 2 ti col, \
'Circle_NotreMethodeSubdivMax.data' using 2 ti col
pause -1
TypeDeScene Eux
City70-24/835 72.8304
City70-48-835 70.5733
City70-96-835 72.6253
\ No newline at end of file
City70-12-20-20 31.2538
City70-18-25-25 80.7429
City70-24-30-30 173.603
City70-27-38-38 307.116
City70-30-45-45 504.685
TypeDeScene Nous
City70-24/835 16.2245
City70-48-835 11.1495
City70-96-835 11.6373
City70-12-20-20 6.85704
City70-18-25-25 17.7281
City70-24-30-30 39.2271
City70-27-38-38 69.8514
City70-30-45-45 112.899
#set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
#set output 'graphBenchCity.svg'
set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt
set output 'graphBenchCity.svg'
set auto x
set grid
set yrange [0.1:*]
......@@ -9,6 +9,6 @@ set style fill solid border -2
set boxwidth 0.9
#set logscale y
#set xtic rotate by -50
plot 'LeurMethodeCity.data' using 2 ti col, \
'NotreMethodeCity.data' using 2:xtic(1) ti col
pause -1
\ No newline at end of file
plot 'City_LeurMethode.data' using 2 ti col, \
'City_NotreMethode.data' using 2:xtic(1) ti col
pause -1
TypeDeScene NousSansSimplif
Circle-250 2.10304
Circle-500 6.5933
Circle-1000 21.21568
#Circle-1000 23.107
This diff is collapsed.
......@@ -6,7 +6,7 @@
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<desc>Produced by GNUPLOT 4.4 patchlevel 0 </desc>
<desc>Produced by GNUPLOT 4.4 patchlevel 2 </desc>
<defs>
......@@ -30,156 +30,160 @@
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,367.6 L580.6,367.6 '></path>
<path d='M50.0,367.3 L576.8,367.3 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,367.6 L58.2,367.6 M580.6,367.6 L572.4,367.6 '></path>
<g transform="translate(42.3,371.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<path d='M50.0,367.3 L58.2,367.3 M576.8,367.3 L568.6,367.3 '></path>
<g transform="translate(42.3,371.4)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,323.6 L580.6,323.6 '></path>
<path d='M50.0,308.6 L576.8,308.6 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,323.6 L58.2,323.6 M580.6,323.6 L572.4,323.6 '></path>
<g transform="translate(42.3,327.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 10</tspan>
<path d='M50.0,308.6 L58.2,308.6 M576.8,308.6 L568.6,308.6 '></path>
<g transform="translate(42.3,312.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 100</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,279.6 L580.6,279.6 '></path>
<path d='M50.0,250.0 L576.8,250.0 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,279.6 L58.2,279.6 M580.6,279.6 L572.4,279.6 '></path>
<g transform="translate(42.3,283.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 20</tspan>
<path d='M50.0,250.0 L58.2,250.0 M576.8,250.0 L568.6,250.0 '></path>
<g transform="translate(42.3,254.1)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 200</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,235.6 L580.6,235.6 '></path>
<path d='M50.0,191.4 L576.8,191.4 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,235.6 L58.2,235.6 M580.6,235.6 L572.4,235.6 '></path>
<g transform="translate(42.3,239.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 30</tspan>
<path d='M50.0,191.4 L58.2,191.4 M576.8,191.4 L568.6,191.4 '></path>
<g transform="translate(42.3,195.5)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 300</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,191.6 L580.6,191.6 '></path>
<path d='M50.0,132.8 L576.8,132.8 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,191.6 L58.2,191.6 M580.6,191.6 L572.4,191.6 '></path>
<g transform="translate(42.3,195.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 40</tspan>
<path d='M50.0,132.8 L58.2,132.8 M576.8,132.8 L568.6,132.8 '></path>
<g transform="translate(42.3,136.9)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 400</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,147.6 L580.6,147.6 '></path>
<path d='M50.0,74.1 L576.8,74.1 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,147.6 L58.2,147.6 M580.6,147.6 L572.4,147.6 '></path>
<g transform="translate(42.3,151.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 50</tspan>
<path d='M50.0,74.1 L58.2,74.1 M576.8,74.1 L568.6,74.1 '></path>
<g transform="translate(42.3,78.2)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 500</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,103.5 L580.6,103.5 '></path>
<path d='M50.0,15.5 L576.8,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,103.5 L58.2,103.5 M580.6,103.5 L572.4,103.5 '></path>
<g transform="translate(42.3,107.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 60</tspan>
<path d='M50.0,15.5 L58.2,15.5 M576.8,15.5 L568.6,15.5 '></path>
<g transform="translate(42.3,19.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 600</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,59.5 L580.6,59.5 '></path>
<path d='M137.8,367.2 L137.8,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,59.5 L58.2,59.5 M580.6,59.5 L572.4,59.5 '></path>
<g transform="translate(42.3,63.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 70</tspan>
<path d='M137.8,367.2 L137.8,359.0 M137.8,15.5 L137.8,23.7 '></path>
<g transform="translate(137.8,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-12-20-20</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,15.5 L580.6,15.5 '></path>
<path d='M225.6,367.2 L225.6,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,15.5 L58.2,15.5 M580.6,15.5 L572.4,15.5 '></path>
<g transform="translate(42.3,19.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 80</tspan>
<path d='M225.6,367.2 L225.6,359.0 M225.6,15.5 L225.6,23.7 '></path>
<g transform="translate(225.6,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-18-25-25</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M182.7,367.2 L182.7,15.5 '></path>
<path d='M313.4,367.2 L313.4,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M182.7,367.2 L182.7,359.0 M182.7,15.5 L182.7,23.7 '></path>
<g transform="translate(182.7,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-24/835</tspan>
<path d='M313.4,367.2 L313.4,359.0 M313.4,15.5 L313.4,23.7 '></path>
<g transform="translate(313.4,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-24-30-30</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M315.3,367.2 L315.3,15.5 '></path>
<path d='M401.2,367.2 L401.2,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M315.3,367.2 L315.3,359.0 M315.3,15.5 L315.3,23.7 '></path>
<g transform="translate(315.3,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-48-835</tspan>
<path d='M401.2,367.2 L401.2,359.0 M401.2,15.5 L401.2,23.7 '></path>
<g transform="translate(401.2,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-27-38-38</tspan>
</text>
</g>
</g>
<g style="fill:none; color:gray; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M448.0,367.2 L448.0,15.5 '></path>
<path d='M489.0,367.2 L489.0,56.5 M489.0,23.7 L489.0,15.5 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M448.0,367.2 L448.0,359.0 M448.0,15.5 L448.0,23.7 '></path>
<g transform="translate(448.0,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-96-835</tspan>
<path d='M489.0,367.2 L489.0,359.0 M489.0,15.5 L489.0,23.7 '></path>
<g transform="translate(489.0,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>City70-30-45-45</tspan>
</text>
</g>
<path d='M50.0,15.5 L50.0,367.2 L580.6,367.2 L580.6,15.5 L50.0,15.5 Z '></path>
<path d='M50.0,15.5 L50.0,367.2 L576.8,367.2 L576.8,15.5 L50.0,15.5 Z '></path>
</g>
<a xlink:title="Plot #1">
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.5,36.0)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<g transform="translate(514.7,36.0)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>Eux</tspan>
</text>
</g>
<g style = 'stroke:none; shape-rendering:crispEdges'>
<polygon fill = 'currentColor' points = '526.2,36.0 565.2,36.0 565.2,27.8 526.2,27.8 '/>
<polygon fill = 'currentColor' points = '167.7,367.2 197.7,367.2 197.7,47.0 167.7,47.0 '/>
<polygon fill = 'currentColor' points = '300.4,367.2 330.3,367.2 330.3,56.9 300.4,56.9 '/>
<polygon fill = 'currentColor' points = '433.0,367.2 463.0,367.2 463.0,47.9 433.0,47.9 '/>
<polygon fill = 'currentColor' points = '522.4,36.0 561.4,36.0 561.4,27.8 522.4,27.8 '/>
<polygon fill = 'currentColor' points = '127.9,367.2 147.8,367.2 147.8,348.8 127.9,348.8 '/>
<polygon fill = 'currentColor' points = '215.7,367.2 235.6,367.2 235.6,319.8 215.7,319.8 '/>
<polygon fill = 'currentColor' points = '303.5,367.2 323.4,367.2 323.4,265.4 303.5,265.4 '/>
<polygon fill = 'currentColor' points = '391.3,367.2 411.2,367.2 411.2,187.1 391.3,187.1 '/>
<polygon fill = 'currentColor' points = '479.1,367.2 499.0,367.2 499.0,71.3 479.1,71.3 '/>
</g>
</g>
</a>
<a xlink:title="Plot #2">
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.5,52.4)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<g transform="translate(514.7,52.4)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>Nous</tspan>
</text>
</g>
<g style = 'stroke:none; shape-rendering:crispEdges'>
<polygon fill = 'currentColor' points = '526.2,52.4 565.2,52.4 565.2,44.2 526.2,44.2 '/>
<polygon fill = 'currentColor' points = '200.9,367.2 230.8,367.2 230.8,296.1 200.9,296.1 '/>
<polygon fill = 'currentColor' points = '333.5,367.2 363.5,367.2 363.5,318.5 333.5,318.5 '/>
<polygon fill = 'currentColor' points = '466.2,367.2 496.1,367.2 496.1,316.3 466.2,316.3 '/>
<polygon fill = 'currentColor' points = '522.4,52.4 561.4,52.4 561.4,44.2 522.4,44.2 '/>
<polygon fill = 'currentColor' points = '149.9,367.2 169.7,367.2 169.7,363.1 149.9,363.1 '/>
<polygon fill = 'currentColor' points = '237.7,367.2 257.5,367.2 257.5,356.8 237.7,356.8 '/>
<polygon fill = 'currentColor' points = '325.5,367.2 345.3,367.2 345.3,344.2 325.5,344.2 '/>
<polygon fill = 'currentColor' points = '413.3,367.2 433.1,367.2 433.1,326.2 413.3,326.2 '/>
<polygon fill = 'currentColor' points = '501.1,367.2 520.9,367.2 520.9,301.0 501.1,301.0 '/>
</g>
</g>
</a>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,15.5 L50.0,367.2 L580.6,367.2 L580.6,15.5 L50.0,15.5 Z '></path>
<path d='M50.0,15.5 L50.0,367.2 L576.8,367.2 L576.8,15.5 L50.0,15.5 Z '></path>
</g>
</svg>
......@@ -70,59 +70,63 @@ void generateBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dar
dd = map.phi1(dd);
} while(dd != d);
Dart dRoof;
dRoof = extrudeFaceAndMark<PFP>(map, position, d, buildingMark, height);
switch(buildingType)
{
case 0 : {
break;
}
case 1 : {
dRoof = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, height/3);
Dart dNext = map.phi1(dRoof);
Dart dPrev = map.phi2(map.phi_1(dRoof));
map.collapseEdge(dNext);
map.collapseEdge(dPrev);
break;
}
case 2 : {
dRoof = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, height/3);
Dart dNext = map.phi1(dRoof);
Dart dPrev = map.phi2(map.phi_1(dRoof));
typename PFP::VEC3 mid1 = (position[dNext] + position[map.phi1(dNext)]) / 2.0f;
typename PFP::VEC3 mid2 = (position[dPrev] + position[map.phi1(dPrev)]) / 2.0f;
map.collapseEdge(dNext);
map.collapseEdge(dPrev);
position[dRoof] = mid2;
position[map.phi1(dRoof)] = mid1;
break;
}
case 3 : {
unsigned int nbStairs = rand() % 5;
for(unsigned int i = 0; i < nbStairs; ++i)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position);
Dart dRoofSmall = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, 0.0f);
Dart dd = dRoofSmall;
do
{
position[dd] = position[dd] + (c - position[dd]) / 3.0f;
dd = map.phi1(dd);
} while (dd != dRoofSmall);
dRoof = extrudeFaceAndMark<PFP>(map, position, dRoofSmall, buildingMark, height / 2.0f);
}
bool spike= rand() % 2;
if(spike)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position);
c[2] += height / 1.5f;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof);
position[dRoof] = c;
}
break;
}
}
// Dart dRoof;
// dRoof = extrudeFaceAndMark<PFP>(map, position, d, buildingMark, height);
//
// switch(buildingType)
// {
// case 0 :
// {
// break;
// }
// case 1 :
// {
// dRoof = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, height/3);
// Dart dNext = map.phi1(dRoof);
// Dart dPrev = map.phi2(map.phi_1(dRoof));
// map.collapseEdge(dNext);
// map.collapseEdge(dPrev);
// break;
// }
// case 2 :
// {
// dRoof = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, height/3);
// Dart dNext = map.phi1(dRoof);
// Dart dPrev = map.phi2(map.phi_1(dRoof));
// typename PFP::VEC3 mid1 = (position[dNext] + position[map.phi1(dNext)]) / 2.0f;
// typename PFP::VEC3 mid2 = (position[dPrev] + position[map.phi1(dPrev)]) / 2.0f;
// map.collapseEdge(dNext);
// map.collapseEdge(dPrev);
// position[dRoof] = mid2;
// position[map.phi1(dRoof)] = mid1;
// break;
// }
// case 3 :
// {
// unsigned int nbStairs = rand() % 5;
// for(unsigned int i = 0; i < nbStairs; ++i)
// {
// typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position);
// Dart dRoofSmall = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, 0.0f);
// Dart dd = dRoofSmall;
// do
// {
// position[dd] = position[dd] + (c - position[dd]) / 3.0f;
// dd = map.phi1(dd);
// } while (dd != dRoofSmall);
// dRoof = extrudeFaceAndMark<PFP>(map, position, dRoofSmall, buildingMark, height / 2.0f);
// }
// bool spike= rand() % 2;
// if(spike)
// {
// typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position);
// c[2] += height / 1.5f;
// dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof);
// position[dRoof] = c;
// }
// break;
// }
// }
}
template <typename PFP>
......@@ -136,10 +140,17 @@ void generateCity(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
Dart dEnd = map.end();
for(Dart d = map.begin(); d != dEnd && nbBuilding > 0; map.next(d))
{
if(!buildingMark.isMarked(d) && (rand() % 20 == 0) && notDiagonalAdjacentToAnObstacle<PFP>(map, d, buildingMark))
if(!buildingMark.isMarked(d) && (rand() % 12 == 0) && notDiagonalAdjacentToAnObstacle<PFP>(map, d, buildingMark))
{
generateBuilding<PFP>(map, position, d, (1+(rand()%3)) * height / 2.0f, rand() % 4, obstacleMark, buildingMark);
--nbBuilding;
typename PFP::VEC3 p = position[d];
int emptySquareX = (30 * 70.0f / 2.0f) - (7 * 70.0f) - 10;
int emptySquareY = (30 * 70.0f / 2.0f) - (7 * 70.0f) - 10;
if(! ((p[0] < -emptySquareX && p[1] < -emptySquareY) || (p[0] > emptySquareX && p[1] > emptySquareY)) )
{
generateBuilding<PFP>(map, position, d, (1+(rand()%3)) * height / 2.0f, rand() % 4, obstacleMark, buildingMark);
--nbBuilding;
}
}
}
}
......
......@@ -6,8 +6,9 @@ namespace CGoGN
namespace ExportScene
{
template <typename PFP>
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacle, std::string& filename);
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, std::string& filename);
}
......
......@@ -7,27 +7,28 @@ namespace ExportScene
{
template <typename PFP>
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacle, std::string& filename)
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, std::string& filename)
{
std::ofstream out(filename.c_str(), std::ios::out);
if (!out.good()) {
if (!out.good())
{
std::cerr << "(export) Unable to open file " << filename << std::endl;
return false;
}
CellMarker f(map,FACE);
CellMarker f(map, FACE);
for(Dart d=map.begin();d!=map.end();map.next(d))
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(obstacle.isMarked(d) && obstacle.isMarked(map.phi1(d)) && !f.isMarked(d))
if(buildingMark.isMarked(d) && !f.isMarked(d))
{
f.mark(d);
Dart dd=d;
Dart dd = d;
do
{
out << position[dd] << std::endl;
dd=map.phi1(dd);
}while(dd!=d);
dd = map.phi1(dd);
} while(dd != d);
out << std::endl;
}
}
......
......@@ -117,24 +117,24 @@ void Agent::computePrefVelocity()
VEC3 goalVector = goals_[curGoal_] - part_.m_position;
float goalDist2 = goalVector.norm2();
if(goalDist2 < 200.0f)
{
curGoal_ = (curGoal_ + 1) % goals_.size();
goalVector = goals_[curGoal_] - part_.m_position;
goalDist2 = goalVector.norm2();
}
// if(goalDist2 < 200.0f)
// {
// curGoal_ = (curGoal_ + 1) % goals_.size();
// goalVector = goals_[curGoal_] - part_.m_position;
// goalDist2 = goalVector.norm2();
// }
if (goalDist2 > 1.0f)
goalVector.normalize();
/*
* Perturb a little to avoid deadlocks due to perfect symmetry.
*/
// float angle = std::rand() * 2.0f * M_PI / RAND_MAX;
// float dist = std::rand() * 0.0001f / RAND_MAX;
// prefVelocity_ = goalVector + VEC3(dist * cos(angle), dist * sin(angle), 0.0f);
prefVelocity_ = goalVector;
float angle = std::rand() * 2.0f * M_PI / RAND_MAX;
float dist = std::rand() * 0.0001f / RAND_MAX;
prefVelocity_ = goalVector + VEC3(dist * cos(angle), dist * sin(angle), 0.0f);
// prefVelocity_ = goalVector;
}
void Agent::computeNewVelocity2()
......@@ -143,7 +143,7 @@ void Agent::computeNewVelocity2()
VEC3 c;
VEC3 vel;
float cohesion=1.0f;
float cohesion = 1.0f;
centroid.zero();
c.zero();
......@@ -152,9 +152,7 @@ void Agent::computeNewVelocity2()
for(std::vector<std::pair<float, Dart> >::iterator it = obstacleNeighbors_.begin();
it != obstacleNeighbors_.end();
++it)
{
}
{}
unsigned int nbA = 0;
for(std::vector<std::pair<float, Agent*> >::iterator it = agentNeighbors_.begin();
......@@ -166,7 +164,8 @@ void Agent::computeNewVelocity2()
centroid += oPos;
VEC3 pOp(oPos-mPos);
if(pOp.norm2()<=radius_*radius_*maxSpeed_*maxSpeed_*2.0f) {
if(pOp.norm2()<=radius_*radius_*maxSpeed_*maxSpeed_*2.0f)
{
c -= pOp;
// prefVelocity_.zero();
}
......@@ -174,7 +173,8 @@ void Agent::computeNewVelocity2()
vel += (*it).second->prefVelocity_;
}
if(nbA>0) {
if(nbA >0)
{
centroid /= nbA;
centroid -= part_.m_position;
centroid /= 10;
......
......@@ -171,11 +171,11 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init()
{
float sideSize = 70.0f;
unsigned int nbSquares = 24;
unsigned int nbSquares = 30;
CityGenerator::generateGrid<PFP>(map, position,nbSquares,nbSquares, sideSize, obstacleMark,buildingMark);
// CityGenerator::generateGrid<PFP>(map, position, nbSquares, nbSquares, sideSize, obstacleMark, buildingMark);
// CityGenerator::generateCorridor<PFP>(map, position, obstacleMark, buildingMark, 50, nbSquares);