mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-01 06:52:45 +01:00
feat(track): at a crossing at a wide angle every head of one track meets every head of the other in a mitre from the corner of their flangeways to the far corner of the heads, the way the corners of a cast diamond look, so the running rails and guard rails of both tracks form closed corners and only the flangeways stay open, instead of the rails of one track going through and the other ones glued to their sides; corner_cut gives the mitres, as bends of the running rails and as miters of the guard rails; the fit of a loft end to the profile of another rail and the field and gauge outlines of the rail profile are gone with the gluing
This commit is contained in:
@@ -33,36 +33,6 @@ rail_size measure_rail( gfx::vertex_array const &Profile ) {
|
||||
}
|
||||
result.height = top - bottom;
|
||||
result.crest = top;
|
||||
std::size_t firsttop { count };
|
||||
std::size_t lasttop { 0 };
|
||||
for( std::size_t i = 0; i < count; ++i ) {
|
||||
if( Profile[ i ].position.y > top - 1e-4 ) {
|
||||
firsttop = std::min( firsttop, i );
|
||||
lasttop = std::max( lasttop, i );
|
||||
}
|
||||
}
|
||||
knots::line sides[ 2 ];
|
||||
for( std::size_t i = 0; i < count; ++i ) {
|
||||
auto const &point { Profile[ i ].position };
|
||||
if( i <= firsttop ) {
|
||||
sides[ 0 ].emplace_back( point.y, point.x );
|
||||
}
|
||||
if( i >= lasttop ) {
|
||||
sides[ 1 ].emplace_back( point.y, point.x );
|
||||
}
|
||||
}
|
||||
for( auto &side : sides ) {
|
||||
knots::sort( side );
|
||||
}
|
||||
auto const mean = []( knots::line const &Side ) {
|
||||
auto sum { 0.0 };
|
||||
for( auto const &knot : Side ) {
|
||||
sum += knot.y;
|
||||
}
|
||||
return sum / std::max<std::size_t>( Side.size(), 1 ); };
|
||||
auto const fieldfirst { mean( sides[ 0 ] ) > mean( sides[ 1 ] ) };
|
||||
result.field = sides[ fieldfirst ? 0 : 1 ];
|
||||
result.gauge = sides[ fieldfirst ? 1 : 0 ];
|
||||
auto const middle { top - 0.5 * result.height };
|
||||
auto webfrom { 1e9 };
|
||||
auto webto { -1e9 };
|
||||
|
||||
Reference in New Issue
Block a user