Rename: FGPolygon to TGPolygon
This commit is contained in:
parent
7709953518
commit
bd1b254506
51 changed files with 334 additions and 334 deletions
|
@ -80,12 +80,12 @@ SG_USING_STD(string);
|
|||
// texturing parameters. Returns a mirror polygon to the runway,
|
||||
// except each point is the texture coordinate of the corresponding
|
||||
// point in the original polygon.
|
||||
static FGPolygon rwy_section_tex_coords( const FGPolygon& in_poly,
|
||||
static TGPolygon rwy_section_tex_coords( const TGPolygon& in_poly,
|
||||
const FGTexParams& tp,
|
||||
const bool clip_result )
|
||||
{
|
||||
int i, j;
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
result.erase();
|
||||
// double length = rwy.length * SG_FEET_TO_METER;
|
||||
// double width = rwy.width * SG_FEET_TO_METER;
|
||||
|
@ -266,9 +266,9 @@ static void build_runway( const FGRunway& rwy_info,
|
|||
double alt_m,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum,
|
||||
FGPolygon *apt_base,
|
||||
FGPolygon *apt_clearing )
|
||||
TGPolygon *accum,
|
||||
TGPolygon *apt_base,
|
||||
TGPolygon *apt_clearing )
|
||||
{
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "surface flags = " << rwy_info.surface_flags);
|
||||
string surface_flag = rwy_info.surface_flags.substr(1, 1);
|
||||
|
@ -343,14 +343,14 @@ static void build_runway( const FGRunway& rwy_info,
|
|||
throw sg_exception("Unknown runway code in build.cxx:build_airport()");
|
||||
}
|
||||
|
||||
FGPolygon base;
|
||||
TGPolygon base;
|
||||
if ( rwy_info.really_taxiway ) {
|
||||
base = gen_runway_area_w_extend( rwy_info, 10, 10 );
|
||||
} else {
|
||||
base = gen_runway_area_w_extend( rwy_info, 20, 20 );
|
||||
|
||||
// also clear a safe area around the runway
|
||||
FGPolygon safe_base = gen_runway_area_w_extend( rwy_info, 300, 120 );
|
||||
TGPolygon safe_base = gen_runway_area_w_extend( rwy_info, 300, 120 );
|
||||
*apt_clearing = polygon_union(safe_base, *apt_clearing);
|
||||
}
|
||||
|
||||
|
@ -370,13 +370,13 @@ void build_airport( string airport_raw, float alt_m,
|
|||
texparams_list texparams;
|
||||
|
||||
// poly_list rwy_tris, rwy_txs;
|
||||
FGPolygon runway, runway_a, runway_b, clipped_a, clipped_b;
|
||||
FGPolygon split_a, split_b;
|
||||
FGPolygon apt_base;
|
||||
FGPolygon apt_clearing;
|
||||
TGPolygon runway, runway_a, runway_b, clipped_a, clipped_b;
|
||||
TGPolygon split_a, split_b;
|
||||
TGPolygon apt_base;
|
||||
TGPolygon apt_clearing;
|
||||
Point3D p;
|
||||
|
||||
FGPolygon accum;
|
||||
TGPolygon accum;
|
||||
accum.erase();
|
||||
|
||||
// parse main airport information
|
||||
|
@ -614,20 +614,20 @@ void build_airport( string airport_raw, float alt_m,
|
|||
}
|
||||
|
||||
// generate convex hull (no longer)
|
||||
// FGPolygon hull = convex_hull(apt_pts);
|
||||
// TGPolygon hull = convex_hull(apt_pts);
|
||||
|
||||
FGPolygon filled_base = strip_out_holes( apt_base );
|
||||
TGPolygon filled_base = strip_out_holes( apt_base );
|
||||
// write_polygon( filled_base, "filled-base" );
|
||||
FGPolygon divided_base = split_long_edges( filled_base, 200.0 );
|
||||
TGPolygon divided_base = split_long_edges( filled_base, 200.0 );
|
||||
// write_polygon( divided_base, "divided-base" );
|
||||
FGPolygon base_poly = polygon_diff( divided_base, accum );
|
||||
TGPolygon base_poly = polygon_diff( divided_base, accum );
|
||||
// write_polygon( base_poly, "base-raw" );
|
||||
|
||||
// Try to remove duplicated nodes and other degeneracies
|
||||
for ( k = 0; k < (int)rwy_polys.size(); ++k ) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "add nodes/remove dups section = " << k
|
||||
<< " " << rwy_polys[k].get_material());
|
||||
FGPolygon poly = rwy_polys[k].get_poly();
|
||||
TGPolygon poly = rwy_polys[k].get_poly();
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "total size before = " << poly.total_size());
|
||||
for ( i = 0; i < poly.contours(); ++i ) {
|
||||
for ( j = 0; j < poly.contour_size(i); ++j ) {
|
||||
|
@ -667,7 +667,7 @@ void build_airport( string airport_raw, float alt_m,
|
|||
|
||||
// build temporary node list
|
||||
for ( k = 0; k < (int)rwy_polys.size(); ++k ) {
|
||||
FGPolygon poly = rwy_polys[k].get_poly();
|
||||
TGPolygon poly = rwy_polys[k].get_poly();
|
||||
for ( i = 0; i < poly.contours(); ++i ) {
|
||||
for ( j = 0; j < poly.contour_size( i ); ++j ) {
|
||||
tmp_nodes.unique_add( poly.get_pt(i, j) );
|
||||
|
@ -716,7 +716,7 @@ void build_airport( string airport_raw, float alt_m,
|
|||
#endif
|
||||
|
||||
for ( k = 0; k < (int)rwy_polys.size(); ++k ) {
|
||||
FGPolygon poly = rwy_polys[k].get_poly();
|
||||
TGPolygon poly = rwy_polys[k].get_poly();
|
||||
poly = add_nodes_to_poly( poly, tmp_nodes );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "total size after add nodes = " << poly.total_size());
|
||||
|
||||
|
@ -731,7 +731,7 @@ void build_airport( string airport_raw, float alt_m,
|
|||
|
||||
// One more pass to try to get rid of other yukky stuff
|
||||
for ( k = 0; k < (int)rwy_polys.size(); ++k ) {
|
||||
FGPolygon poly = rwy_polys[k].get_poly();
|
||||
TGPolygon poly = rwy_polys[k].get_poly();
|
||||
|
||||
poly = remove_dups( poly );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "total size after remove_dups() = " << poly.total_size());
|
||||
|
@ -755,12 +755,12 @@ void build_airport( string airport_raw, float alt_m,
|
|||
for ( i = 0; i < (int)rwy_polys.size(); ++i ) {
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Tesselating section = " << i);
|
||||
|
||||
FGPolygon poly = rwy_polys[i].get_poly();
|
||||
TGPolygon poly = rwy_polys[i].get_poly();
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "total size before = " << poly.total_size());
|
||||
FGPolygon tri = polygon_tesselate_alt( poly );
|
||||
TGPolygon tri = polygon_tesselate_alt( poly );
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "total size after = " << tri.total_size());
|
||||
|
||||
FGPolygon tc;
|
||||
TGPolygon tc;
|
||||
if ( rwy_polys[i].get_flag() == "taxi" ) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "taxiway, no clip");
|
||||
tc = rwy_section_tex_coords( tri, texparams[i], false );
|
||||
|
@ -774,7 +774,7 @@ void build_airport( string airport_raw, float alt_m,
|
|||
}
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Tesselating base");
|
||||
FGPolygon base_tris = polygon_tesselate_alt( base_poly );
|
||||
TGPolygon base_tris = polygon_tesselate_alt( base_poly );
|
||||
|
||||
#if 0
|
||||
// dump more debugging output
|
||||
|
@ -851,9 +851,9 @@ void build_airport( string airport_raw, float alt_m,
|
|||
|
||||
for ( k = 0; k < (int)rwy_polys.size(); ++k ) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "tri " << k);
|
||||
// FGPolygon tri_poly = rwy_tris[k];
|
||||
FGPolygon tri_poly = rwy_polys[k].get_tris();
|
||||
FGPolygon tri_txs = rwy_polys[k].get_texcoords();
|
||||
// TGPolygon tri_poly = rwy_tris[k];
|
||||
TGPolygon tri_poly = rwy_polys[k].get_tris();
|
||||
TGPolygon tri_txs = rwy_polys[k].get_texcoords();
|
||||
string material = rwy_polys[k].get_material();
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "material = " << material);
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "poly size = " << tri_poly.contours());
|
||||
|
@ -1034,7 +1034,7 @@ void build_airport( string airport_raw, float alt_m,
|
|||
|
||||
point_list geod_light_nodes
|
||||
= calc_elevations( root, light_nodes.get_node_list(), 0.5 );
|
||||
FGPolygon p;
|
||||
TGPolygon p;
|
||||
p.add_contour( geod_light_nodes, 0 );
|
||||
FGSuperPoly s;
|
||||
s.set_poly( p );
|
||||
|
|
|
@ -103,7 +103,7 @@ bool test_point(Point3D Pa, Point3D Pb, Point3D Pc) {
|
|||
// calculate the convex hull of a set of points, return as a list of
|
||||
// point2d. The algorithm description can be found at:
|
||||
// http://riot.ieor.berkeley.edu/riot/Applications/ConvexHull/CHDetails.html
|
||||
FGPolygon convex_hull( const point_list& input_list ) {
|
||||
TGPolygon convex_hull( const point_list& input_list ) {
|
||||
int i;
|
||||
|
||||
map_iterator map_current, map_next, map_next_next, map_last;
|
||||
|
@ -115,7 +115,7 @@ FGPolygon convex_hull( const point_list& input_list ) {
|
|||
map_container radians_map;
|
||||
|
||||
// will contain the convex hull
|
||||
FGPolygon con_hull;
|
||||
TGPolygon con_hull;
|
||||
|
||||
Point3D p, Pa, Pb, Pc, result;
|
||||
double sum_x, sum_y;
|
||||
|
|
|
@ -43,7 +43,7 @@ using namespace std;
|
|||
// calculate the convex hull of a set of points, return as a list of
|
||||
// point2d. The algorithm description can be found at:
|
||||
// http://riot.ieor.berkeley.edu/riot/Applications/ConvexHull/CHDetails.html
|
||||
FGPolygon convex_hull( const point_list& input_list );
|
||||
TGPolygon convex_hull( const point_list& input_list );
|
||||
|
||||
|
||||
#endif // _CONVEX_HULL_HXX
|
||||
|
|
|
@ -40,7 +40,7 @@ static Point3D gen_runway_light_vector( const FGRunway& rwy_info,
|
|||
double length;
|
||||
|
||||
// Generate the 4 corners of the runway
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
point_list corner;
|
||||
for ( int i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
corner.push_back( poly_corners.get_pt( 0, i ) );
|
||||
|
@ -93,9 +93,9 @@ static superpoly_list gen_runway_edge_lights( const FGRunway& rwy_info,
|
|||
|
||||
Point3D normal = gen_runway_light_vector( rwy_info, 3.0, recip );
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -143,8 +143,8 @@ static superpoly_list gen_runway_edge_lights( const FGRunway& rwy_info,
|
|||
dist -= step;
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( w_lights, false );
|
||||
normals_poly.add_contour( w_normals, false );
|
||||
|
||||
|
@ -203,9 +203,9 @@ static superpoly_list gen_taxiway_edge_lights( const FGRunway& rwy_info,
|
|||
divs = (int)(len / 35.0) + 1;
|
||||
}
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -249,8 +249,8 @@ static superpoly_list gen_taxiway_edge_lights( const FGRunway& rwy_info,
|
|||
b_normals.push_back( up );
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( b_lights, false );
|
||||
normals_poly.add_contour( b_normals, false );
|
||||
|
||||
|
@ -280,9 +280,9 @@ static superpoly_list gen_runway_threshold_lights( const FGRunway& rwy_info,
|
|||
|
||||
cout << "gen threshold " << rwy_info.rwy_no << endl;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -346,8 +346,8 @@ static superpoly_list gen_runway_threshold_lights( const FGRunway& rwy_info,
|
|||
ref2 = Point3D( lon, lat, 0.0 );
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( g_lights, false );
|
||||
normals_poly.add_contour( g_normals, false );
|
||||
|
||||
|
@ -412,9 +412,9 @@ static superpoly_list gen_runway_center_line_lights( const FGRunway& rwy_info,
|
|||
|
||||
Point3D normal = gen_runway_light_vector( rwy_info, 3.0, recip );
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -465,8 +465,8 @@ static superpoly_list gen_runway_center_line_lights( const FGRunway& rwy_info,
|
|||
superpoly_list result; result.clear();
|
||||
|
||||
if ( w_lights.size() > 0 ) {
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( w_lights, false );
|
||||
normals_poly.add_contour( w_normals, false );
|
||||
|
||||
|
@ -479,8 +479,8 @@ static superpoly_list gen_runway_center_line_lights( const FGRunway& rwy_info,
|
|||
}
|
||||
|
||||
if ( r_lights.size() > 0 ) {
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( r_lights, false );
|
||||
normals_poly.add_contour( r_normals, false );
|
||||
|
||||
|
@ -508,9 +508,9 @@ static FGSuperPoly gen_touchdown_zone_lights( const FGRunway& rwy_info,
|
|||
|
||||
Point3D normal;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -585,8 +585,8 @@ static FGSuperPoly gen_touchdown_zone_lights( const FGRunway& rwy_info,
|
|||
normals.push_back( normal );
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( lights, false );
|
||||
normals_poly.add_contour( normals, false );
|
||||
|
||||
|
@ -612,9 +612,9 @@ static FGSuperPoly gen_vasi( const FGRunway& rwy_info, float alt_m,
|
|||
|
||||
Point3D normal;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -724,8 +724,8 @@ static FGSuperPoly gen_vasi( const FGRunway& rwy_info, float alt_m,
|
|||
lights.push_back( pt1 );
|
||||
normals.push_back( normal );
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( lights, false );
|
||||
normals_poly.add_contour( normals, false );
|
||||
|
||||
|
@ -753,9 +753,9 @@ static FGSuperPoly gen_papi( const FGRunway& rwy_info, float alt_m,
|
|||
|
||||
Point3D normal;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -820,8 +820,8 @@ static FGSuperPoly gen_papi( const FGRunway& rwy_info, float alt_m,
|
|||
normal = gen_runway_light_vector( rwy_info, 2.5, recip );
|
||||
normals.push_back( normal );
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( lights, false );
|
||||
normals_poly.add_contour( normals, false );
|
||||
|
||||
|
@ -849,9 +849,9 @@ static FGSuperPoly gen_reil( const FGRunway& rwy_info, float alt_m,
|
|||
|
||||
Point3D normal;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -905,8 +905,8 @@ static FGSuperPoly gen_reil( const FGRunway& rwy_info, float alt_m,
|
|||
normal = gen_runway_light_vector( rwy_info, 10, recip );
|
||||
normals.push_back( normal );
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( lights, false );
|
||||
normals_poly.add_contour( normals, false );
|
||||
|
||||
|
@ -946,9 +946,9 @@ static superpoly_list gen_alsf( const FGRunway& rwy_info,
|
|||
double len = rwy_info.length * SG_FEET_TO_METER;
|
||||
int divs = (int)(len / 10.0) + 1;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -1376,8 +1376,8 @@ static superpoly_list gen_alsf( const FGRunway& rwy_info,
|
|||
}
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( g_lights, false );
|
||||
normals_poly.add_contour( g_normals, false );
|
||||
|
||||
|
@ -1449,9 +1449,9 @@ static FGSuperPoly gen_odals( const FGRunway& rwy_info, float alt_m,
|
|||
// a placeholder to keep everything happy.
|
||||
Point3D normal( 0.0, 0.0, 0.0 );
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 0.0, 0.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -1514,8 +1514,8 @@ static FGSuperPoly gen_odals( const FGRunway& rwy_info, float alt_m,
|
|||
normals.push_back( normal );
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( lights, false );
|
||||
normals_poly.add_contour( normals, false );
|
||||
|
||||
|
@ -1556,9 +1556,9 @@ static superpoly_list gen_ssalx( const FGRunway& rwy_info,
|
|||
double len = rwy_info.length * SG_FEET_TO_METER;
|
||||
int divs = (int)(len / 10.0) + 1;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -1738,8 +1738,8 @@ static superpoly_list gen_ssalx( const FGRunway& rwy_info,
|
|||
}
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( g_lights, false );
|
||||
normals_poly.add_contour( g_normals, false );
|
||||
|
||||
|
@ -1822,9 +1822,9 @@ static superpoly_list gen_malsx( const FGRunway& rwy_info,
|
|||
double len = rwy_info.length * SG_FEET_TO_METER;
|
||||
int divs = (int)(len / 10.0) + 1;
|
||||
|
||||
// using FGPolygon is a bit innefficient, but that's what the
|
||||
// using TGPolygon is a bit innefficient, but that's what the
|
||||
// routine returns.
|
||||
FGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
TGPolygon poly_corners = gen_runway_area_w_extend( rwy_info, 2.0, 2.0 );
|
||||
|
||||
point_list corner;
|
||||
for ( i = 0; i < poly_corners.contour_size( 0 ); ++i ) {
|
||||
|
@ -2004,8 +2004,8 @@ static superpoly_list gen_malsx( const FGRunway& rwy_info,
|
|||
}
|
||||
}
|
||||
|
||||
FGPolygon lights_poly; lights_poly.erase();
|
||||
FGPolygon normals_poly; normals_poly.erase();
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
TGPolygon normals_poly; normals_poly.erase();
|
||||
lights_poly.add_contour( g_lights, false );
|
||||
normals_poly.add_contour( g_normals, false );
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
// new polygon
|
||||
void add_intermediate_nodes( int contour, const Point3D& start,
|
||||
const Point3D& end, const TGTriNodes& tmp_nodes,
|
||||
FGPolygon *result )
|
||||
TGPolygon *result )
|
||||
{
|
||||
point_list nodes = tmp_nodes.get_node_list();
|
||||
|
||||
|
@ -69,10 +69,10 @@ void add_intermediate_nodes( int contour, const Point3D& start,
|
|||
// created elsewhere that lie on the segment and split it there to
|
||||
// avoid "T" intersections.
|
||||
|
||||
FGPolygon add_nodes_to_poly( const FGPolygon& poly,
|
||||
TGPolygon add_nodes_to_poly( const TGPolygon& poly,
|
||||
const TGTriNodes& tmp_nodes ) {
|
||||
int i, j;
|
||||
FGPolygon result; result.erase();
|
||||
TGPolygon result; result.erase();
|
||||
Point3D p0, p1;
|
||||
|
||||
// SG_LOG(SG_GENERAL, SG_DEBUG, "add_nodes_to_poly");
|
||||
|
@ -115,8 +115,8 @@ FGPolygon add_nodes_to_poly( const FGPolygon& poly,
|
|||
|
||||
// Traverse a polygon and split edges until they are less than max_len
|
||||
// (specified in meters)
|
||||
FGPolygon split_long_edges( const FGPolygon &poly, double max_len ) {
|
||||
FGPolygon result;
|
||||
TGPolygon split_long_edges( const TGPolygon &poly, double max_len ) {
|
||||
TGPolygon result;
|
||||
Point3D p0, p1;
|
||||
int i, j, k;
|
||||
|
||||
|
@ -188,8 +188,8 @@ FGPolygon split_long_edges( const FGPolygon &poly, double max_len ) {
|
|||
|
||||
|
||||
// Traverse a polygon and toss all the internal holes
|
||||
FGPolygon strip_out_holes( const FGPolygon &poly ) {
|
||||
FGPolygon result; result.erase();
|
||||
TGPolygon strip_out_holes( const TGPolygon &poly ) {
|
||||
TGPolygon result; result.erase();
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "strip_out_holes()");
|
||||
|
||||
|
|
|
@ -36,24 +36,24 @@
|
|||
// new polygon
|
||||
void add_intermediate_nodes( int contour, const Point3D& start,
|
||||
const Point3D& end, const TGTriNodes& tmp_nodes,
|
||||
FGPolygon *result );
|
||||
TGPolygon *result );
|
||||
|
||||
|
||||
// Search each segment for additional vertex points that may have been
|
||||
// created elsewhere that lie on the segment and split it there to
|
||||
// avoid "T" intersections.
|
||||
|
||||
FGPolygon add_nodes_to_poly( const FGPolygon& poly,
|
||||
const TGTriNodes& tmp_nodes );
|
||||
TGPolygon add_nodes_to_poly( const TGPolygon& poly,
|
||||
const TGTriNodes& tmp_nodes );
|
||||
|
||||
|
||||
// Traverse a polygon and split edges until they are less than max_len
|
||||
// (specified in meters)
|
||||
FGPolygon split_long_edges( const FGPolygon &poly, double max_len );
|
||||
TGPolygon split_long_edges( const TGPolygon &poly, double max_len );
|
||||
|
||||
|
||||
// Traverse a polygon and toss all the internal holes
|
||||
FGPolygon strip_out_holes( const FGPolygon &poly );
|
||||
TGPolygon strip_out_holes( const TGPolygon &poly );
|
||||
|
||||
|
||||
#endif // _POLY_EXTRA_HXX
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
// given a runway center point, length, width, and heading, and
|
||||
// altitude (meters) generate the lon and lat 4 corners using wgs84
|
||||
// math.
|
||||
FGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m,
|
||||
TGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m,
|
||||
double heading_deg, double alt_m, bool add_mid )
|
||||
{
|
||||
FGPolygon result_list;
|
||||
TGPolygon result_list;
|
||||
double length_hdg = heading_deg;
|
||||
double left_hdg = length_hdg - 90.0;
|
||||
if ( left_hdg < 0 ) { left_hdg += 360.0; }
|
||||
|
@ -108,12 +108,12 @@ FGPolygon gen_wgs84_area( Point3D origin, double length_m, double width_m,
|
|||
|
||||
// generate an area for a runway with expantion specified as a scale
|
||||
// factor (return result points in degrees)
|
||||
FGPolygon gen_runway_area_w_scale( const FGRunway& runway,
|
||||
TGPolygon gen_runway_area_w_scale( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_scale,
|
||||
double width_scale ) {
|
||||
|
||||
FGPolygon result_list;
|
||||
TGPolygon result_list;
|
||||
Point3D origin(runway.lon, runway.lat, 0);
|
||||
|
||||
result_list = gen_wgs84_area( origin,
|
||||
|
@ -133,12 +133,12 @@ FGPolygon gen_runway_area_w_scale( const FGRunway& runway,
|
|||
|
||||
// generate an area for a runway with expansion specified in meters
|
||||
// (return result points in degrees)
|
||||
FGPolygon gen_runway_area_w_extend( const FGRunway& runway,
|
||||
TGPolygon gen_runway_area_w_extend( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_extend,
|
||||
double wid_extend ) {
|
||||
|
||||
FGPolygon result_list;
|
||||
TGPolygon result_list;
|
||||
Point3D origin(runway.lon, runway.lat, 0);
|
||||
|
||||
result_list
|
||||
|
@ -158,11 +158,11 @@ FGPolygon gen_runway_area_w_extend( const FGRunway& runway,
|
|||
|
||||
|
||||
// generate an area for a runway and include midpoints
|
||||
FGPolygon gen_runway_w_mid( const FGRunway& runway,
|
||||
TGPolygon gen_runway_w_mid( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_extend_m,
|
||||
double wid_extend_m ) {
|
||||
FGPolygon result_list;
|
||||
TGPolygon result_list;
|
||||
Point3D origin(runway.lon, runway.lat, 0);
|
||||
|
||||
result_list = gen_wgs84_area( origin,
|
||||
|
|
|
@ -51,12 +51,12 @@ struct FGRunway {
|
|||
string end1_flags;
|
||||
string end2_flags;
|
||||
|
||||
FGPolygon threshold;
|
||||
FGPolygon tens, tens_margin, ones, ones_margin;
|
||||
FGPolygon letter, letter_margin_left, letter_margin_right;
|
||||
FGPolygon pre_td_zone;
|
||||
FGPolygon td3_zone, td2_zone, td1a_zone, td1b_zone;
|
||||
FGPolygon aim_point;
|
||||
TGPolygon threshold;
|
||||
TGPolygon tens, tens_margin, ones, ones_margin;
|
||||
TGPolygon letter, letter_margin_left, letter_margin_right;
|
||||
TGPolygon pre_td_zone;
|
||||
TGPolygon td3_zone, td2_zone, td1a_zone, td1b_zone;
|
||||
TGPolygon aim_point;
|
||||
|
||||
bool really_taxiway;
|
||||
bool generated;};
|
||||
|
@ -69,21 +69,21 @@ typedef runway_list::const_iterator const_runway_list_iterator;
|
|||
|
||||
// generate an area for a runway with expantion specified as a scale
|
||||
// factor (return result points in degrees)
|
||||
FGPolygon gen_runway_area_w_scale( const FGRunway& runway,
|
||||
TGPolygon gen_runway_area_w_scale( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_scale = 1.0,
|
||||
double width_scale = 1.0 );
|
||||
|
||||
// generate an area for a runway with expansion specified in meters
|
||||
// (return result points in degrees)
|
||||
FGPolygon gen_runway_area_w_extend( const FGRunway& runway,
|
||||
TGPolygon gen_runway_area_w_extend( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_extend = 0.0,
|
||||
double wid_extend = 0.0 );
|
||||
|
||||
|
||||
// generate an area for half a runway
|
||||
FGPolygon gen_runway_w_mid( const FGRunway& runway,
|
||||
TGPolygon gen_runway_w_mid( const FGRunway& runway,
|
||||
double alt_m,
|
||||
double len_extend_m = 0.0,
|
||||
double wid_extend_m = 0.0 );
|
||||
|
|
|
@ -32,11 +32,11 @@
|
|||
|
||||
void gen_number_block( const FGRunway& rwy_info,
|
||||
const string& material,
|
||||
FGPolygon poly, double heading, int num,
|
||||
TGPolygon poly, double heading, int num,
|
||||
double start_pct, double end_pct,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
char tex1[32]; tex1[0] = '\0';
|
||||
char tex2[32]; tex2[0] = '\0';
|
||||
|
@ -93,7 +93,7 @@ void gen_number_block( const FGRunway& rwy_info,
|
|||
|
||||
// generate a section of runway
|
||||
void gen_runway_section( const FGRunway& rwy_info,
|
||||
const FGPolygon& runway,
|
||||
const TGPolygon& runway,
|
||||
double startl_pct, double endl_pct,
|
||||
double startw_pct, double endw_pct,
|
||||
double heading,
|
||||
|
@ -101,7 +101,7 @@ void gen_runway_section( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum ) {
|
||||
TGPolygon *accum ) {
|
||||
|
||||
int j, k;
|
||||
|
||||
|
@ -180,7 +180,7 @@ void gen_runway_section( const FGRunway& rwy_info,
|
|||
Point3D p3 = Point3D( t3.x() + dwx * endw_pct,
|
||||
t3.y() + dwy * endw_pct, 0);
|
||||
|
||||
FGPolygon section;
|
||||
TGPolygon section;
|
||||
section.erase();
|
||||
|
||||
section.add_node( 0, p2 );
|
||||
|
@ -198,11 +198,11 @@ void gen_runway_section( const FGRunway& rwy_info,
|
|||
}
|
||||
|
||||
// Clip the new polygon against what ever has already been created.
|
||||
FGPolygon clipped = polygon_diff( section, *accum );
|
||||
TGPolygon clipped = polygon_diff( section, *accum );
|
||||
|
||||
// Split long edges to create an object that can better flow with
|
||||
// the surface terrain
|
||||
FGPolygon split = split_long_edges( clipped, 400.0 );
|
||||
TGPolygon split = split_long_edges( clipped, 400.0 );
|
||||
|
||||
// Create the final output and push on to the runway super_polygon
|
||||
// list
|
||||
|
|
|
@ -35,15 +35,15 @@
|
|||
|
||||
void gen_number_block( const FGRunway& rwy_info,
|
||||
const string& material,
|
||||
FGPolygon poly, double heading, int num,
|
||||
TGPolygon poly, double heading, int num,
|
||||
double start_pct, double end_pct,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
// generate a section of runway
|
||||
void gen_runway_section( const FGRunway& rwy_info,
|
||||
const FGPolygon& runway,
|
||||
const TGPolygon& runway,
|
||||
double startl_pct, double endl_pct,
|
||||
double startw_pct, double endw_pct,
|
||||
double heading,
|
||||
|
@ -51,7 +51,7 @@ void gen_runway_section( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_COMMON_HXX
|
||||
|
|
|
@ -39,7 +39,7 @@ void gen_non_precision_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -47,12 +47,12 @@ void gen_non_precision_rwy( const FGRunway& rwy_info,
|
|||
// Generate the basic runway outlines
|
||||
//
|
||||
|
||||
FGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
2 * SG_FEET_TO_METER,
|
||||
2 * SG_FEET_TO_METER );
|
||||
|
||||
// runway half "a"
|
||||
FGPolygon runway_a;
|
||||
TGPolygon runway_a;
|
||||
runway_a.erase();
|
||||
runway_a.add_node( 0, runway.get_pt(0, 0) );
|
||||
runway_a.add_node( 0, runway.get_pt(0, 1) );
|
||||
|
@ -60,7 +60,7 @@ void gen_non_precision_rwy( const FGRunway& rwy_info,
|
|||
runway_a.add_node( 0, runway.get_pt(0, 5) );
|
||||
|
||||
// runway half "b"
|
||||
FGPolygon runway_b;
|
||||
TGPolygon runway_b;
|
||||
runway_b.erase();
|
||||
runway_b.add_node( 0, runway.get_pt(0, 3) );
|
||||
runway_b.add_node( 0, runway.get_pt(0, 4) );
|
||||
|
|
|
@ -43,7 +43,7 @@ void gen_non_precision_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_NONPREC_HXX
|
||||
|
|
|
@ -39,7 +39,7 @@ void gen_precision_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
|
||||
//
|
||||
|
@ -48,12 +48,12 @@ void gen_precision_rwy( const FGRunway& rwy_info,
|
|||
|
||||
int i, j;
|
||||
|
||||
FGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
2 * SG_FEET_TO_METER,
|
||||
2 * SG_FEET_TO_METER );
|
||||
|
||||
// runway half "a"
|
||||
FGPolygon runway_a;
|
||||
TGPolygon runway_a;
|
||||
runway_a.erase();
|
||||
runway_a.add_node( 0, runway.get_pt(0, 0) );
|
||||
runway_a.add_node( 0, runway.get_pt(0, 1) );
|
||||
|
@ -62,7 +62,7 @@ void gen_precision_rwy( const FGRunway& rwy_info,
|
|||
|
||||
|
||||
// runway half "b"
|
||||
FGPolygon runway_b;
|
||||
TGPolygon runway_b;
|
||||
runway_b.erase();
|
||||
runway_b.add_node( 0, runway.get_pt(0, 3) );
|
||||
runway_b.add_node( 0, runway.get_pt(0, 4) );
|
||||
|
|
|
@ -43,7 +43,7 @@ void gen_precision_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_PREC_HXX
|
||||
|
|
|
@ -39,14 +39,14 @@ void gen_simple_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
int j, k;
|
||||
|
||||
FGPolygon runway = gen_runway_w_mid( rwy_info, alt_m );
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m );
|
||||
|
||||
// runway half "a"
|
||||
FGPolygon runway_a;
|
||||
TGPolygon runway_a;
|
||||
runway_a.erase();
|
||||
runway_a.add_node( 0, runway.get_pt(0, 0) );
|
||||
runway_a.add_node( 0, runway.get_pt(0, 1) );
|
||||
|
@ -54,7 +54,7 @@ void gen_simple_rwy( const FGRunway& rwy_info,
|
|||
runway_a.add_node( 0, runway.get_pt(0, 5) );
|
||||
|
||||
// runway half "b"
|
||||
FGPolygon runway_b;
|
||||
TGPolygon runway_b;
|
||||
runway_b.erase();
|
||||
runway_b.add_node( 0, runway.get_pt(0, 5) );
|
||||
runway_b.add_node( 0, runway.get_pt(0, 2) );
|
||||
|
@ -76,8 +76,8 @@ void gen_simple_rwy( const FGRunway& rwy_info,
|
|||
FGSuperPoly sp;
|
||||
FGTexParams tp;
|
||||
|
||||
FGPolygon clipped_a = polygon_diff( runway_a, *accum );
|
||||
FGPolygon split_a = split_long_edges( clipped_a, 400.0 );
|
||||
TGPolygon clipped_a = polygon_diff( runway_a, *accum );
|
||||
TGPolygon split_a = split_long_edges( clipped_a, 400.0 );
|
||||
sp.erase();
|
||||
sp.set_poly( split_a );
|
||||
sp.set_material( material );
|
||||
|
@ -90,8 +90,8 @@ void gen_simple_rwy( const FGRunway& rwy_info,
|
|||
rwy_info.heading );
|
||||
texparams->push_back( tp );
|
||||
|
||||
FGPolygon clipped_b = polygon_diff( runway_b, *accum );
|
||||
FGPolygon split_b = split_long_edges( clipped_b, 400.0 );
|
||||
TGPolygon clipped_b = polygon_diff( runway_b, *accum );
|
||||
TGPolygon split_b = split_long_edges( clipped_b, 400.0 );
|
||||
sp.erase();
|
||||
sp.set_poly( split_b );
|
||||
sp.set_material( material );
|
||||
|
|
|
@ -40,7 +40,7 @@ void gen_simple_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_SIMPLE_HXX
|
||||
|
|
|
@ -40,7 +40,7 @@ void gen_visual_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
@ -48,12 +48,12 @@ void gen_visual_rwy( const FGRunway& rwy_info,
|
|||
// Generate the basic runway outlines
|
||||
//
|
||||
|
||||
FGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
2 * SG_FEET_TO_METER,
|
||||
2 * SG_FEET_TO_METER );
|
||||
|
||||
// runway half "a"
|
||||
FGPolygon runway_a;
|
||||
TGPolygon runway_a;
|
||||
runway_a.erase();
|
||||
runway_a.add_node( 0, runway.get_pt(0, 0) );
|
||||
runway_a.add_node( 0, runway.get_pt(0, 1) );
|
||||
|
@ -61,7 +61,7 @@ void gen_visual_rwy( const FGRunway& rwy_info,
|
|||
runway_a.add_node( 0, runway.get_pt(0, 5) );
|
||||
|
||||
// runway half "b"
|
||||
FGPolygon runway_b;
|
||||
TGPolygon runway_b;
|
||||
runway_b.erase();
|
||||
runway_b.add_node( 0, runway.get_pt(0, 3) );
|
||||
runway_b.add_node( 0, runway.get_pt(0, 4) );
|
||||
|
|
|
@ -43,7 +43,7 @@ void gen_visual_rwy( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _RWY_VISUAL_HXX
|
||||
|
|
|
@ -39,14 +39,14 @@ void gen_taxiway( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum )
|
||||
TGPolygon *accum )
|
||||
{
|
||||
int j, k;
|
||||
|
||||
FGPolygon runway = gen_runway_w_mid( rwy_info, alt_m );
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m );
|
||||
|
||||
// runway half "a"
|
||||
FGPolygon runway_a;
|
||||
TGPolygon runway_a;
|
||||
runway_a.erase();
|
||||
runway_a.add_node( 0, runway.get_pt(0, 0) );
|
||||
runway_a.add_node( 0, runway.get_pt(0, 1) );
|
||||
|
@ -54,7 +54,7 @@ void gen_taxiway( const FGRunway& rwy_info,
|
|||
runway_a.add_node( 0, runway.get_pt(0, 5) );
|
||||
|
||||
// runway half "b"
|
||||
FGPolygon runway_b;
|
||||
TGPolygon runway_b;
|
||||
runway_b.erase();
|
||||
runway_b.add_node( 0, runway.get_pt(0, 5) );
|
||||
runway_b.add_node( 0, runway.get_pt(0, 2) );
|
||||
|
@ -89,8 +89,8 @@ void gen_taxiway( const FGRunway& rwy_info,
|
|||
twid = 250.0;
|
||||
}
|
||||
|
||||
FGPolygon clipped_a = polygon_diff( runway_a, *accum );
|
||||
FGPolygon split_a = split_long_edges( clipped_a, 400.0 );
|
||||
TGPolygon clipped_a = polygon_diff( runway_a, *accum );
|
||||
TGPolygon split_a = split_long_edges( clipped_a, 400.0 );
|
||||
sp.erase();
|
||||
|
||||
sp.set_poly( split_a );
|
||||
|
@ -105,8 +105,8 @@ void gen_taxiway( const FGRunway& rwy_info,
|
|||
rwy_info.heading );
|
||||
texparams->push_back( tp );
|
||||
|
||||
FGPolygon clipped_b = polygon_diff( runway_b, *accum );
|
||||
FGPolygon split_b = split_long_edges( clipped_b, 400.0 );
|
||||
TGPolygon clipped_b = polygon_diff( runway_b, *accum );
|
||||
TGPolygon split_b = split_long_edges( clipped_b, 400.0 );
|
||||
sp.erase();
|
||||
sp.set_poly( split_b );
|
||||
sp.set_material( material );
|
||||
|
|
|
@ -40,7 +40,7 @@ void gen_taxiway( const FGRunway& rwy_info,
|
|||
const string& material,
|
||||
superpoly_list *rwy_polys,
|
||||
texparams_list *texparams,
|
||||
FGPolygon *accum );
|
||||
TGPolygon *accum );
|
||||
|
||||
|
||||
#endif // _TAXIWAY_HXX
|
||||
|
|
|
@ -80,7 +80,7 @@ bool FGClipper::load_polys(const string& path) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
|
||||
Point3D p;
|
||||
in >> skipcomment;
|
||||
|
@ -170,7 +170,7 @@ bool FGClipper::load_osgb36_polys(const string& path) {
|
|||
// gpc_polygon *poly = new gpc_polygon;
|
||||
// poly->num_contours = 0;
|
||||
// poly->contour = NULL;
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
|
||||
Point3D p;
|
||||
Point3D OSRef;
|
||||
|
@ -274,7 +274,7 @@ bool FGClipper::load_osgb36_polys(const string& path) {
|
|||
}
|
||||
|
||||
// Add a polygon to the clipper.
|
||||
void FGClipper::add_poly( int area, const FGPolygon &poly )
|
||||
void FGClipper::add_poly( int area, const TGPolygon &poly )
|
||||
{
|
||||
if ( area < FG_MAX_AREA_TYPES ) {
|
||||
polys_in.polys[area].push_back(poly);
|
||||
|
@ -287,7 +287,7 @@ void FGClipper::add_poly( int area, const FGPolygon &poly )
|
|||
|
||||
|
||||
// Move slivers from in polygon to out polygon.
|
||||
void FGClipper::move_slivers( FGPolygon& in, FGPolygon& out ) {
|
||||
void FGClipper::move_slivers( TGPolygon& in, TGPolygon& out ) {
|
||||
// traverse each contour of the polygon and attempt to identify
|
||||
// likely slivers
|
||||
|
||||
|
@ -348,8 +348,8 @@ void FGClipper::move_slivers( FGPolygon& in, FGPolygon& out ) {
|
|||
// a polygon with no increased contours (i.e. the sliver is adjacent
|
||||
// and can be merged.) If so, replace the clipped polygon with the
|
||||
// new polygon that has the sliver merged in.
|
||||
void FGClipper::merge_slivers( FGPolyList& clipped, FGPolygon& slivers ) {
|
||||
FGPolygon poly, result, sliver;
|
||||
void FGClipper::merge_slivers( FGPolyList& clipped, TGPolygon& slivers ) {
|
||||
TGPolygon poly, result, sliver;
|
||||
point_list contour;
|
||||
int original_contours, result_contours;
|
||||
bool done;
|
||||
|
@ -440,8 +440,8 @@ is_water_area (AreaType type)
|
|||
// Clip all the polygons against each other in a priority scheme based
|
||||
// on order of the polygon type in the polygon type enum.
|
||||
bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
||||
FGPolygon accum, tmp;
|
||||
FGPolygon slivers, remains;
|
||||
TGPolygon accum, tmp;
|
||||
TGPolygon slivers, remains;
|
||||
int i, j;
|
||||
|
||||
// gpcpoly_iterator current, last;
|
||||
|
@ -464,7 +464,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
// best representation of land vs. ocean. If we have other less
|
||||
// accurate data that spills out into the ocean, we want to just
|
||||
// clip it.
|
||||
FGPolygon land_mask;
|
||||
TGPolygon land_mask;
|
||||
land_mask.erase();
|
||||
for ( i = 0; i < (int)polys_in.polys[DefaultArea].size(); ++i ) {
|
||||
land_mask =
|
||||
|
@ -472,11 +472,11 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
}
|
||||
|
||||
// set up a mask for inland water.
|
||||
FGPolygon inland_water_mask;
|
||||
TGPolygon inland_water_mask;
|
||||
inland_water_mask.erase();
|
||||
for ( i = 0; i < FG_MAX_AREA_TYPES; i++ ) {
|
||||
if (is_water_area(AreaType(i))) {
|
||||
for (int j = 0; j < polys_in.polys[i].size(); j++) {
|
||||
for (unsigned int j = 0; j < polys_in.polys[i].size(); j++) {
|
||||
inland_water_mask =
|
||||
polygon_union(inland_water_mask, polys_in.polys[i][j]);
|
||||
}
|
||||
|
@ -484,7 +484,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
}
|
||||
|
||||
// set up island mask, for cutting holes in lakes
|
||||
FGPolygon island_mask;
|
||||
TGPolygon island_mask;
|
||||
island_mask.erase();
|
||||
for ( i = 0; i < (int)polys_in.polys[IslandArea].size(); ++i ) {
|
||||
island_mask =
|
||||
|
@ -499,7 +499,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
// last = polys_in.polys[i].end();
|
||||
// for ( ; current != last; ++current ) {
|
||||
for( j = 0; j < (int)polys_in.polys[i].size(); ++j ) {
|
||||
FGPolygon current = polys_in.polys[i][j];
|
||||
TGPolygon current = polys_in.polys[i][j];
|
||||
SG_LOG( SG_CLIPPER, SG_DEBUG, get_area_name( (AreaType)i )
|
||||
<< " = " << current.contours() );
|
||||
|
||||
|
@ -520,7 +520,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
tmp = polygon_diff( tmp, island_mask );
|
||||
}
|
||||
|
||||
FGPolygon result_union, result_diff;
|
||||
TGPolygon result_union, result_diff;
|
||||
|
||||
if ( accum.contours() == 0 ) {
|
||||
result_diff = tmp;
|
||||
|
|
|
@ -54,7 +54,7 @@ class FGPolyList
|
|||
{
|
||||
public:
|
||||
poly_list polys[FG_MAX_AREA_TYPES];
|
||||
FGPolygon safety_base;
|
||||
TGPolygon safety_base;
|
||||
};
|
||||
|
||||
|
||||
|
@ -83,17 +83,17 @@ public:
|
|||
bool load_osgb36_polys(const string& path);
|
||||
|
||||
// Add a polygon.
|
||||
void add_poly(int area, const FGPolygon &poly);
|
||||
void add_poly(int area, const TGPolygon &poly);
|
||||
|
||||
// Remove any slivers from in polygon and move them to out
|
||||
// polygon.
|
||||
void move_slivers( FGPolygon& in, FGPolygon& out );
|
||||
void move_slivers( TGPolygon& in, TGPolygon& out );
|
||||
|
||||
// For each sliver contour, see if a union with another polygon
|
||||
// yields a polygon with no increased contours (i.e. the sliver is
|
||||
// adjacent and can be merged.) If so, replace the clipped
|
||||
// polygon with the new polygon that has the sliver merged in.
|
||||
void merge_slivers( FGPolyList& clipped, FGPolygon& slivers );
|
||||
void merge_slivers( FGPolyList& clipped, TGPolygon& slivers );
|
||||
|
||||
// Do actual clipping work.
|
||||
bool clip_all(const point2d& min, const point2d& max);
|
||||
|
|
|
@ -224,7 +224,7 @@ static int actual_load_polys( const string& dir,
|
|||
// Merge a polygon with an existing one if possible, append a new one
|
||||
// otherwise; this function is used by actual_load_landcover, below,
|
||||
// to reduce the number of separate polygons.
|
||||
static void inline add_to_polys ( FGPolygon &accum, const FGPolygon &poly) {
|
||||
static void inline add_to_polys ( TGPolygon &accum, const TGPolygon &poly) {
|
||||
if ( accum.contours() > 0 ) {
|
||||
accum = polygon_union( accum, poly );
|
||||
} else {
|
||||
|
@ -267,7 +267,7 @@ static AreaType get_area_type (const LandCover &cover,
|
|||
|
||||
// make the area specified area, look up the land cover type, and add
|
||||
// it to polys
|
||||
static void make_area( const LandCover &cover, FGPolygon *polys,
|
||||
static void make_area( const LandCover &cover, TGPolygon *polys,
|
||||
double x1, double y1, double x2, double y2,
|
||||
double half_dx, double half_dy )
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static void make_area( const LandCover &cover, FGPolygon *polys,
|
|||
x2 - x1, y2 - y1);
|
||||
if (area != DefaultArea) {
|
||||
// Create a square polygon and merge it into the list.
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
poly.erase();
|
||||
poly.add_node(0, Point3D(x1, y1, 0.0));
|
||||
poly.add_node(0, Point3D(x1, y2, 0.0));
|
||||
|
@ -296,8 +296,8 @@ static int actual_load_landcover ( FGConstruct & c,
|
|||
try {
|
||||
|
||||
LandCover cover(c.get_cover());
|
||||
FGPolygon polys[FG_MAX_AREA_TYPES];
|
||||
FGPolygon poly; // working polygon
|
||||
TGPolygon polys[FG_MAX_AREA_TYPES];
|
||||
TGPolygon poly; // working polygon
|
||||
|
||||
double dx = 1.0 / 120.0;
|
||||
double dy = dx;
|
||||
|
|
|
@ -73,7 +73,7 @@ FGTriangle::build( const point_list& corner_list,
|
|||
}
|
||||
|
||||
// next process the polygons
|
||||
FGPolygon gpc_poly;
|
||||
TGPolygon gpc_poly;
|
||||
const_poly_list_iterator current, last;
|
||||
|
||||
// process polygons in priority order
|
||||
|
@ -215,7 +215,7 @@ FGTriangle::build( const point_list& corner_list,
|
|||
int i1, i2;
|
||||
Point3D p1, p2;
|
||||
point_list node_list = in_nodes.get_node_list();
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
|
||||
for ( i = 0; i < FG_MAX_AREA_TYPES; ++i ) {
|
||||
cout << "area type = " << i << endl;
|
||||
|
@ -342,7 +342,7 @@ static void write_out_data(struct triangulateio *out) {
|
|||
// after split/reassem where we don't want any extra nodes generated.
|
||||
|
||||
int FGTriangle::run_triangulate( const string& angle, const int pass ) {
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
Point3D p;
|
||||
struct triangulateio in, out, vorout;
|
||||
int counter;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// poly_support.cxx -- additional supporting routines for the FGPolygon class
|
||||
// poly_support.cxx -- additional supporting routines for the TGPolygon class
|
||||
// specific to the object building process.
|
||||
//
|
||||
// Written by Curtis Olson, started October 1999.
|
||||
|
@ -106,7 +106,7 @@ static bool intersects( Point3D p0, Point3D p1, double x, Point3D *result ) {
|
|||
|
||||
// calculate some "arbitrary" point inside the specified contour for
|
||||
// assigning attribute areas
|
||||
Point3D calc_point_inside_old( const FGPolygon& p, const int contour,
|
||||
Point3D calc_point_inside_old( const TGPolygon& p, const int contour,
|
||||
const TGTriNodes& trinodes ) {
|
||||
Point3D tmp, min, ln, p1, p2, p3, m, result, inside_pt;
|
||||
int min_node_index = 0;
|
||||
|
@ -237,7 +237,7 @@ Point3D calc_point_inside_old( const FGPolygon& p, const int contour,
|
|||
|
||||
// basic triangulation of a polygon with out adding points or
|
||||
// splitting edges, this should triangulate around interior holes.
|
||||
void polygon_tesselate( const FGPolygon &p,
|
||||
void polygon_tesselate( const TGPolygon &p,
|
||||
triele_list &elelist,
|
||||
point_list &out_pts )
|
||||
{
|
||||
|
@ -442,8 +442,8 @@ void polygon_tesselate( const FGPolygon &p,
|
|||
// wrapper for the polygon_tesselate() function. Note, this routine
|
||||
// will modify the points_inside list for your polygon.
|
||||
|
||||
FGPolygon polygon_tesselate_alt( FGPolygon &p ) {
|
||||
FGPolygon result;
|
||||
TGPolygon polygon_tesselate_alt( TGPolygon &p ) {
|
||||
TGPolygon result;
|
||||
result.erase();
|
||||
int i;
|
||||
|
||||
|
@ -483,8 +483,8 @@ FGPolygon polygon_tesselate_alt( FGPolygon &p ) {
|
|||
|
||||
// basic triangulation of a contour with out adding points or
|
||||
// splitting edges but cuts out any of the specified holes
|
||||
static void contour_tesselate( TGContourNode *node, const FGPolygon &p,
|
||||
const FGPolygon &hole_polys,
|
||||
static void contour_tesselate( TGContourNode *node, const TGPolygon &p,
|
||||
const TGPolygon &hole_polys,
|
||||
const point_list &hole_pts,
|
||||
triele_list &elelist,
|
||||
point_list &out_pts )
|
||||
|
@ -745,11 +745,11 @@ static Point3D point_inside_hole( point_list contour ) {
|
|||
|
||||
// Find a point inside a specific polygon contour taking holes into
|
||||
// consideration
|
||||
static Point3D point_inside_contour( TGContourNode *node, const FGPolygon &p ) {
|
||||
static Point3D point_inside_contour( TGContourNode *node, const TGPolygon &p ) {
|
||||
int contour_num;
|
||||
int i;
|
||||
|
||||
FGPolygon hole_polys;
|
||||
TGPolygon hole_polys;
|
||||
hole_polys.erase();
|
||||
|
||||
point_list hole_pts;
|
||||
|
@ -808,7 +808,7 @@ static Point3D point_inside_contour( TGContourNode *node, const FGPolygon &p ) {
|
|||
|
||||
// recurse the contour tree and build up the point inside list for
|
||||
// each contour/hole
|
||||
static void calc_point_inside( TGContourNode *node, FGPolygon &p ) {
|
||||
static void calc_point_inside( TGContourNode *node, TGPolygon &p ) {
|
||||
for ( int i = 0; i < node->get_num_kids(); ++i ) {
|
||||
if ( node->get_kid( i ) != NULL ) {
|
||||
calc_point_inside( node->get_kid( i ), p );
|
||||
|
@ -839,7 +839,7 @@ static void print_contour_tree( TGContourNode *node, string indent ) {
|
|||
|
||||
// Build the contour "is inside of" tree
|
||||
static void build_contour_tree( TGContourNode *node,
|
||||
const FGPolygon &p,
|
||||
const TGPolygon &p,
|
||||
int_list &avail )
|
||||
{
|
||||
cout << "working on contour = " << node->get_contour_num() << endl;
|
||||
|
@ -925,7 +925,7 @@ static void build_contour_tree( TGContourNode *node,
|
|||
|
||||
|
||||
// calculate some "arbitrary" point inside each of the polygons contours
|
||||
void calc_points_inside( FGPolygon& p ) {
|
||||
void calc_points_inside( TGPolygon& p ) {
|
||||
// first build the contour tree
|
||||
|
||||
// make a list of all still available contours (all of the for
|
||||
|
@ -950,12 +950,12 @@ void calc_points_inside( FGPolygon& p ) {
|
|||
|
||||
// remove duplicate nodes in a polygon should they exist. Returns the
|
||||
// fixed polygon
|
||||
FGPolygon remove_dups( const FGPolygon &poly ) {
|
||||
FGPolygon result;
|
||||
TGPolygon remove_dups( const TGPolygon &poly ) {
|
||||
TGPolygon result;
|
||||
point_list contour, new_contour;
|
||||
result.erase();
|
||||
|
||||
FGPolygon tmp = poly;
|
||||
TGPolygon tmp = poly;
|
||||
for ( int i = 0; i < tmp.contours(); ++i ) {
|
||||
contour = poly.get_contour( i );
|
||||
// cout << "testing contour " << i << " size = " << contour.size()
|
||||
|
@ -1016,9 +1016,9 @@ snap (const Point3D &p, double grid_size)
|
|||
}
|
||||
|
||||
// snap all points in a polygon to the given grid size.
|
||||
FGPolygon snap (const FGPolygon &poly, double grid_size)
|
||||
TGPolygon snap (const TGPolygon &poly, double grid_size)
|
||||
{
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
for (int contour = 0; contour < poly.contours(); contour++) {
|
||||
for (int i = 0; i < poly.contour_size(contour); i++) {
|
||||
result.add_node(contour, snap(poly.get_pt(contour, i), grid_size));
|
||||
|
@ -1206,8 +1206,8 @@ static point_list reduce_contour_degeneracy( const point_list& contour ) {
|
|||
|
||||
// Search each segment of each contour for degenerate points (i.e. out
|
||||
// of order points that lie coincident on other segments
|
||||
FGPolygon reduce_degeneracy( const FGPolygon& poly ) {
|
||||
FGPolygon result;
|
||||
TGPolygon reduce_degeneracy( const TGPolygon& poly ) {
|
||||
TGPolygon result;
|
||||
|
||||
for ( int i = 0; i < poly.contours(); ++i ) {
|
||||
point_list contour = poly.get_contour(i);
|
||||
|
@ -1223,8 +1223,8 @@ FGPolygon reduce_degeneracy( const FGPolygon& poly ) {
|
|||
|
||||
|
||||
// remove any degenerate contours
|
||||
FGPolygon remove_bad_contours( const FGPolygon &poly ) {
|
||||
FGPolygon result;
|
||||
TGPolygon remove_bad_contours( const TGPolygon &poly ) {
|
||||
TGPolygon result;
|
||||
result.erase();
|
||||
|
||||
for ( int i = 0; i < poly.contours(); ++i ) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// poly_support.hxx -- additional supporting routines for the FGPolygon class
|
||||
// poly_support.hxx -- additional supporting routines for the TGPolygon class
|
||||
// specific to the object building process.
|
||||
//
|
||||
// Written by Curtis Olson, started October 1999.
|
||||
|
@ -53,7 +53,7 @@ inline double triangle_area( const Point3D p1,
|
|||
|
||||
// basic triangulation of a polygon with out adding points or
|
||||
// splitting edges
|
||||
void polygon_tesselate( const FGPolygon &p,
|
||||
void polygon_tesselate( const TGPolygon &p,
|
||||
triele_list &elelist,
|
||||
point_list &out_pts );
|
||||
|
||||
|
@ -62,28 +62,28 @@ void polygon_tesselate( const FGPolygon &p,
|
|||
// with one contour per tesselated triangle. This is mostly just a
|
||||
// wrapper for the polygon_tesselate() function. Note, this routine
|
||||
// will modify the points_inside list for your polygon.
|
||||
FGPolygon polygon_tesselate_alt( FGPolygon &p );
|
||||
TGPolygon polygon_tesselate_alt( TGPolygon &p );
|
||||
|
||||
// calculate some "arbitrary" point inside the specified contour for
|
||||
// assigning attribute areas. This requires data structures outside
|
||||
// of "FGPolygon" which is why it is living over here in "Lib/Geometry"
|
||||
Point3D calc_point_inside_old( const FGPolygon& p, const int contour,
|
||||
// of "TGPolygon" which is why it is living over here in "Lib/Geometry"
|
||||
Point3D calc_point_inside_old( const TGPolygon& p, const int contour,
|
||||
const TGTriNodes& trinodes );
|
||||
|
||||
// calculate some "arbitrary" point inside each of the polygons contours
|
||||
void calc_points_inside( FGPolygon& p );
|
||||
void calc_points_inside( TGPolygon& p );
|
||||
|
||||
// snap all points to a grid
|
||||
FGPolygon snap( const FGPolygon &poly, double grid_size );
|
||||
TGPolygon snap( const TGPolygon &poly, double grid_size );
|
||||
|
||||
// remove duplicate nodes in a polygon should they exist. Returns the
|
||||
// fixed polygon
|
||||
FGPolygon remove_dups( const FGPolygon &poly );
|
||||
TGPolygon remove_dups( const TGPolygon &poly );
|
||||
|
||||
|
||||
// Search each segment of each contour for degenerate points (i.e. out
|
||||
// of order points that lie coincident on other segments
|
||||
FGPolygon reduce_degeneracy( const FGPolygon& poly );
|
||||
TGPolygon reduce_degeneracy( const TGPolygon& poly );
|
||||
|
||||
|
||||
// Find a point in the given node list that lies between start and
|
||||
|
@ -92,7 +92,7 @@ bool find_intermediate_node( const Point3D& start, const Point3D& end,
|
|||
const point_list& nodes, Point3D *result );
|
||||
|
||||
// remove any degenerate contours
|
||||
FGPolygon remove_bad_contours( const FGPolygon &poly );
|
||||
TGPolygon remove_bad_contours( const TGPolygon &poly );
|
||||
|
||||
|
||||
#endif // _POLY_SUPPORT_HXX
|
||||
|
|
|
@ -72,10 +72,10 @@ Rectangle::isOverlapping (const Rectangle &r) const
|
|||
(max.y() >= _min.y()) && (min.y() <= _max.y()));
|
||||
}
|
||||
|
||||
const FGPolygon
|
||||
const TGPolygon
|
||||
Rectangle::toPoly () const
|
||||
{
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
poly.add_node(0, _min);
|
||||
poly.add_node(0, Point3D(_max.x(), _min.y(), 0));
|
||||
poly.add_node(0, _max);
|
||||
|
|
|
@ -126,7 +126,7 @@ public:
|
|||
*
|
||||
* @return A four-vertex polygon representing this rectangle.
|
||||
*/
|
||||
virtual const FGPolygon toPoly () const;
|
||||
virtual const TGPolygon toPoly () const;
|
||||
|
||||
private:
|
||||
Point3D _min;
|
||||
|
|
|
@ -51,7 +51,7 @@ getIntersection (const Point3D &p0, const Point3D &p1,
|
|||
* uses the WGS80 functions, rather than simple Pythagorean stuff.
|
||||
*/
|
||||
void
|
||||
makePolygon (const Point3D &p, int width, FGPolygon &polygon)
|
||||
makePolygon (const Point3D &p, int width, TGPolygon &polygon)
|
||||
{
|
||||
double x, y, az;
|
||||
double lon = p.x();
|
||||
|
@ -73,9 +73,9 @@ makePolygon (const Point3D &p, int width, FGPolygon &polygon)
|
|||
|
||||
|
||||
void
|
||||
makePolygon (const Line &line, int width, FGPolygon &polygon)
|
||||
makePolygon (const Line &line, int width, TGPolygon &polygon)
|
||||
{
|
||||
vector<FGPolygon> segment_list;
|
||||
vector<TGPolygon> segment_list;
|
||||
|
||||
int nPoints = line.getPointCount();
|
||||
int i;
|
||||
|
@ -148,9 +148,9 @@ makePolygon (const Line &line, int width, FGPolygon &polygon)
|
|||
|
||||
|
||||
Rectangle
|
||||
makeBounds (const FGPolygon &polygon)
|
||||
makeBounds (const TGPolygon &polygon)
|
||||
{
|
||||
double min_x, min_y, max_x, max_y;
|
||||
double min_x = 0.0, min_y = 0.0, max_x = 0.0, max_y = 0.0;
|
||||
for (int i = 0; i < polygon.contours(); i++) {
|
||||
for (int j = 0; j < polygon.contour_size(i); j++) {
|
||||
Point3D p = polygon.get_pt(i, j);
|
||||
|
|
|
@ -70,7 +70,7 @@ bool getIntersection (const Point3D &p0, const Point3D &p1,
|
|||
* @param width The width in standard units (meters for FlightGear).
|
||||
* @param polygon The object that will hold the new polygon.
|
||||
*/
|
||||
void makePolygon (const Point3D &p, int width, FGPolygon &polygon);
|
||||
void makePolygon (const Point3D &p, int width, TGPolygon &polygon);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -86,7 +86,7 @@ void makePolygon (const Point3D &p, int width, FGPolygon &polygon);
|
|||
* @param width The width in standard units (meters for FlightGear).
|
||||
* @param polygon The object that will hold the new polygon.
|
||||
*/
|
||||
void makePolygon (const Line &line, int width, FGPolygon &polygon);
|
||||
void makePolygon (const Line &line, int width, TGPolygon &polygon);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -95,7 +95,7 @@ void makePolygon (const Line &line, int width, FGPolygon &polygon);
|
|||
* @param polygon The polygon to make the rectangle for.
|
||||
* @return The bounding rectangle.
|
||||
*/
|
||||
Rectangle makeBounds (const FGPolygon &polygon);
|
||||
Rectangle makeBounds (const TGPolygon &polygon);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,7 +49,7 @@ SG_USING_STD( cout );
|
|||
SG_USING_STD( endl );
|
||||
|
||||
|
||||
void write_polygon( const FGPolygon& poly, const string& base ) {
|
||||
void write_polygon( const TGPolygon& poly, const string& base ) {
|
||||
for ( int i = 0; i < poly.contours(); ++i ) {
|
||||
char name[256];
|
||||
sprintf(name, "%s%d", base.c_str(), i );
|
||||
|
@ -93,7 +93,7 @@ void write_index(const string& base, const SGBucket& b, const string& name) {
|
|||
|
||||
|
||||
void write_boundary( const string& base, const SGBucket& b,
|
||||
const FGPolygon& bounds, long int p_index )
|
||||
const TGPolygon& bounds, long int p_index )
|
||||
{
|
||||
Point3D p;
|
||||
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
#include <Polygon/polygon.hxx>
|
||||
|
||||
|
||||
void write_polygon( const FGPolygon& poly, const string& base );
|
||||
void write_polygon( const TGPolygon& poly, const string& base );
|
||||
|
||||
// update index
|
||||
void write_index(const string& base, const SGBucket& b, const string& name);
|
||||
|
||||
void write_boundary( const string& base, const SGBucket& b,
|
||||
const FGPolygon& bounds, long int p_index );
|
||||
const TGPolygon& bounds, long int p_index );
|
||||
|
||||
#endif // _TG_OUTPUT_HXX
|
||||
|
|
|
@ -41,12 +41,12 @@ SG_USING_STD(endl);
|
|||
#include "polygon.hxx"
|
||||
|
||||
// Constructor
|
||||
FGPolygon::FGPolygon( void ) {
|
||||
TGPolygon::TGPolygon( void ) {
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
FGPolygon::~FGPolygon( void ) {
|
||||
TGPolygon::~TGPolygon( void ) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +83,7 @@ static double calc_angle(point2d a, point2d b, point2d c) {
|
|||
// negative areas indicate counter clockwise winding
|
||||
// positive areas indicate clockwise winding.
|
||||
|
||||
double FGPolygon::area_contour( const int contour ) const {
|
||||
double TGPolygon::area_contour( const int contour ) const {
|
||||
// area = 1/2 * sum[i = 0 to k-1][x(i)*y(i+1) - x(i+1)*y(i)]
|
||||
// where i=k is defined as i=0
|
||||
|
||||
|
@ -102,7 +102,7 @@ double FGPolygon::area_contour( const int contour ) const {
|
|||
|
||||
|
||||
// return the smallest interior angle of the contour
|
||||
double FGPolygon::minangle_contour( const int contour ) {
|
||||
double TGPolygon::minangle_contour( const int contour ) {
|
||||
point_list c = poly[contour];
|
||||
int size = c.size();
|
||||
int p1_index, p2_index, p3_index;
|
||||
|
@ -144,9 +144,9 @@ double FGPolygon::minangle_contour( const int contour ) {
|
|||
|
||||
|
||||
// return true if contour A is inside countour B
|
||||
bool FGPolygon::is_inside( int a, int b ) const {
|
||||
bool TGPolygon::is_inside( int a, int b ) const {
|
||||
// make polygons from each specified contour
|
||||
FGPolygon A, B;
|
||||
TGPolygon A, B;
|
||||
point_list pl;
|
||||
A.erase();
|
||||
B.erase();
|
||||
|
@ -163,7 +163,7 @@ bool FGPolygon::is_inside( int a, int b ) const {
|
|||
// B.write( "B" );
|
||||
|
||||
// A is "inside" B if the polygon_diff( A, B ) is null.
|
||||
FGPolygon result = polygon_diff( A, B );
|
||||
TGPolygon result = polygon_diff( A, B );
|
||||
// SG_LOG(SG_GENERAL, SG_DEBUG, "result size = " << result.total_size());
|
||||
|
||||
// char junk;
|
||||
|
@ -180,7 +180,7 @@ bool FGPolygon::is_inside( int a, int b ) const {
|
|||
|
||||
|
||||
// shift every point in the polygon by lon, lat
|
||||
void FGPolygon::shift( double lon, double lat ) {
|
||||
void TGPolygon::shift( double lon, double lat ) {
|
||||
for ( int i = 0; i < (int)poly.size(); ++i ) {
|
||||
for ( int j = 0; j < (int)poly[i].size(); ++j ) {
|
||||
poly[i][j].setx( poly[i][j].x() + lon );
|
||||
|
@ -191,7 +191,7 @@ void FGPolygon::shift( double lon, double lat ) {
|
|||
|
||||
|
||||
// output
|
||||
void FGPolygon::write( const string& file ) const {
|
||||
void TGPolygon::write( const string& file ) const {
|
||||
FILE *fp = fopen( file.c_str(), "w" );
|
||||
|
||||
for ( int i = 0; i < (int)poly.size(); ++i ) {
|
||||
|
@ -206,7 +206,7 @@ void FGPolygon::write( const string& file ) const {
|
|||
|
||||
|
||||
// output
|
||||
void FGPolygon::write_contour( const int contour, const string& file ) const {
|
||||
void TGPolygon::write_contour( const int contour, const string& file ) const {
|
||||
FILE *fp = fopen( file.c_str(), "w" );
|
||||
|
||||
for ( int j = 0; j < (int)poly[contour].size(); ++j ) {
|
||||
|
@ -221,8 +221,8 @@ void FGPolygon::write_contour( const int contour, const string& file ) const {
|
|||
// wrapper functions for gpc polygon clip routines
|
||||
//
|
||||
|
||||
// Make a gpc_poly from an FGPolygon
|
||||
void make_gpc_poly( const FGPolygon& in, gpc_polygon *out ) {
|
||||
// Make a gpc_poly from an TGPolygon
|
||||
void make_gpc_poly( const TGPolygon& in, gpc_polygon *out ) {
|
||||
gpc_vertex_list v_list;
|
||||
v_list.num_vertices = 0;
|
||||
v_list.vertex = new gpc_vertex[FG_MAX_VERTICES];
|
||||
|
@ -264,10 +264,10 @@ typedef enum {
|
|||
|
||||
|
||||
// Generic clipping routine
|
||||
FGPolygon polygon_clip( clip_op poly_op, const FGPolygon& subject,
|
||||
const FGPolygon& clip )
|
||||
TGPolygon polygon_clip( clip_op poly_op, const TGPolygon& subject,
|
||||
const TGPolygon& clip )
|
||||
{
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
|
||||
gpc_polygon *gpc_subject = new gpc_polygon;
|
||||
gpc_subject->num_contours = 0;
|
||||
|
@ -337,32 +337,32 @@ FGPolygon polygon_clip( clip_op poly_op, const FGPolygon& subject,
|
|||
|
||||
|
||||
// Difference
|
||||
FGPolygon polygon_diff( const FGPolygon& subject, const FGPolygon& clip ) {
|
||||
TGPolygon polygon_diff( const TGPolygon& subject, const TGPolygon& clip ) {
|
||||
return polygon_clip( POLY_DIFF, subject, clip );
|
||||
}
|
||||
|
||||
// Intersection
|
||||
FGPolygon polygon_int( const FGPolygon& subject, const FGPolygon& clip ) {
|
||||
TGPolygon polygon_int( const TGPolygon& subject, const TGPolygon& clip ) {
|
||||
return polygon_clip( POLY_INT, subject, clip );
|
||||
}
|
||||
|
||||
|
||||
// Exclusive or
|
||||
FGPolygon polygon_xor( const FGPolygon& subject, const FGPolygon& clip ) {
|
||||
TGPolygon polygon_xor( const TGPolygon& subject, const TGPolygon& clip ) {
|
||||
return polygon_clip( POLY_XOR, subject, clip );
|
||||
}
|
||||
|
||||
|
||||
// Union
|
||||
FGPolygon polygon_union( const FGPolygon& subject, const FGPolygon& clip ) {
|
||||
TGPolygon polygon_union( const TGPolygon& subject, const TGPolygon& clip ) {
|
||||
return polygon_clip( POLY_UNION, subject, clip );
|
||||
}
|
||||
|
||||
|
||||
// canonify the polygon winding, outer contour must be anti-clockwise,
|
||||
// all inner contours must be clockwise.
|
||||
FGPolygon polygon_canonify( const FGPolygon& in_poly ) {
|
||||
FGPolygon result;
|
||||
TGPolygon polygon_canonify( const TGPolygon& in_poly ) {
|
||||
TGPolygon result;
|
||||
result.erase();
|
||||
|
||||
// Negative areas indicate counter clockwise winding. Postitive
|
||||
|
@ -415,12 +415,12 @@ FGPolygon polygon_canonify( const FGPolygon& in_poly ) {
|
|||
// be determined easily.
|
||||
#define FG_MAX_TRIANGLES 100000
|
||||
|
||||
FGPolygon polygon_to_tristrip( const FGPolygon& in_poly ) {
|
||||
TGPolygon polygon_to_tristrip( const TGPolygon& in_poly ) {
|
||||
int i, j;
|
||||
|
||||
// canonify the polygon winding, outer contour must be
|
||||
// anti-clockwise, all inner contours must be clockwise.
|
||||
FGPolygon canon_poly = polygon_canonify( in_poly );
|
||||
TGPolygon canon_poly = polygon_canonify( in_poly );
|
||||
|
||||
// create and fill in the required structures
|
||||
int ncontours = canon_poly.contours();
|
||||
|
@ -459,7 +459,7 @@ FGPolygon polygon_to_tristrip( const FGPolygon& in_poly ) {
|
|||
|
||||
gpc_polygon_to_tristrip( tmp_poly, tmp_tristrip );
|
||||
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
|
||||
for ( int i = 0; i < tmp_tristrip->num_strips; ++i ) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " processing strip = "
|
||||
|
@ -499,7 +499,7 @@ FGPolygon polygon_to_tristrip( const FGPolygon& in_poly ) {
|
|||
// wrapper functions for gpc polygon to tristrip routine
|
||||
//
|
||||
|
||||
FGPolygon polygon_to_tristrip_old( const FGPolygon& in_poly ) {
|
||||
TGPolygon polygon_to_tristrip_old( const TGPolygon& in_poly ) {
|
||||
gpc_polygon *tmp_poly = new gpc_polygon;
|
||||
tmp_poly->num_contours = 0;
|
||||
tmp_poly->contour = NULL;
|
||||
|
@ -512,7 +512,7 @@ FGPolygon polygon_to_tristrip_old( const FGPolygon& in_poly ) {
|
|||
|
||||
gpc_polygon_to_tristrip( tmp_poly, tmp_tristrip );
|
||||
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
|
||||
for ( int i = 0; i < tmp_tristrip->num_strips; ++i ) {
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " processing strip = "
|
||||
|
@ -548,7 +548,7 @@ FGPolygon polygon_to_tristrip_old( const FGPolygon& in_poly ) {
|
|||
|
||||
// Send a polygon to standard output.
|
||||
ostream &
|
||||
operator<< (ostream &output, const FGPolygon &poly)
|
||||
operator<< (ostream &output, const TGPolygon &poly)
|
||||
{
|
||||
int nContours = poly.contours();
|
||||
output << nContours << endl;
|
||||
|
|
|
@ -50,7 +50,7 @@ typedef polytype::iterator polytype_iterator;
|
|||
typedef polytype::const_iterator const_polytype_iterator;
|
||||
|
||||
|
||||
class FGPolygon {
|
||||
class TGPolygon {
|
||||
|
||||
private:
|
||||
|
||||
|
@ -61,8 +61,8 @@ private:
|
|||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
FGPolygon( void );
|
||||
~FGPolygon( void );
|
||||
TGPolygon( void );
|
||||
~TGPolygon( void );
|
||||
|
||||
// Add a contour
|
||||
inline void add_contour( const point_list contour, const int hole_flag ) {
|
||||
|
@ -178,39 +178,39 @@ public:
|
|||
};
|
||||
|
||||
|
||||
typedef vector < FGPolygon > poly_list;
|
||||
typedef vector < TGPolygon > poly_list;
|
||||
typedef poly_list::iterator poly_list_iterator;
|
||||
typedef poly_list::const_iterator const_poly_list_iterator;
|
||||
|
||||
|
||||
// canonify the polygon winding, outer contour must be anti-clockwise,
|
||||
// all inner contours must be clockwise.
|
||||
FGPolygon polygon_canonify( const FGPolygon& in_poly );
|
||||
TGPolygon polygon_canonify( const TGPolygon& in_poly );
|
||||
|
||||
|
||||
// Wrapper for the fast Polygon Triangulation based on Seidel's
|
||||
// Algorithm by Atul Narkhede and Dinesh Manocha
|
||||
// http://www.cs.unc.edu/~dm/CODE/GEM/chapter.html
|
||||
|
||||
FGPolygon polygon_to_tristrip( const FGPolygon& poly );
|
||||
TGPolygon polygon_to_tristrip( const TGPolygon& poly );
|
||||
|
||||
|
||||
// wrapper functions for gpc polygon clip routines
|
||||
|
||||
// Difference
|
||||
FGPolygon polygon_diff( const FGPolygon& subject, const FGPolygon& clip );
|
||||
TGPolygon polygon_diff( const TGPolygon& subject, const TGPolygon& clip );
|
||||
|
||||
// Intersection
|
||||
FGPolygon polygon_int( const FGPolygon& subject, const FGPolygon& clip );
|
||||
TGPolygon polygon_int( const TGPolygon& subject, const TGPolygon& clip );
|
||||
|
||||
// Exclusive or
|
||||
FGPolygon polygon_xor( const FGPolygon& subject, const FGPolygon& clip );
|
||||
TGPolygon polygon_xor( const TGPolygon& subject, const TGPolygon& clip );
|
||||
|
||||
// Union
|
||||
FGPolygon polygon_union( const FGPolygon& subject, const FGPolygon& clip );
|
||||
TGPolygon polygon_union( const TGPolygon& subject, const TGPolygon& clip );
|
||||
|
||||
// Output
|
||||
ostream &operator<< (ostream &output, const FGPolygon &poly);
|
||||
ostream &operator<< (ostream &output, const TGPolygon &poly);
|
||||
|
||||
|
||||
#endif // _POLYGON_HXX
|
||||
|
|
|
@ -81,7 +81,7 @@ static bool intersects_y( Point3D p0, Point3D p1, double y, Point3D *result ) {
|
|||
|
||||
// find the smallest point in contour 0 of poly such that x > min_x
|
||||
// and y = y. Returns index of the found point, -1 if no match found.
|
||||
static int find_point( const FGPolygon& poly, double min_x, double y ) {
|
||||
static int find_point( const TGPolygon& poly, double min_x, double y ) {
|
||||
Point3D p, save;
|
||||
int index = -1;
|
||||
|
||||
|
@ -173,9 +173,9 @@ inline bool is_inside( double line, Point3D p, fgSideType side ) {
|
|||
|
||||
// Walk through the input polygon and split it into the
|
||||
// portion that is inside the clip region
|
||||
static bool simple_clip( const FGPolygon& in, const double y,
|
||||
static bool simple_clip( const TGPolygon& in, const double y,
|
||||
const fgSideType side,
|
||||
FGPolygon& result )
|
||||
TGPolygon& result )
|
||||
{
|
||||
Point3D p, p_last, p_int;
|
||||
int i;
|
||||
|
@ -253,7 +253,7 @@ static bool simple_clip( const FGPolygon& in, const double y,
|
|||
|
||||
|
||||
// build the list of intersections
|
||||
static bool build_intersections( const FGPolygon& arcs, double line,
|
||||
static bool build_intersections( const TGPolygon& arcs, double line,
|
||||
fgSideType side,
|
||||
int_list& keep_ints,
|
||||
int_list& ignore_ints )
|
||||
|
@ -329,8 +329,8 @@ static bool build_intersections( const FGPolygon& arcs, double line,
|
|||
|
||||
|
||||
// test for duplicate nodes
|
||||
FGPolygon fix_dups( FGPolygon& in ) {
|
||||
FGPolygon result;
|
||||
TGPolygon fix_dups( TGPolygon& in ) {
|
||||
TGPolygon result;
|
||||
|
||||
double x_last = -20000.0;
|
||||
double y_last = -20000.0;
|
||||
|
@ -357,11 +357,11 @@ FGPolygon fix_dups( FGPolygon& in ) {
|
|||
// with single contour polygons (no holes.) Returns true if routine
|
||||
// thinks it was successful.
|
||||
|
||||
static bool clip_contour( const FGPolygon& in, const double y,
|
||||
static bool clip_contour( const TGPolygon& in, const double y,
|
||||
const fgSideType side,
|
||||
FGPolygon& result )
|
||||
TGPolygon& result )
|
||||
{
|
||||
FGPolygon result_arcs, arcs;
|
||||
TGPolygon result_arcs, arcs;
|
||||
int i, i1, i2, index;
|
||||
|
||||
|
||||
|
@ -423,7 +423,7 @@ static bool clip_contour( const FGPolygon& in, const double y,
|
|||
// Step 4: If we are finding the "below" clip, reverse the points
|
||||
// before extracting the cycles. (and remove duplicates)
|
||||
|
||||
FGPolygon tmp;
|
||||
TGPolygon tmp;
|
||||
tmp.erase();
|
||||
|
||||
if ( side == Below ) {
|
||||
|
@ -533,10 +533,10 @@ static bool clip_contour( const FGPolygon& in, const double y,
|
|||
// results. Doesn't work with holes. Returns true if routine thinks
|
||||
// it was successful.
|
||||
|
||||
FGPolygon horizontal_clip( const FGPolygon& in, const double y,
|
||||
TGPolygon horizontal_clip( const TGPolygon& in, const double y,
|
||||
const fgSideType side )
|
||||
{
|
||||
FGPolygon result;
|
||||
TGPolygon result;
|
||||
result.erase();
|
||||
|
||||
// Step 1: sanity checks
|
||||
|
@ -546,7 +546,7 @@ FGPolygon horizontal_clip( const FGPolygon& in, const double y,
|
|||
}
|
||||
|
||||
// clip each contour individually
|
||||
FGPolygon tmp_poly, clip_poly;
|
||||
TGPolygon tmp_poly, clip_poly;
|
||||
point_list contour;
|
||||
|
||||
for ( int i = 0; i < in.contours(); ++i ) {
|
||||
|
|
|
@ -44,7 +44,7 @@ enum fgSideType {
|
|||
// results. Doesn't work with holes. Returns true if routine thinks
|
||||
// it was successful.
|
||||
|
||||
FGPolygon horizontal_clip( const FGPolygon& in, const double y,
|
||||
TGPolygon horizontal_clip( const TGPolygon& in, const double y,
|
||||
const fgSideType side );
|
||||
|
||||
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
|
||||
|
||||
static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
||||
SGBucket b, const FGPolygon& shape ) {
|
||||
SGBucket b, const TGPolygon& shape ) {
|
||||
Point3D c, min, max, p;
|
||||
c = Point3D( b.get_center_lon(), b.get_center_lat(), 0 );
|
||||
double span = sg_bucket_span( c.y() );
|
||||
FGPolygon base, result;
|
||||
TGPolygon base, result;
|
||||
char tile_name[256], poly_index[256];
|
||||
|
||||
// calculate bucket dimensions
|
||||
|
@ -129,7 +129,7 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
|||
|
||||
|
||||
// process shape (write polygon to all intersecting tiles)
|
||||
void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
||||
void split_polygon(const string& path, AreaType area, const TGPolygon& shape) {
|
||||
Point3D min, max, p;
|
||||
// point2d min, max;
|
||||
long int index;
|
||||
|
@ -230,7 +230,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
"Generating bottom half (" << min.y() << "-" <<
|
||||
clip_line << ")" );
|
||||
|
||||
FGPolygon bottom, bottom_clip;
|
||||
TGPolygon bottom, bottom_clip;
|
||||
if ( shape.total_size() < 50000 ) {
|
||||
bottom.erase();
|
||||
bottom_clip.erase();
|
||||
|
@ -259,7 +259,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
"Generating top half (" << clip_line << "-" <<
|
||||
max.y() << ")" );
|
||||
|
||||
FGPolygon top, top_clip;
|
||||
TGPolygon top, top_clip;
|
||||
if ( shape.total_size() < 50000 ) {
|
||||
top.erase();
|
||||
top_clip.erase();
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
|
||||
// process shape (write polygon to all intersecting tiles)
|
||||
void split_polygon(const string& path, AreaType area, const FGPolygon& shape);
|
||||
void split_polygon(const string& path, AreaType area, const TGPolygon& shape);
|
||||
|
||||
|
||||
#endif // _SPLIT_HXX
|
||||
|
|
|
@ -52,10 +52,10 @@ class FGSuperPoly {
|
|||
private:
|
||||
|
||||
string material; // material/texture name
|
||||
FGPolygon poly; // master polygon
|
||||
FGPolygon normals; // corresponding normals
|
||||
FGPolygon texcoords; // corresponding texture coordinates
|
||||
FGPolygon tris; // triangulation
|
||||
TGPolygon poly; // master polygon
|
||||
TGPolygon normals; // corresponding normals
|
||||
TGPolygon texcoords; // corresponding texture coordinates
|
||||
TGPolygon tris; // triangulation
|
||||
GLenum tri_mode; // GL_TRIANGLE, GL_FAN, GL_TRISTRIP, etc.
|
||||
string flag; // For various potential record keeping needs
|
||||
|
||||
|
@ -68,17 +68,17 @@ public:
|
|||
inline string get_material() const { return material; }
|
||||
inline void set_material( const string &m ) { material = m; }
|
||||
|
||||
inline FGPolygon get_poly() const { return poly; }
|
||||
inline void set_poly( const FGPolygon &p ) { poly = p; }
|
||||
inline TGPolygon get_poly() const { return poly; }
|
||||
inline void set_poly( const TGPolygon &p ) { poly = p; }
|
||||
|
||||
inline FGPolygon get_normals() const { return normals; }
|
||||
inline void set_normals( const FGPolygon &p ) { normals = p; }
|
||||
inline TGPolygon get_normals() const { return normals; }
|
||||
inline void set_normals( const TGPolygon &p ) { normals = p; }
|
||||
|
||||
inline FGPolygon get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( const FGPolygon &p ) { texcoords = p; }
|
||||
inline TGPolygon get_texcoords() const { return texcoords; }
|
||||
inline void set_texcoords( const TGPolygon &p ) { texcoords = p; }
|
||||
|
||||
inline FGPolygon get_tris() const { return tris; }
|
||||
inline void set_tris( const FGPolygon &p ) { tris = p; }
|
||||
inline TGPolygon get_tris() const { return tris; }
|
||||
inline void set_tris( const TGPolygon &p ) { tris = p; }
|
||||
|
||||
inline GLenum get_tri_mode() const { return tri_mode; }
|
||||
inline void set_tri_mode( const GLenum &m ) { tri_mode = m; }
|
||||
|
|
|
@ -169,7 +169,7 @@ processPoints (const E00 &data, const tg::Rectangle &bounds,
|
|||
int nPoints = data.nPoints();
|
||||
cout << "Processing " << nPoints << " points" << endl;
|
||||
for (int i = 1; i <= nPoints; i++) {
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
const E00::LAB &lab = data.getLAB(i);
|
||||
Point3D p(lab.coord.x, lab.coord.y, 0);
|
||||
|
||||
|
@ -201,7 +201,7 @@ processLines (const E00 &data, const tg::Rectangle &bounds,
|
|||
int nLines = data.nLines();
|
||||
cout << "Processing " << nLines << " lines." << endl;
|
||||
for (int i = 1; i <= nLines; i++) {
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
const E00::ARC &arc = data.getARC(i);
|
||||
tg::Rectangle arcBounds = makeBounds(arc);
|
||||
if (!bounds.isOverlapping(arcBounds)) {
|
||||
|
@ -260,7 +260,7 @@ processPolygons (const E00 &data, const tg::Rectangle &bounds,
|
|||
cout << "Processing " << nPolygons << " polygons" << endl;
|
||||
|
||||
for (int i = 2; i <= nPolygons; i++) {
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
// Test whether the polygon matches
|
||||
// at least one of the attributes
|
||||
// provided.
|
||||
|
|
|
@ -59,7 +59,7 @@ AreaType get_shapefile_type(int rec) {
|
|||
|
||||
|
||||
// write result to unique file name
|
||||
void write_result( const FGPolygon& result ) {
|
||||
void write_result( const TGPolygon& result ) {
|
||||
static int count = 0;
|
||||
char fname[256];
|
||||
FILE *fp;
|
||||
|
@ -94,10 +94,10 @@ void write_result( const FGPolygon& result ) {
|
|||
// process shape front end ... split shape into lon = -180 ... 180,
|
||||
// -360 ... -180, and 180 ... 360 ... shift the offset sections and
|
||||
// process each separately
|
||||
void gen_clipped_polygon( const FGPolygon& shape, const FGPolygon& clip ) {
|
||||
FGPolygon lower_mask, center_mask, upper_mask;
|
||||
FGPolygon lower_shape, center_shape, upper_shape;
|
||||
FGPolygon result;
|
||||
void gen_clipped_polygon( const TGPolygon& shape, const TGPolygon& clip ) {
|
||||
TGPolygon lower_mask, center_mask, upper_mask;
|
||||
TGPolygon lower_shape, center_shape, upper_shape;
|
||||
TGPolygon result;
|
||||
|
||||
lower_mask.erase();
|
||||
lower_mask.add_node( 0, Point3D(-360, -90, 0) );
|
||||
|
@ -143,7 +143,7 @@ void gen_clipped_polygon( const FGPolygon& shape, const FGPolygon& clip ) {
|
|||
int main( int argc, char **argv ) {
|
||||
struct GSHHS h;
|
||||
struct POINT p;
|
||||
FGPolygon shape, clip;
|
||||
TGPolygon shape, clip;
|
||||
double w, e, s, n, area, lon, lat;
|
||||
int k, max_east = 270000000;
|
||||
char source;
|
||||
|
|
|
@ -44,10 +44,10 @@ SG_USING_STD(string);
|
|||
// -360 ... -180, and 180 ... 360 ... shift the offset sections and
|
||||
// process each separately
|
||||
void split_and_shift_chunk( const string& path, AreaType area,
|
||||
const FGPolygon& shape )
|
||||
const TGPolygon& shape )
|
||||
{
|
||||
FGPolygon lower_mask, center_mask, upper_mask;
|
||||
FGPolygon lower_shape, center_shape, upper_shape;
|
||||
TGPolygon lower_mask, center_mask, upper_mask;
|
||||
TGPolygon lower_shape, center_shape, upper_shape;
|
||||
|
||||
lower_mask.erase();
|
||||
lower_mask.add_node( 0, Point3D(-360, -90, 0) );
|
||||
|
@ -95,7 +95,7 @@ void split_and_shift_chunk( const string& path, AreaType area,
|
|||
|
||||
// process a large shape through my crude polygon splitter to reduce
|
||||
// the polygon sizes before handing off to gpc
|
||||
void gshhs_split_polygon( const string& path, AreaType area, FGPolygon& shape,
|
||||
void gshhs_split_polygon( const string& path, AreaType area, TGPolygon& shape,
|
||||
const double min, const double max )
|
||||
{
|
||||
double base_line = (int)(min - 1.0);
|
||||
|
@ -106,8 +106,8 @@ void gshhs_split_polygon( const string& path, AreaType area, FGPolygon& shape,
|
|||
while ( line < max ) {
|
||||
printf("clipping at %.10f\n", line);
|
||||
|
||||
FGPolygon above = horizontal_clip( shape, line, Above );
|
||||
FGPolygon below = horizontal_clip( shape, line, Below );
|
||||
TGPolygon above = horizontal_clip( shape, line, Above );
|
||||
TGPolygon below = horizontal_clip( shape, line, Below );
|
||||
|
||||
// #define WRITE_FILE
|
||||
#ifdef WRITE_FILE
|
||||
|
|
|
@ -33,12 +33,12 @@
|
|||
// -360 ... -180, and 180 ... 360 ... shift the offset sections and
|
||||
// process each separately
|
||||
void split_and_shift_chunk( const string& path, AreaType area,
|
||||
const FGPolygon& shape );
|
||||
const TGPolygon& shape );
|
||||
|
||||
|
||||
// process a large shape through my crude polygon splitter to reduce
|
||||
// the polygon sizes before handing off to gpc
|
||||
void gshhs_split_polygon( const string& path, AreaType area, FGPolygon& shape,
|
||||
void gshhs_split_polygon( const string& path, AreaType area, TGPolygon& shape,
|
||||
const double min, const double max );
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ SG_USING_STD( cout );
|
|||
int main( int argc, char **argv ) {
|
||||
struct GSHHS h;
|
||||
struct POINT p;
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
double w, e, s, n, area, lon, lat, last_lon, last_lat;
|
||||
int k, max_east = 270000000;
|
||||
char source;
|
||||
|
|
|
@ -74,7 +74,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
exit(-1);
|
||||
}
|
||||
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
|
||||
Point3D p;
|
||||
in >> skipcomment;
|
||||
|
@ -155,7 +155,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
|
||||
void FGMerger::merge( FGPolyList& clipped ) {
|
||||
|
||||
FGPolygon poly, result, sliver;
|
||||
TGPolygon poly, result, sliver;
|
||||
bool done;
|
||||
done=false;
|
||||
|
||||
|
@ -186,7 +186,7 @@ void FGMerger::merge( FGPolyList& clipped ) {
|
|||
|
||||
|
||||
void FGMerger::clip(FGPolyList& subject, FGPolyList& clip) {
|
||||
FGPolygon poly, result, cliped, difference;
|
||||
TGPolygon poly, result, cliped, difference;
|
||||
int max_a[FG_MAX_AREA_TYPES];
|
||||
int area;
|
||||
int max_area = 0;
|
||||
|
@ -220,8 +220,8 @@ void FGMerger::clip(FGPolyList& subject, FGPolyList& clip) {
|
|||
}
|
||||
|
||||
void FGMerger::write(FGPolyList& subject, string& file) {
|
||||
FGPolygon poly;
|
||||
char tile_name[256], poly_index[256];
|
||||
TGPolygon poly;
|
||||
char poly_index[256];
|
||||
|
||||
for ( int area = 0; area < FG_MAX_AREA_TYPES; ++area ) {
|
||||
//cout << " testing area = " << area << endl;
|
||||
|
|
|
@ -48,7 +48,7 @@ SG_USING_STD(vector);
|
|||
class FGPolyList {
|
||||
public:
|
||||
poly_list polys[FG_MAX_AREA_TYPES];
|
||||
FGPolygon safety_base;
|
||||
TGPolygon safety_base;
|
||||
};
|
||||
|
||||
class FGMerger {
|
||||
|
|
|
@ -301,7 +301,7 @@ int main( int argc, char **argv ) {
|
|||
write_index( objpath, b, name );
|
||||
|
||||
// create and write the 'hole' polygon
|
||||
FGPolygon hole; hole.erase();
|
||||
TGPolygon hole; hole.erase();
|
||||
Point3D p;
|
||||
|
||||
for ( i = 0; i <= xdiv; ++i ) {
|
||||
|
|
|
@ -254,7 +254,7 @@ AreaType get_shapefile_type(DBFHandle& hDBF, int rec) {
|
|||
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
int i, j;
|
||||
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
|
|
@ -151,7 +151,7 @@ AreaType get_shapefile_type(DBFHandle& hDBF, int rec) {
|
|||
|
||||
|
||||
int main( int argc, char **argv ) {
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
int i, j;
|
||||
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
|
|
@ -106,10 +106,10 @@ vpf2tg (const VpfRectangle &rect)
|
|||
/**
|
||||
* Convert a VPF polygon to a TerraGear polygon.
|
||||
*/
|
||||
static const FGPolygon
|
||||
static const TGPolygon
|
||||
vpf2tg (const VpfPolygon &polygon)
|
||||
{
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
|
||||
shape.erase();
|
||||
int nContours = polygon.getContourCount();
|
||||
|
@ -184,7 +184,7 @@ checkAttribute (const VpfFeature &feature, int index, const Attribute &att)
|
|||
* @return The area of the bounding rectangle in m^2.
|
||||
*/
|
||||
static double
|
||||
getArea (const FGPolygon &polygon)
|
||||
getArea (const TGPolygon &polygon)
|
||||
{
|
||||
tg::Rectangle bounds = tg::makeBounds(polygon);
|
||||
Point3D min =
|
||||
|
@ -400,7 +400,7 @@ main (int argc, const char **argv)
|
|||
//
|
||||
// Make the TerraGear polygon for the bounds.
|
||||
//
|
||||
FGPolygon bounds_poly = bounds.toPoly();
|
||||
TGPolygon bounds_poly = bounds.toPoly();
|
||||
|
||||
//
|
||||
// Show settings.
|
||||
|
@ -449,7 +449,7 @@ main (int argc, const char **argv)
|
|||
cerr << "Searching through " << nTopologies << " topologies" << endl;
|
||||
int nAttributes = attributes.size();
|
||||
|
||||
FGPolygon mask;
|
||||
TGPolygon mask;
|
||||
for (int i = 0; i < nTopologies; i++) {
|
||||
if ((i % 1000) == 0)
|
||||
cerr << i << "..." << endl;
|
||||
|
@ -469,7 +469,7 @@ main (int argc, const char **argv)
|
|||
if (skip)
|
||||
continue;
|
||||
|
||||
FGPolygon shape;
|
||||
TGPolygon shape;
|
||||
switch (type) {
|
||||
// FIXME: check for attributes as well
|
||||
case VpfFeature::POINT: {
|
||||
|
|
|
@ -22,7 +22,7 @@ SG_USING_STD(vector);
|
|||
static string prog_name;
|
||||
static string work_dir = ".";
|
||||
static tg::Rectangle bounds(Point3D(-180, -90, 0), Point3D(180, 90, 0));
|
||||
static FGPolygon bounds_poly;
|
||||
static TGPolygon bounds_poly;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -62,7 +62,7 @@ add_point (SGPropertyNode_ptr node)
|
|||
s = parse_point(s, dummy);
|
||||
if (s != 0)
|
||||
SG_LOG(SG_TERRAIN, SG_WARN, "More than one vertex supplied for point");
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
tg::makePolygon(p, node->getIntValue("width", 500), poly);
|
||||
poly = polygon_int(poly, bounds_poly);
|
||||
split_polygon(".", material, poly);
|
||||
|
@ -83,7 +83,7 @@ add_line (SGPropertyNode_ptr node)
|
|||
s = parse_point(s, p);
|
||||
}
|
||||
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
tg::makePolygon(line, node->getIntValue("width", 10), poly);
|
||||
poly = polygon_int(poly, bounds_poly);
|
||||
split_polygon(".", material, poly);
|
||||
|
@ -92,7 +92,7 @@ add_line (SGPropertyNode_ptr node)
|
|||
static void
|
||||
add_polygon (SGPropertyNode_ptr node)
|
||||
{
|
||||
FGPolygon poly;
|
||||
TGPolygon poly;
|
||||
AreaType material =
|
||||
get_area_type(node->getStringValue("material", "Default"));
|
||||
vector<SGPropertyNode_ptr> contour_nodes = node->getChildren("contour");
|
||||
|
|
Loading…
Add table
Reference in a new issue