summaryrefslogtreecommitdiff
path: root/module/math
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /module/math
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'module/math')
-rw-r--r--module/math/geodesy.m58
-rw-r--r--module/math/polyfill.m18
-rw-r--r--module/math/polyhedra.m25
3 files changed, 101 insertions, 0 deletions
diff --git a/module/math/geodesy.m b/module/math/geodesy.m
new file mode 100644
index 00000000..77ae1af0
--- /dev/null
+++ b/module/math/geodesy.m
@@ -0,0 +1,58 @@
+Geodesy: module
+{
+ PATH: con "/dis/math/geodesy.dis";
+
+ # easting, northing in metres
+ Eano: adt{
+ e: real;
+ n: real;
+ };
+
+ # latitude, longitude in radians
+ Lalo: adt{
+ la: real;
+ lo: real;
+ };
+
+ # datums
+ # WGS84 and ITRS2000 effectively the same
+ OSGB36, Ireland65, ED50, WGS84, ITRS2000, ETRS89: con iota;
+
+ # transverse Mercator projections
+ Natgrid, IrishNatgrid, UTMEur, UTM: con iota;
+
+ # call first
+ # d specifies the datum (default WGS84)
+ # t specifies the transverse Mercator projection (default Natgrid)
+ # z specifies the UTM zone if relevant (default 30)
+ # calls format below
+ init: fn(d: int, t: int, z: int);
+
+ # alters the current datum, transverse Mercator projection and UTM zone
+ # use a negative value to leave unaltered
+ format: fn(d: int, t: int, z: int);
+
+ # OS string to (easting, northing) and back
+ # formats XYen, XYeenn, XYeeennn, XYeeeennnn, XYeeeeennnnn or
+ # formats eenn, eeennn, eeeennnn, eeeeennnnn, eeeeeennnnnn
+ os2en: fn(s: string): (int, Eano); # returns (0, ...) if bad string format
+ en2os: fn(en: Eano): string;
+
+ # latitude/longitude string to (latitude, longitude) and back
+ # format latitude longitude
+ # formats deg[N|S], deg:min[N|S], deg:min:sec[N|S] for latitude
+ # formats deg[E|W], deg:min[E|W], deg:min:sec[E|W] for longitude
+ str2lalo: fn(s: string): (int, Lalo); # returns (0, ...) if bad string format
+ lalo2str: fn(lalo: Lalo): string;
+
+ # general string to (easting, northing)
+ # OS grid or latitude/longitude format as above
+ str2en: fn(s: string): (int, Eano); # returns (0, ...) if bad string format
+
+ # (easting, northing) to (latitude, longitude) and back
+ en2lalo: fn(en: Eano): Lalo;
+ lalo2en: fn(lalo: Lalo): Eano;
+
+ # approximate transformations between any of OSGB36, WGS84, ITRS2000, ETRS89
+ datum2datum: fn(lalo: Lalo, f: int, t: int): Lalo;
+};
diff --git a/module/math/polyfill.m b/module/math/polyfill.m
new file mode 100644
index 00000000..be9af8db
--- /dev/null
+++ b/module/math/polyfill.m
@@ -0,0 +1,18 @@
+Polyfill: module
+{
+ PATH: con "/dis/math/polyfill.dis";
+
+ Zstate: adt{
+ r: Draw->Rect;
+ zbuf0, zbuf1: array of int;
+ xlen: int;
+ ylen: int;
+ xylen: int;
+ };
+
+ init: fn();
+ initzbuf: fn(r: Draw->Rect): ref Zstate;
+ clearzbuf: fn(s: ref Zstate);
+ setzbuf: fn(s: ref Zstate, zd: int);
+ fillpoly: fn(d: ref Image, v: array of Point, w: int, s: ref Image, p: Point, zstate: ref Zstate, dc, dx, dy: int);
+}; \ No newline at end of file
diff --git a/module/math/polyhedra.m b/module/math/polyhedra.m
new file mode 100644
index 00000000..2b3e9ce6
--- /dev/null
+++ b/module/math/polyhedra.m
@@ -0,0 +1,25 @@
+Polyhedra: module
+{
+ PATH: con "/dis/math/polyhedra.dis";
+
+ Vector: adt{
+ x, y, z: real;
+ };
+
+ Polyhedron: adt{
+ name, dname: string;
+ indx, V, E, F, concave, anti, allf, adj: int;
+ v, f: array of Vector;
+ fv, vf: array of array of int;
+ offset: big;
+ prv, nxt: cyclic ref Polyhedron;
+ inc: real;
+ };
+
+ # read in details of all polyhedra in the given file
+ scanpolyhedra: fn(f: string): (int, ref Polyhedron, ref Bufio->Iobuf);
+ # read in the coordinates of all polyhedra
+ getpolyhedra: fn(p: ref Polyhedron, b: ref Bufio->Iobuf);
+ # read in the coordinates of the given polyhedron
+ getpolyhedron: fn(p: ref Polyhedron, b: ref Bufio->Iobuf);
+};