Convert helipad routine to Vec3
This commit is contained in:
parent
4d3f1efd30
commit
bda3ee3a91
4 changed files with 11 additions and 17 deletions
|
@ -566,8 +566,8 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
|
|||
}
|
||||
for (unsigned int i=0; i<helipads.size(); i++)
|
||||
{
|
||||
apt_lon += helipads[i]->GetLoc().x();
|
||||
apt_lat += helipads[i]->GetLoc().y();
|
||||
apt_lon += helipads[i]->GetLoc().getLongitudeDeg();
|
||||
apt_lat += helipads[i]->GetLoc().getLatitudeDeg();
|
||||
num_samples++;
|
||||
}
|
||||
apt_lon = apt_lon / (double)num_samples;
|
||||
|
|
|
@ -46,9 +46,7 @@ superpoly_list Helipad::gen_helipad_lights(double maxsize){
|
|||
point_list y_normals; y_normals.clear();
|
||||
|
||||
// Vector calculation
|
||||
Point3D vec = sgGeodToCart( GetLoc() * SG_DEGREES_TO_RADIANS );
|
||||
double length = vec.distance3D( Point3D(0.0) );
|
||||
vec = vec / length;
|
||||
SGVec3d vec = normalize(SGVec3d::fromGeod(GetLoc()));
|
||||
|
||||
// Create yellow edge lights, 5m spacing
|
||||
int divs = (int)(maxsize / 5.0);
|
||||
|
@ -60,19 +58,15 @@ superpoly_list Helipad::gen_helipad_lights(double maxsize){
|
|||
inc = (area.get_pt(0, i==3 ? 0 : i+1) - area.get_pt(0,i)) / divs;
|
||||
for ( int j = 0; j < divs; ++j) {
|
||||
y_lights.push_back( pt);
|
||||
y_normals.push_back( vec );
|
||||
y_normals.push_back(Point3D::fromSGVec3(vec));
|
||||
pt += inc;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a circle of yellow lights where the white texture circle is
|
||||
double lat = 0, lon = 0, az;
|
||||
for (int deg = 0; deg < 360; deg += 45){
|
||||
geo_direct_wgs_84(0, heli.lat, heli.lon, deg ,
|
||||
maxsize * 0.46 , &lat, &lon, &az );
|
||||
|
||||
y_lights.push_back( Point3D( lon, lat, 0.0 ) );
|
||||
y_normals.push_back( vec );
|
||||
y_lights.push_back( Point3D::fromSGGeod( SGGeodesy::direct(GetLoc(), deg, maxsize * 0.46)) );
|
||||
y_normals.push_back( Point3D::fromSGVec3(vec) );
|
||||
}
|
||||
|
||||
TGPolygon lights_poly; lights_poly.erase();
|
||||
|
@ -141,7 +135,7 @@ void Helipad::BuildBtg( superpoly_list *rwy_polys,
|
|||
area_side = true;
|
||||
}
|
||||
|
||||
TGPolygon helipad = gen_wgs84_area( GetLoc(), maxsize, 0, 0, maxsize, heli.heading, false);
|
||||
TGPolygon helipad = gen_wgs84_area( Point3D::fromSGGeod(GetLoc()), maxsize, 0, 0, maxsize, heli.heading, false);
|
||||
helipad = snap( helipad, gSnap );
|
||||
string material, shoulder_mat;
|
||||
if (heli.surface == 1)
|
||||
|
|
|
@ -26,9 +26,9 @@ public:
|
|||
Helipad(char* def);
|
||||
void BuildBtg( superpoly_list* heli_polys, texparams_list* texparams, superpoly_list* heli_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing );
|
||||
|
||||
Point3D GetLoc()
|
||||
SGGeod GetLoc()
|
||||
{
|
||||
return Point3D( heli.lon, heli.lat, 0.0f );
|
||||
return SGGeod::fromDeg(heli.lon, heli.lat);
|
||||
}
|
||||
|
||||
bool GetsShoulder()
|
||||
|
@ -66,7 +66,7 @@ private:
|
|||
// (return result points in degrees)
|
||||
TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend )
|
||||
{
|
||||
return ( gen_wgs84_area( GetLoc(), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, false) );
|
||||
return ( gen_wgs84_area( Point3D::fromSGGeod(GetLoc()), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, false) );
|
||||
}
|
||||
|
||||
superpoly_list gen_helipad_lights(double maxsize);
|
||||
|
|
|
@ -722,7 +722,7 @@ bool Scheduler::AddAirports( long start_pos, float min_lat, float min_lon, float
|
|||
// a winner
|
||||
{
|
||||
Helipad* helipad = new Helipad(def);
|
||||
Point3D loc = helipad->GetLoc();
|
||||
Point3D loc = Point3D::fromSGGeod(helipad->GetLoc()) ;
|
||||
if ( (loc.x() >= min_lon ) &&
|
||||
(loc.y() >= min_lat ) &&
|
||||
(loc.x() <= max_lon ) &&
|
||||
|
|
Loading…
Reference in a new issue