worldforge/libs/wfmath
2025-01-11 21:04:26 +01:00
..
docs Moved wfmath to new location. 2023-10-30 22:53:04 +01:00
src Remove obsolete directives. 2024-10-28 00:03:37 +01:00
tests Various code cleanups. 2025-01-11 21:04:26 +01:00
tools/support Remove obsolete files. 2023-11-25 23:13:23 +01:00
AUTHORS Moved wfmath to new location. 2023-10-30 22:53:04 +01:00
ChangeLog Moved wfmath to new location. 2023-10-30 22:53:04 +01:00
CMakeLists.txt Use more modern way to specify C++20. 2024-02-11 23:21:18 +01:00
COPYING Moved wfmath to new location. 2023-10-30 22:53:04 +01:00
README.md Cleanup and improve on docs. 2023-11-06 23:23:32 +01:00
TODO Moved wfmath to new location. 2023-10-30 22:53:04 +01:00

WFMath

Join us on Gitter! Appveyor build status Travis build Status Github build status

This is the WorldForge math library. It's licensed under the GPL (see file COPYING).

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).

Dependencies

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.

Design

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 angles
  • 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.

Contributing

Anyone interested in contributing to this project shouldl ook 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.

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 do.

How to help

If you're interested in helping out with development you should check out these resources: