Initial revision.
This commit is contained in:
parent
c4666a4c4a
commit
8f14bf2e84
4 changed files with 728 additions and 0 deletions
380
Areas/Makefile
Normal file
380
Areas/Makefile
Normal file
|
@ -0,0 +1,380 @@
|
||||||
|
# Generated automatically from Makefile.in by configure.
|
||||||
|
# Makefile.in generated automatically by automake 1.2h from Makefile.am
|
||||||
|
|
||||||
|
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||||
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
|
# with or without modifications, as long as this notice is preserved.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||||
|
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE.
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Makefile
|
||||||
|
#
|
||||||
|
# Written by Curtis Olson, started January 1998.
|
||||||
|
#
|
||||||
|
# Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
#
|
||||||
|
# $Id$
|
||||||
|
# (Log is kept at end of this file)
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
SHELL = /bin/sh
|
||||||
|
|
||||||
|
srcdir = .
|
||||||
|
top_srcdir = ../..
|
||||||
|
prefix = /usr/local
|
||||||
|
exec_prefix = ${prefix}
|
||||||
|
|
||||||
|
bindir = ${exec_prefix}/bin
|
||||||
|
sbindir = ${exec_prefix}/sbin
|
||||||
|
libexecdir = ${exec_prefix}/libexec
|
||||||
|
datadir = ${prefix}/share
|
||||||
|
sysconfdir = ${prefix}/etc
|
||||||
|
sharedstatedir = ${prefix}/com
|
||||||
|
localstatedir = ${prefix}/var
|
||||||
|
libdir = /opt/X11R6/lib
|
||||||
|
infodir = ${prefix}/info
|
||||||
|
mandir = ${prefix}/man
|
||||||
|
includedir = ${prefix}/include
|
||||||
|
oldincludedir = /usr/include
|
||||||
|
|
||||||
|
DISTDIR =
|
||||||
|
|
||||||
|
pkgdatadir = $(datadir)/FlightGear
|
||||||
|
pkglibdir = $(libdir)/FlightGear
|
||||||
|
pkgincludedir = $(includedir)/FlightGear
|
||||||
|
|
||||||
|
top_builddir = ../..
|
||||||
|
|
||||||
|
ACLOCAL = aclocal
|
||||||
|
AUTOCONF = autoconf
|
||||||
|
AUTOMAKE = automake
|
||||||
|
AUTOHEADER = autoheader
|
||||||
|
|
||||||
|
INSTALL = /usr/bin/install -c
|
||||||
|
INSTALL_PROGRAM = ${INSTALL}
|
||||||
|
INSTALL_DATA = ${INSTALL} -m 644
|
||||||
|
INSTALL_SCRIPT = ${INSTALL_PROGRAM}
|
||||||
|
transform = s,x,x,
|
||||||
|
|
||||||
|
NORMAL_INSTALL = :
|
||||||
|
PRE_INSTALL = :
|
||||||
|
POST_INSTALL = :
|
||||||
|
NORMAL_UNINSTALL = :
|
||||||
|
PRE_UNINSTALL = :
|
||||||
|
POST_UNINSTALL = :
|
||||||
|
host_alias = i586-pc-linux-gnulibc1
|
||||||
|
host_triplet = i586-pc-linux-gnulibc1
|
||||||
|
CC = gcc
|
||||||
|
CXX = c++
|
||||||
|
LD = /usr/bin/ld
|
||||||
|
LIBTOOL = $(SHELL) $(top_builddir)/libtool
|
||||||
|
LN_S = ln -s
|
||||||
|
MAINT = #M#
|
||||||
|
MAKEINFO = /amd/wiley/export/home/curt/projects/FlightGear/missing makeinfo
|
||||||
|
NM = /usr/bin/nm -B
|
||||||
|
PACKAGE = FlightGear
|
||||||
|
RANLIB = ranlib
|
||||||
|
VERSION = 0.51
|
||||||
|
|
||||||
|
bin_PROGRAMS = areas
|
||||||
|
|
||||||
|
areas_SOURCES = area.cxx area.hxx main.cxx
|
||||||
|
|
||||||
|
areas_LDADD = $(top_builddir)/Lib/Bucket/libBucket.la
|
||||||
|
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||||
|
CONFIG_HEADER = ../../Include/config.h
|
||||||
|
CONFIG_CLEAN_FILES =
|
||||||
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
|
||||||
|
DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I../../Include
|
||||||
|
CPPFLAGS = -I/usr/local/include -I/usr/X11R6/include
|
||||||
|
LDFLAGS = -L/usr/local/lib -L/usr/X11R6/lib
|
||||||
|
LIBS = -lglut -lMesaGLU -lMesaGL -lXmu -lXt -lSM -lICE -lXi -lXext -lX11 -lm
|
||||||
|
X_CFLAGS = -I/usr/X11R6/include
|
||||||
|
X_LIBS = -L/usr/X11R6/lib
|
||||||
|
X_EXTRA_LIBS =
|
||||||
|
X_PRE_LIBS = -lSM -lICE
|
||||||
|
areas_OBJECTS = area.o main.o
|
||||||
|
areas_DEPENDENCIES = $(top_builddir)/Lib/Bucket/libBucket.la
|
||||||
|
areas_LDFLAGS =
|
||||||
|
CXXFLAGS = -Wall
|
||||||
|
CXXCOMPILE = $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
CXXLINK = $(LIBTOOL) --mode=link $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@
|
||||||
|
DIST_COMMON = README Makefile.am Makefile.in
|
||||||
|
|
||||||
|
|
||||||
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
|
TAR = tar
|
||||||
|
GZIP = --best
|
||||||
|
DEP_FILES = .deps/area.P .deps/main.P
|
||||||
|
CXXMKDEP = $(CXX) -M $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
|
||||||
|
SOURCES = $(areas_SOURCES)
|
||||||
|
OBJECTS = $(areas_OBJECTS)
|
||||||
|
|
||||||
|
all: Makefile $(PROGRAMS)
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
.SUFFIXES: .S .c .cxx .lo .o .s
|
||||||
|
$(srcdir)/Makefile.in: #M# Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu Tools/Areas/Makefile
|
||||||
|
|
||||||
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
|
||||||
|
cd $(top_builddir) \
|
||||||
|
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-binPROGRAMS:
|
||||||
|
|
||||||
|
clean-binPROGRAMS:
|
||||||
|
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||||
|
|
||||||
|
distclean-binPROGRAMS:
|
||||||
|
|
||||||
|
maintainer-clean-binPROGRAMS:
|
||||||
|
|
||||||
|
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||||
|
@list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
if test -f $$p; then \
|
||||||
|
echo " $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`"; \
|
||||||
|
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||||
|
else :; fi; \
|
||||||
|
done
|
||||||
|
|
||||||
|
uninstall-binPROGRAMS:
|
||||||
|
@$(NORMAL_UNINSTALL)
|
||||||
|
list='$(bin_PROGRAMS)'; for p in $$list; do \
|
||||||
|
rm -f $(DESTDIR)$(bindir)/`echo $$p|sed '$(transform)'`; \
|
||||||
|
done
|
||||||
|
|
||||||
|
.s.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.o:
|
||||||
|
$(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-compile:
|
||||||
|
-rm -f *.o core *.core
|
||||||
|
|
||||||
|
clean-compile:
|
||||||
|
|
||||||
|
distclean-compile:
|
||||||
|
-rm -f *.tab.c
|
||||||
|
|
||||||
|
maintainer-clean-compile:
|
||||||
|
|
||||||
|
.s.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
.S.lo:
|
||||||
|
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
|
||||||
|
|
||||||
|
mostlyclean-libtool:
|
||||||
|
-rm -f *.lo
|
||||||
|
|
||||||
|
clean-libtool:
|
||||||
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
|
distclean-libtool:
|
||||||
|
|
||||||
|
maintainer-clean-libtool:
|
||||||
|
|
||||||
|
areas: $(areas_OBJECTS) $(areas_DEPENDENCIES)
|
||||||
|
@rm -f areas
|
||||||
|
$(CXXLINK) $(areas_LDFLAGS) $(areas_OBJECTS) $(areas_LDADD) $(LIBS)
|
||||||
|
.cxx.o:
|
||||||
|
$(CXXCOMPILE) -c $<
|
||||||
|
.cxx.lo:
|
||||||
|
$(LTCXXCOMPILE) -c $<
|
||||||
|
|
||||||
|
tags: TAGS
|
||||||
|
|
||||||
|
ID: $(HEADERS) $(SOURCES) $(LISP)
|
||||||
|
here=`pwd` && cd $(srcdir) \
|
||||||
|
&& mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
|
||||||
|
|
||||||
|
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
|
||||||
|
tags=; \
|
||||||
|
here=`pwd`; \
|
||||||
|
list='$(SOURCES) $(HEADERS)'; \
|
||||||
|
unique=`for i in $$list; do echo $$i; done | \
|
||||||
|
awk ' { files[$$0] = 1; } \
|
||||||
|
END { for (i in files) print i; }'`; \
|
||||||
|
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|
||||||
|
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
|
||||||
|
|
||||||
|
mostlyclean-tags:
|
||||||
|
|
||||||
|
clean-tags:
|
||||||
|
|
||||||
|
distclean-tags:
|
||||||
|
-rm -f TAGS ID
|
||||||
|
|
||||||
|
maintainer-clean-tags:
|
||||||
|
|
||||||
|
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
|
||||||
|
|
||||||
|
subdir = Tools/Areas
|
||||||
|
|
||||||
|
distdir: $(DISTFILES)
|
||||||
|
here=`cd $(top_builddir) && pwd`; \
|
||||||
|
top_distdir=`cd $(top_distdir) && pwd`; \
|
||||||
|
distdir=`cd $(distdir) && pwd`; \
|
||||||
|
cd $(top_srcdir) \
|
||||||
|
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu Tools/Areas/Makefile
|
||||||
|
@for file in $(DISTFILES); do \
|
||||||
|
d=$(srcdir); \
|
||||||
|
test -f $(distdir)/$$file \
|
||||||
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||||
|
done
|
||||||
|
|
||||||
|
DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :)
|
||||||
|
|
||||||
|
-include $(DEP_FILES)
|
||||||
|
|
||||||
|
mostlyclean-depend:
|
||||||
|
|
||||||
|
clean-depend:
|
||||||
|
|
||||||
|
distclean-depend:
|
||||||
|
|
||||||
|
maintainer-clean-depend:
|
||||||
|
-rm -rf .deps
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@echo '$(COMPILE) -c $<'; \
|
||||||
|
$(COMPILE) -Wp,-MD,.deps/$(*F).P -c $<
|
||||||
|
|
||||||
|
%.lo: %.c
|
||||||
|
@echo '$(LTCOMPILE) -c $<'; \
|
||||||
|
$(LTCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
|
||||||
|
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
|
||||||
|
< .deps/$(*F).p > .deps/$(*F).P
|
||||||
|
@-rm -f .deps/$(*F).p
|
||||||
|
|
||||||
|
%.o: %.cxx
|
||||||
|
@echo '$(CXXCOMPILE) -c $<'; \
|
||||||
|
$(CXXCOMPILE) -Wp,-MD,.deps/$(*F).P -c $<
|
||||||
|
|
||||||
|
%.lo: %.cxx
|
||||||
|
@echo '$(LTCXXCOMPILE) -c $<'; \
|
||||||
|
$(LTCXXCOMPILE) -Wp,-MD,.deps/$(*F).p -c $<
|
||||||
|
@-sed -e 's/^\([^:]*\)\.o:/\1.lo \1.o:/' \
|
||||||
|
< .deps/$(*F).p > .deps/$(*F).P
|
||||||
|
@-rm -f .deps/$(*F).p
|
||||||
|
info:
|
||||||
|
dvi:
|
||||||
|
check: all
|
||||||
|
$(MAKE)
|
||||||
|
installcheck:
|
||||||
|
install-exec: install-binPROGRAMS
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
|
||||||
|
install-data:
|
||||||
|
@$(NORMAL_INSTALL)
|
||||||
|
|
||||||
|
install: install-exec install-data all
|
||||||
|
@:
|
||||||
|
|
||||||
|
uninstall: uninstall-binPROGRAMS
|
||||||
|
|
||||||
|
install-strip:
|
||||||
|
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||||
|
installdirs:
|
||||||
|
$(mkinstalldirs) $(DATADIR)$(bindir)
|
||||||
|
|
||||||
|
|
||||||
|
mostlyclean-generic:
|
||||||
|
-test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
|
||||||
|
|
||||||
|
clean-generic:
|
||||||
|
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||||
|
|
||||||
|
distclean-generic:
|
||||||
|
-rm -f Makefile $(DISTCLEANFILES)
|
||||||
|
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||||
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
|
||||||
|
maintainer-clean-generic:
|
||||||
|
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||||
|
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||||
|
mostlyclean: mostlyclean-binPROGRAMS mostlyclean-compile \
|
||||||
|
mostlyclean-libtool mostlyclean-tags mostlyclean-depend \
|
||||||
|
mostlyclean-generic
|
||||||
|
|
||||||
|
clean: clean-binPROGRAMS clean-compile clean-libtool clean-tags \
|
||||||
|
clean-depend clean-generic mostlyclean
|
||||||
|
|
||||||
|
distclean: distclean-binPROGRAMS distclean-compile distclean-libtool \
|
||||||
|
distclean-tags distclean-depend distclean-generic clean
|
||||||
|
-rm -f config.status
|
||||||
|
-rm -f libtool
|
||||||
|
|
||||||
|
maintainer-clean: maintainer-clean-binPROGRAMS maintainer-clean-compile \
|
||||||
|
maintainer-clean-libtool maintainer-clean-tags \
|
||||||
|
maintainer-clean-depend maintainer-clean-generic \
|
||||||
|
distclean
|
||||||
|
@echo "This command is intended for maintainers to use;"
|
||||||
|
@echo "it deletes files that may require special tools to rebuild."
|
||||||
|
|
||||||
|
.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
|
||||||
|
maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
|
||||||
|
mostlyclean-compile distclean-compile clean-compile \
|
||||||
|
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
|
||||||
|
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
|
||||||
|
distclean-tags clean-tags maintainer-clean-tags distdir \
|
||||||
|
mostlyclean-depend distclean-depend clean-depend \
|
||||||
|
maintainer-clean-depend info dvi installcheck install-exec install-data \
|
||||||
|
install uninstall all installdirs mostlyclean-generic distclean-generic \
|
||||||
|
clean-generic maintainer-clean-generic clean mostlyclean distclean \
|
||||||
|
maintainer-clean
|
||||||
|
|
||||||
|
|
||||||
|
INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# $Log$
|
||||||
|
# Revision 1.1 1998/07/20 12:54:05 curt
|
||||||
|
# Initial revision.
|
||||||
|
#
|
||||||
|
# Revision 1.2 1998/04/14 02:25:59 curt
|
||||||
|
# Code reorganizations. Added a Lib/ directory for more general libraries.
|
||||||
|
#
|
||||||
|
# Revision 1.1 1998/04/08 22:54:57 curt
|
||||||
|
# Adopted Gnu automake/autoconf system.
|
||||||
|
#
|
||||||
|
# Revision 1.2 1998/01/21 02:55:46 curt
|
||||||
|
# Incorporated new make system from Bob Kuehne <rpk@sgi.com>.
|
||||||
|
#
|
||||||
|
# Revision 1.1 1998/01/15 02:45:25 curt
|
||||||
|
# Initial revision.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||||
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
.NOEXPORT:
|
161
Areas/area.cxx
Normal file
161
Areas/area.cxx
Normal file
|
@ -0,0 +1,161 @@
|
||||||
|
// area.c -- routines to assist with inserting "areas" into FG terrain
|
||||||
|
//
|
||||||
|
// Written by Curtis Olson, started March 1998.
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
// (Log is kept at end of this file)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <Include/fg_constants.h>
|
||||||
|
|
||||||
|
#include "area.hxx"
|
||||||
|
|
||||||
|
|
||||||
|
// calc new x, y for a rotation
|
||||||
|
double rot_x(double x, double y, double theta) {
|
||||||
|
return ( x * cos(theta) + y * sin(theta) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// calc new x, y for a rotation
|
||||||
|
double rot_y(double x, double y, double theta) {
|
||||||
|
return ( -x * sin(theta) + y * cos(theta) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// calc new lon/lat given starting lon/lat, and offset radial, and
|
||||||
|
// distance. NOTE: distance is specified in meters (and converted
|
||||||
|
// internally to radians)
|
||||||
|
point2d calc_lon_lat( point2d orig, point2d offset ) {
|
||||||
|
point2d result;
|
||||||
|
|
||||||
|
offset.dist *= METER_TO_NM * NM_TO_RAD;
|
||||||
|
|
||||||
|
result.lat = asin( sin(orig.lat) * cos(offset.dist) +
|
||||||
|
cos(orig.lat) * sin(offset.dist) * cos(offset.theta) );
|
||||||
|
|
||||||
|
if ( cos(result.lat) < FG_EPSILON ) {
|
||||||
|
result.lon = orig.lon; // endpoint a pole
|
||||||
|
} else {
|
||||||
|
result.lon =
|
||||||
|
fmod(orig.lon - asin( sin(offset.theta) * sin(offset.dist) /
|
||||||
|
cos(result.lat) ) + FG_PI, FG_2PI) - FG_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
point2d cart_to_polar_2d(point2d in) {
|
||||||
|
point2d result;
|
||||||
|
result.dist = sqrt( in.x * in.x + in.y * in.y );
|
||||||
|
result.theta = atan2(in.y, in.x);
|
||||||
|
|
||||||
|
return(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void batch_cart_to_polar_2d(point2d *in, point2d *out, int size) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for ( i = 0; i < size; i++ ) {
|
||||||
|
out[i] = cart_to_polar_2d( in[i] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// given a set of 2d coordinates relative to a center point, and the
|
||||||
|
// lon, lat of that center point, as well as a potential orientation
|
||||||
|
// angle, generate the corresponding lon and lat of the original 2d
|
||||||
|
// verticies.
|
||||||
|
void make_area(point2d orig, point2d *cart, point2d *result,
|
||||||
|
int size, double angle ) {
|
||||||
|
point2d rad[size];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// convert to polar coordinates
|
||||||
|
batch_cart_to_polar_2d(cart, rad, size);
|
||||||
|
for ( i = 0; i < size; i++ ) {
|
||||||
|
printf("(%.2f, %.2f)\n", rad[i].dist, rad[i].theta);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
// rotate by specified angle
|
||||||
|
for ( i = 0; i < size; i++ ) {
|
||||||
|
rad[i].theta += angle;
|
||||||
|
while ( rad[i].theta > FG_2PI ) {
|
||||||
|
rad[i].theta -= FG_2PI;
|
||||||
|
}
|
||||||
|
printf("(%.2f, %.2f)\n", rad[i].dist, rad[i].theta);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
for ( i = 0; i < size; i++ ) {
|
||||||
|
result[i] = calc_lon_lat(orig, rad[i]);
|
||||||
|
printf("(%.8f, %.8f)\n", result[i].lon, result[i].lat);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// generate an area for a runway
|
||||||
|
void gen_runway_area( double lon, double lat, double heading,
|
||||||
|
double length, double width,
|
||||||
|
point2d *result, int *count)
|
||||||
|
{
|
||||||
|
point2d cart[4];
|
||||||
|
point2d orig;
|
||||||
|
double l, w;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
orig.lon = lon;
|
||||||
|
orig.lat = lat;
|
||||||
|
l = (length / 2.0) + (length * 0.1);
|
||||||
|
w = (width / 2.0) + (width * 0.1);
|
||||||
|
|
||||||
|
// generate untransformed runway area vertices
|
||||||
|
cart[0].x = l; cart[0].y = w;
|
||||||
|
cart[1].x = l; cart[1].y = -w;
|
||||||
|
cart[2].x = -l; cart[2].y = -w;
|
||||||
|
cart[3].x = -l; cart[3].y = w;
|
||||||
|
for ( i = 0; i < 4; i++ ) {
|
||||||
|
printf("(%.2f, %.2f)\n", cart[i].x, cart[i].y);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
make_area(orig, cart, result, 4, heading);
|
||||||
|
|
||||||
|
for ( i = 0; i < 4; i++ ) {
|
||||||
|
printf("(%.8f, %.8f)\n", result[i].lon, result[i].lat);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
*count = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $Log$
|
||||||
|
// Revision 1.1 1998/07/20 12:54:05 curt
|
||||||
|
// Initial revision.
|
||||||
|
//
|
||||||
|
//
|
57
Areas/area.hxx
Normal file
57
Areas/area.hxx
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// area.h -- routines to assist with inserting "areas" into FG terrain
|
||||||
|
//
|
||||||
|
// Written by Curtis Olson, started February 1998.
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
// (Log is kept at end of this file)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _AREA_H
|
||||||
|
#define _AREA_H
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
union {
|
||||||
|
double x;
|
||||||
|
double dist;
|
||||||
|
double lon;
|
||||||
|
};
|
||||||
|
union {
|
||||||
|
double y;
|
||||||
|
double theta;
|
||||||
|
double lat;
|
||||||
|
};
|
||||||
|
} point2d;
|
||||||
|
|
||||||
|
|
||||||
|
// generate an area for a runway
|
||||||
|
void gen_runway_area( double lon, double lat, double heading,
|
||||||
|
double length, double width,
|
||||||
|
point2d *result, int *count );
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _AREA_H
|
||||||
|
|
||||||
|
|
||||||
|
// $Log$
|
||||||
|
// Revision 1.1 1998/07/20 12:54:05 curt
|
||||||
|
// Initial revision.
|
||||||
|
//
|
||||||
|
//
|
130
Areas/main.cxx
Normal file
130
Areas/main.cxx
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
// main.c -- main loop
|
||||||
|
//
|
||||||
|
// Written by Curtis Olson, started March 1998.
|
||||||
|
//
|
||||||
|
// Copyright (C) 1998 Curtis L. Olson - curt@me.umn.edu
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation; either version 2 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
// (Log is kept at end of this file)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "area.hxx"
|
||||||
|
|
||||||
|
#include <Bucket/bucketutils.h>
|
||||||
|
#include <Include/fg_constants.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main( int argc, char **argv ) {
|
||||||
|
fgBUCKET b;
|
||||||
|
point2d nodes[4];
|
||||||
|
FILE *fd;
|
||||||
|
char base[256], path[256], command[256], file[256], exfile[256];
|
||||||
|
double lon, lat, elevation, heading;
|
||||||
|
double length, width;
|
||||||
|
long int index;
|
||||||
|
int i, count;
|
||||||
|
|
||||||
|
if ( argc != 2 ) {
|
||||||
|
printf("Usage %s <work dir>\n", argv[0]);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// P13 (Globe, AZ)
|
||||||
|
// lon = -110.6642442;
|
||||||
|
// lat = 33.3528903;
|
||||||
|
// heading = 102.0 * DEG_TO_RAD;
|
||||||
|
// length = 1769;
|
||||||
|
// width = 23;
|
||||||
|
|
||||||
|
// KANE
|
||||||
|
lon = -93.2113889;
|
||||||
|
lat = 45.145;
|
||||||
|
elevation = 912 * FEET_TO_METER;
|
||||||
|
heading = 270.0 * DEG_TO_RAD;
|
||||||
|
length = 1220;
|
||||||
|
width = 23;
|
||||||
|
|
||||||
|
gen_runway_area( lon * DEG_TO_RAD, lat * DEG_TO_RAD,
|
||||||
|
heading, length, width, nodes, &count );
|
||||||
|
|
||||||
|
fgBucketFind(lon, lat, &b);
|
||||||
|
printf( "Bucket = lon,lat = %d,%d x,y index = %d,%d\n",
|
||||||
|
b.lon, b.lat, b.x, b.y);
|
||||||
|
|
||||||
|
index = fgBucketGenIndex(&b);
|
||||||
|
fgBucketGenBasePath(&b, base);
|
||||||
|
sprintf(path, "%s/Scenery/%s", argv[1], base);
|
||||||
|
sprintf(command, "mkdir -p %s\n", path);
|
||||||
|
system(command);
|
||||||
|
|
||||||
|
sprintf(exfile, "%s/%ld.node.ex", path, index);
|
||||||
|
sprintf(file, "%s/%ld.poly", path, index);
|
||||||
|
printf( "extra node file = %s\n", exfile);
|
||||||
|
printf( "poly file = %s\n", file);
|
||||||
|
|
||||||
|
// output extra nodes
|
||||||
|
if ( (fd = fopen(exfile, "w")) == NULL ) {
|
||||||
|
printf("Cannot open file: %s\n", exfile);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(fd, "%d 2 0 0\n", count);
|
||||||
|
for ( i = 0; i < count; i++ ) {
|
||||||
|
fprintf( fd, "%d %.2f %.2f %.2f\n", i + 1,
|
||||||
|
nodes[i].lon * RAD_TO_ARCSEC, nodes[i].lat * RAD_TO_ARCSEC,
|
||||||
|
elevation);
|
||||||
|
}
|
||||||
|
fclose(fd);
|
||||||
|
|
||||||
|
// output poly
|
||||||
|
if ( (fd = fopen(file, "w")) == NULL ) {
|
||||||
|
printf("Cannot open file: %s\n", file);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// output empty node list
|
||||||
|
fprintf(fd, "0 2 0 0\n");
|
||||||
|
|
||||||
|
// output segments
|
||||||
|
fprintf(fd, "%d 0\n", count);
|
||||||
|
for ( i = 0; i < count - 1; i++ ) {
|
||||||
|
fprintf( fd, "%d %d %d\n", i + 1, i + 1, i + 2 );
|
||||||
|
}
|
||||||
|
fprintf( fd, "%d %d %d\n", count, count, 1 );
|
||||||
|
|
||||||
|
// output hole center
|
||||||
|
fprintf( fd, "1\n");
|
||||||
|
fprintf( fd, "1 %.2f %.2f\n", lon * 3600.0, lat * 3600);
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $Log: main.c,v
|
||||||
|
//
|
Loading…
Add table
Reference in a new issue