On Sat, 2010-01-09 at 19:42 -0700, Ron Jensen wrote: > Cool, Ralf added code to generate stopways to flightgear! But wait, the > grass strip around the stopways is too big. 1/0.3048 times to big, to > be exact: > > http://www.jentronics.com/fgfs/temp/genapts-ante.jpg > http://www.jentronics.com/fgfs/temp/genapts-current.jpg > http://www.jentronics.com/fgfs/temp/genapts-post.jpg > > Also, the ordering of the stopways was inconsistent. Originally a > stopway on runway 17 would have an asphalt strip sticking out the south > end of the runway and a grass strip sticking out the north end. Now > both strips stick out the south end (stopping end for 14).
The attached patch against terragear-cs adds stopway texturing and corrects which stopway is on which runway end. Gijs is working on materials.xml and textures. http://www.jentronics.com/fgfs/temp/genapts_stopway05.jpg Thanks, Ron
diff --git a/src/Airports/GenAirports/build.cxx b/src/Airports/GenAirports/build.cxx index 8ac0c6e..60f76e5 100644 --- a/src/Airports/GenAirports/build.cxx +++ b/src/Airports/GenAirports/build.cxx @@ -337,10 +337,10 @@ static void build_runway( const TGRunway& rwy_info, safe_base = gen_runway_area_w_extend( rwy_info, 0.0, 40.0, 0.0, 0.0, 40.0 ); } else { - base = gen_runway_area_w_extend( rwy_info, 0.0, 20.0, -rwy_info.stopway1, -rwy_info.stopway2, 20.0 ); + base = gen_runway_area_w_extend( rwy_info, 0.0, 20.0, -rwy_info.stopway1* SG_FEET_TO_METER, -rwy_info.stopway2* SG_FEET_TO_METER, 20.0 ); // also clear a safe area around the runway safe_base - = gen_runway_area_w_extend( rwy_info, 0.0, 180.0, -rwy_info.stopway2, -rwy_info.stopway2, 50.0 ); + = gen_runway_area_w_extend( rwy_info, 0.0, 180.0, -rwy_info.stopway1* SG_FEET_TO_METER, -rwy_info.stopway2* SG_FEET_TO_METER, 50.0 ); } *apt_clearing = tgPolygonUnion(safe_base, *apt_clearing); diff --git a/src/Airports/GenAirports/rwy_common.cxx b/src/Airports/GenAirports/rwy_common.cxx index f88e76b..6a1605b 100644 --- a/src/Airports/GenAirports/rwy_common.cxx +++ b/src/Airports/GenAirports/rwy_common.cxx @@ -50,32 +50,32 @@ void gen_number_block( const TGRunway& rwy_info, } if ( num == 11 ) { - sprintf( tex1, "11" ); + sprintf( tex1, "11" ); } else if ( num < 10 ) { - sprintf( tex1, "%dc", num ); + sprintf( tex1, "%dc", num ); } else { - sprintf( tex1, "%dl", num / 10 ); - sprintf( tex2, "%dr", num - (num / 10 * 10)); + sprintf( tex1, "%dl", num / 10 ); + sprintf( tex2, "%dr", num - (num / 10 * 10)); } // printf("tex1 = '%s' tex2 = '%s'\n", tex1, tex2); if ( num < 10 ) { - gen_runway_section( rwy_info, poly, - start_pct, end_pct, - 0.0, 1.0, + gen_runway_section( rwy_info, poly, + start_pct, end_pct, + 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, - heading, - material, tex1, - rwy_polys, texparams, accum ); + heading, + material, tex1, + rwy_polys, texparams, accum ); } else if ( num == 11 ) { - gen_runway_section( rwy_info, poly, - start_pct, end_pct, - 0.0, 1.0, + gen_runway_section( rwy_info, poly, + start_pct, end_pct, + 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, - heading, - material, tex1, - rwy_polys, texparams, accum ); + heading, + material, tex1, + rwy_polys, texparams, accum ); } else { gen_runway_section( rwy_info, poly, start_pct, end_pct, @@ -103,36 +103,61 @@ void gen_runway_stopway( const TGRunway& rwy_info, texparams_list *texparams, TGPolygon* accum ) { const float length = rwy_info.length / 2.0 + 2.0; + double start1_pct = 0.0; + double start2_pct = 0.0; + double end1_pct = 0.0; + double end2_pct = 0.0; + double part_len = 0.0; + + int count=0; + int i=0; + if (rwy_info.stopway1 > 0.0) { /* Generate approach end stopway */ - gen_runway_section( rwy_info, - runway_a, - - rwy_info.stopway1 / length, 0, - 0.0, 1.0, - 0.0, 1.0, 0.0, 1.0, - rwy_info.heading, - prefix, - "tiedown", - rwy_polys, - texparams, - accum); + count = (int) (rwy_info.stopway1 * 2.0/ rwy_info.width); + if(count < 1) count = 1; + part_len = rwy_info.stopway1 / (double) count; + for(i=0;i<count;i++) + { + start1_pct=end1_pct; + end1_pct = start1_pct + ( part_len / length ); + gen_runway_section( rwy_info, + runway_b, + - end1_pct, -start1_pct, + 0.0, 1.0, + 0.0, 1.0, 0.0, 1.0, //last number is lengthwise + rwy_info.heading + 180.0, + prefix, + "stopway", + rwy_polys, + texparams, + accum); + } } if (rwy_info.stopway2 > 0.0) { /* Generate reciprocal end stopway */ - gen_runway_section( rwy_info, - runway_b, - - rwy_info.stopway2 / length, 0, - 0.0, 1.0, - 0.0, 1.0, 0.0, 1.0, - rwy_info.heading + 180.0, - prefix, - "tiedown", - rwy_polys, - texparams, - accum); + count = (int) (rwy_info.stopway2 * 2.0 / rwy_info.width); + if(count < 1) count = 1; + part_len = rwy_info.stopway2 / (double) count; + for(i=0;i<count;i++) + { + start2_pct=end2_pct; + end2_pct = start2_pct + ( part_len / length ); + gen_runway_section( rwy_info, + runway_a, + - end2_pct, -start2_pct, + 0.0, 1.0, + 0.0, 1.0, 0.0, 1.0, + rwy_info.heading, + prefix, + "stopway", + rwy_polys, + texparams, + accum); + } } } - + // generate a section of runway void gen_runway_section( const TGRunway& rwy_info, const TGPolygon& runway, @@ -154,14 +179,14 @@ void gen_runway_section( const TGRunway& rwy_info, Point3D a3 = runway.get_pt(0, 3); if ( startl_pct > 0.0 ) { - startl_pct -= nudge * SG_EPSILON; + startl_pct -= nudge * SG_EPSILON; } if ( endl_pct < 1.0 ) { - endl_pct += nudge * SG_EPSILON; + endl_pct += nudge * SG_EPSILON; } if ( endl_pct > 1.0 ) { - endl_pct = 1.0; + endl_pct = 1.0; } // partial "w" percentages could introduce "T" intersections which @@ -170,16 +195,16 @@ void gen_runway_section( const TGRunway& rwy_info, // for that by nudging the areas a bit bigger so we don't end up // with polygon slivers. if ( startw_pct > 0.0 || endw_pct < 1.0 ) { - if ( startw_pct > 0.0 ) { - startw_pct -= nudge * SG_EPSILON; - } - if ( endw_pct < 1.0 ) { - endw_pct += nudge * SG_EPSILON; - } + if ( startw_pct > 0.0 ) { + startw_pct -= nudge * SG_EPSILON; + } + if ( endw_pct < 1.0 ) { + endw_pct += nudge * SG_EPSILON; + } } SG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct - << " end len % = " << endl_pct); + << " end len % = " << endl_pct); double dlx, dly; @@ -187,21 +212,21 @@ void gen_runway_section( const TGRunway& rwy_info, dly = a1.y() - a0.y(); Point3D t0 = Point3D( a0.x() + dlx * startl_pct, - a0.y() + dly * startl_pct, 0); + a0.y() + dly * startl_pct, 0); Point3D t1 = Point3D( a0.x() + dlx * endl_pct, - a0.y() + dly * endl_pct, 0); + a0.y() + dly * endl_pct, 0); dlx = a3.x() - a2.x(); dly = a3.y() - a2.y(); Point3D t2 = Point3D( a2.x() + dlx * startl_pct, - a2.y() + dly * startl_pct, 0); + a2.y() + dly * startl_pct, 0); Point3D t3 = Point3D( a2.x() + dlx * endl_pct, - a2.y() + dly * endl_pct, 0); + a2.y() + dly * endl_pct, 0); SG_LOG(SG_GENERAL, SG_DEBUG, "start wid % = " << startw_pct - << " end wid % = " << endw_pct); + << " end wid % = " << endw_pct); double dwx, dwy; @@ -209,19 +234,19 @@ void gen_runway_section( const TGRunway& rwy_info, dwy = t0.y() - t2.y(); Point3D p0 = Point3D( t2.x() + dwx * startw_pct, - t2.y() + dwy * startw_pct, 0); + t2.y() + dwy * startw_pct, 0); Point3D p1 = Point3D( t2.x() + dwx * endw_pct, - t2.y() + dwy * endw_pct, 0); + t2.y() + dwy * endw_pct, 0); dwx = t1.x() - t3.x(); dwy = t1.y() - t3.y(); Point3D p2 = Point3D( t3.x() + dwx * startw_pct, - t3.y() + dwy * startw_pct, 0); + t3.y() + dwy * startw_pct, 0); Point3D p3 = Point3D( t3.x() + dwx * endw_pct, - t3.y() + dwy * endw_pct, 0); + t3.y() + dwy * endw_pct, 0); TGPolygon section; section.erase(); @@ -234,12 +259,12 @@ void gen_runway_section( const TGRunway& rwy_info, // print runway points SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << prefix << material); for ( j = 0; j < section.contours(); ++j ) { - for ( k = 0; k < section.contour_size( j ); ++k ) { - Point3D p = section.get_pt(j, k); - SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p); - } + for ( k = 0; k < section.contour_size( j ); ++k ) { + Point3D p = section.get_pt(j, k); + SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p); + } } - + // Clip the new polygon against what ever has already been created. TGPolygon clipped = tgPolygonDiff( section, *accum ); @@ -290,9 +315,9 @@ void gen_runway_section( const TGRunway& rwy_info, // print runway points SG_LOG(SG_GENERAL, SG_DEBUG, "clipped runway pts " << prefix + material); for ( j = 0; j < clipped.contours(); ++j ) { - for ( k = 0; k < clipped.contour_size( j ); ++k ) { - Point3D p = clipped.get_pt(j, k); - SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p); - } + for ( k = 0; k < clipped.contour_size( j ); ++k ) { + Point3D p = clipped.get_pt(j, k); + SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p); + } } }
------------------------------------------------------------------------------ This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel