Commit 626103bf authored by Stephen M. Webb's avatar Stephen M. Webb

Imported Upstream version 0.3.9

Al Riddoch <>
Original author:
Ron Steinke <>
Other contributors:
James Turner <>
Michael Koch <>
Dan Tomalesky <>
The Miniball code of Bernd Gaertner
is used for finding bounding spheres for
collections of points.
The Mersenne Twister code of Richard J. Wagner
<> is used for random
number generation.
This diff is collapsed.
This diff is collapsed.
Basic Installation
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `' is used to create `configure' by a program
called `autoconf'. You only need `' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
Installation Names
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/' if it exists, then
`PREFIX/etc/' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
`configure' recognizes the following options to control how it
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
Print a summary of the options to `configure', and exit.
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = wfmath-0.3.pc
EXTRA_DIST = TODO wfmath.pbproj/project.pbxproj wfmath.spec
SUBDIRS = wfmath atlas doc
cd doc && make docs
This diff is collapsed.
2009-01-26 Al Riddoch <>
* wfmath 0.3.9 released.
2008-11-15 Al Riddoch <>
* wfmath 0.3.8 released.
2007-07-25 Al Riddoch <>
* wfmath 0.3.7 released.
2007-07-20 Al Riddoch <>
* wfmath 0.3.6 released.
2006-08-18 Al Riddoch <>
* wfmath 0.3.5 released.
2005-06-11 Al Riddoch <>
* wfmath 0.3.4 released.
2003-04-24 Al Riddoch <>
* wfmath 0.2.11 released.
This is the Worldforge math library. It's licensed under the GPL
(see file COPYING), and basic compilation instructions are in
the file INSTALL. The current maintainer is Ron Steinke
The primary focus of WFMath is geometric objects. Thus,
it includes several shapes (boxes, balls, lines), in addition
to the basic math objects that are used to build these shapes
(points, vectors, matricies).
The only library that WFMath checks for is Atlas, and it only does this
for the sake of some test functions. The only dependency on Atlas is
in the file atlasconv.h. This header file contains
some inline functions which can be used to convert the various
objects in WFMath to Atlas::Message::Object and back. This
header file will be installed whether Atlas is present or not,
but to use it you must of course have the Atlas headers installed.
Most of the library classes can be divided into two sorts. The
first kind are basic mathematical objects, whose members are all fundamental
types. The second kind are shapes, which implement the shape class
interface described in doc/shape.h. There are four classes of the first kind:
Vector<> A basic mathematical vector
RotMatrix<> An orthogonal matrix of determinant 1, useful for
describing rotations.
Point<> A point in space. This basic class also implements
the shape interface in doc/shape.h.
Quaternion A quaternion
The shape classes are:
AxisBox<> A box oriented parallel to the coordinate axes
Ball<> Ball<2> is a circle, Ball<3> is a sphere, etc.
Segment<> A line segment, defined by its endpoints
RotBox<> Like AxisBox<>, but it can be rotated to arbitrary
Polygon<> A 2 dimensional polygon contained in a (possibly)
larger dimensional space
The library also contains some probability-related functions,
as well as wrappers for system time and random number functions.
Anyone interested in contributing to this project should do three things:
1) Send me an email. This is mostly to let me know someone else is working
with the CVS repository, so I can be careful about merging commits.
2) Look at the file doc/CLASS_LAYOUT, which specifies which member functions
all classes should have, and what order they should appear in.
This only applies to significant classes, not things like
ColinearVectors in error.h, which is only there to be thrown as
as exception.
3) Update the ChangeLog _every_ time you commit to CVS. This makes
it possible for other people to have some idea what you're working on.
The documentation is at this point confined to the doc/CLASS_LAYOUT file
and comments in the code. There's also a sample shape class definition
in the file shape.h in the doc directory. This has comments about
what member functions all shape classes are supposed to have, and what they
Re-write operators so that for a given operator O, operatorO is implemented
using operatorO= rather than the other way around which is inefficient.
Add throw(ColinearVectors) to the appropriate vector and matrix
rotation functions
Get rid of templates as template args, use ValueType for standard
containers instead
Intersect functions unimplemented for dim != 2,3 (extremely low priority):
Intersect(Polygon<>, AxisBox<>, bool)
Intersect(Polygon<>, RotBox<>, bool)
Intersect(RotBox<>, AxisBox<>, bool)
Intersect(RotBox<>, RotBox<>, bool)
These will be postponed until I can think of a way to write them,
or someone needs them, whichever comes first
Add shape tests from COAL
Write rotateInverse() functions
Look into whether miniball code can handle using float instead of double;
if so, replace Wrapped_array with Point
Write an API reference for the library. Find some inline documentation tool?
Deal with difficulties in making certain functions friends of the
appropriate classes
Rearrange the functions in foo_funcs.h to match the order in the class
in foo.h
0.3.0 will come out once I get around to testing the Polygon intersect functions
and make sure they work. At that point the old Intersect()/IntersectProper()
interface will be removed, as will support for deprecated network
formats in atlas_conv.h. This is also an appropriate time to make changes
that break binary compatibility.
alriddoch's TODO 2008-11-10
Clean up const.h removing all includes that it itself does not use.
<cmath>, <cassert> and <iosfwd> should go. Clean up the rest of the headers
that turn out to need this, but completely get rid of asserts from the
interface headers. This should reduce the cost of including these headers,
and stop them from polluting the namespace.
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# Copyright © 2004 Scott James Remnant <>.
# 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
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# ----------------------------------
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
if test -n "$PKG_CONFIG"; then
_pkg_min_version=m4_default([$1], [0.9.0])
AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
# Similar to PKG_CHECK_MODULES, make sure that the first instance of
# this or PKG_CHECK_MODULES is called, or make sure to call
# --------------------------------------------------------------
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:])
m4_ifvaln([$3], [else
# ---------------------------------------------
[if test -n "$PKG_CONFIG"; then
if test -n "$$1"; then
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
# -----------------------------
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
# Note that if there is a possibility the first call to
# PKG_CHECK_MODULES might not happen, you should be sure to include an
# explicit call to PKG_PROG_PKG_CONFIG in your
# --------------------------------------------------------------
AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"`
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"`
# Put the nasty error message in config.log where it belongs
ifelse([$4], , [AC_MSG_ERROR(dnl
[Package requirements ($2) were not met:
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl
[The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
To get pkg-config, see <>.])],
ifelse([$3], , :, [$3])
This diff is collapsed.
EXTRA_DIST = atlas_0_6_test.cpp
# have to include both here to get it to build, but we're including
# distinct headers so we're okay
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/wfmath
ATLAS_0_6_TESTS = atlas_0_6_test
atlas_0_6_test_SOURCES = atlas_0_6_test.cpp
atlas_0_6_test_LDADD = ../wfmath/ @ATLAS_0_6_LIBS@
This diff is collapsed.
// atlas_tests.cpp (WFMath/Atlas Message conversion test code)
// The WorldForge Project
// Copyright (C) 2001 The WorldForge Project
// 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
// 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.
// For information about WorldForge and its authors, please contact
// the Worldforge Web Site at
// Author: Ron Steinke
// Created: 2001-12-12
#include "atlasconv.h"
#include "stream.h"
using namespace WFMath;
template<class C>
void atlas_test(const C& c)
std::cout << c << std::endl;
Atlas::Message::Element a = c.toAtlas();
C out(a);
std::cout << out << std::endl;
// Only match to string precision
assert(Equal(c, out, FloatMax(WFMATH_EPSILON,1e-5)));
int main()
Point<3> p(1, 0, Sqrt2);
Vector<3> v(1, -1, 4);
Quaternion q(v, 0.7);
AxisBox<3> b1(Point<3>().setToOrigin(), p), b2(p, p + v);
Ball<3> ball(Point<3>(1, 2, 3), 10);
Polygon<2> poly;
poly.addCorner(0, WFMath::Point<2>(0, 0));
poly.addCorner(1, WFMath::Point<2>(10, 0));
poly.addCorner(2, WFMath::Point<2>(10, 10));
RotBox<2> rotbox(Point<2>(1, 2), Vector<2>(10, 20), RotMatrix<2>().identity());
return 0;
# Run this to generate all the initial makefiles, etc.
# NOTE: This copied from GNOME and modified for WFMath.
# Original was licensed under LGPL.
# Extra NOTE: This script was then recopied from WFMath to WFMath
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: You must have \`autoconf' installed to compile WFMath."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at"
(grep "^AM_PROG_LIBTOOL" ./ >/dev/null) && {
(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: You must have \`libtool' installed to compile WFMath."
echo "Get"
echo "(or a newer version if it is available)"
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: You must have \`automake' installed to compile WFMath."
echo "Get"
echo "(or a newer version if it is available)"
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "Get"
echo "(or a newer version if it is available)"
if test "$DIE" -eq 1; then
exit 1
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
#echo "Running libtoolize..."
libtoolize --automake --copy --force
#libtoolize --force --copy
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
echo "Running autoheader..."
echo "Running automake --gnu $am_opt ..."
automake --add-missing --copy --gnu $am_opt
echo "Running autoconf ..."
if test "x$NOCONFIGURE" = "x" ; then
echo Running ./configure $conf_flags "$@" ...
./configure $conf_flags "$@" && echo Now type \`make\' to compile WFMath
This diff is collapsed.
/* Generated from by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
/* Define to 1 if you have the `fabsf' function. */
/* Define to 1 if you have the <inttypes.h> header file. */
/* Define to 1 if you have the <memory.h> header file. */
/* Define to 1 if you have the <sstream> header file. */
/* Define to 1 if you have the <stdint.h> header file. */
/* Define to 1 if you have the <stdlib.h> header file. */
/* Define to 1 if you have the <strings.h> header file. */
/* Define to 1 if you have the <string.h> header file. */
/* Define to 1 if you have the <strstream> header file. */
/* Define to 1 if you have the <sys/stat.h> header file. */
/* Define to 1 if you have the <sys/types.h> header file. */