open-space-toolkit-mathematics

Geometry, curve fitting, optimization.


Keywords
open-space-collective open-space-toolkit mathematics, engineering, mathematics, space, toolkit
License
Apache-2.0
Install
pip install open-space-toolkit-mathematics==0.3.2

Documentation

Open Space Toolkit ▸ Mathematics

Build Status Code Coverage Documentation GitHub version PyPI version License

Geometry, curve fitting, optimization.

Warning

⚠ This component is under development.

Getting Started

Want to get started? This is the simplest and quickest way:

Binder

Nothing to download or install! This will automatically start a JupyterLab environment in your browser with Open Space Toolkit libraries and example notebooks ready to use.

Alternatives

Docker Images

Docker must be installed on your system.

iPython

The following command will start an iPython shell within a container where the OSTk components are already installed:

docker run -it openspacecollective/open-space-toolkit-mathematics-python

Once the shell is up and running, playing with it is easy:

import numpy
from ostk.mathematics.geometry import Angle
from ostk.mathematics.geometry.d3.transformations.rotations import Quaternion
from ostk.mathematics.geometry.d3.transformations.rotations import RotationVector

rv = RotationVector(numpy.array([[0.0], [0.0], [1.0]], dtype=float), Angle.degrees(15.0)) # Construct rotation vector

q_AB = Quaternion(1.0, 2.0, 3.0, 4.0, Quaternion.Format.XYZS).to_normalized() # Construct quaternion and normalize
q_BC = Quaternion.rotation_vector(rv) # Construct quaternion from rotation vector

q_AC = q_AB * q_BC # Multiply quaternions

Tip: Use tab for auto-completion!

JupyterLab

The following command will start a JupyterLab server within a container where the OSTk components are already installed:

docker run --publish=8888:8888 openspacecollective/open-space-toolkit-mathematics-jupyter

Once the container is running, access http://localhost:8888/lab and create a Python 3 Notebook.

Installation

C++

The binary packages are hosted using GitHub Releases:

  • Runtime libraries: open-space-toolkit-mathematics-X.Y.Z-1.x86_64-runtime
  • C++ headers: open-space-toolkit-mathematics-X.Y.Z-1.x86_64-devel
  • Python bindings: open-space-toolkit-mathematics-X.Y.Z-1.x86_64-python

Debian / Ubuntu

After downloading the relevant .deb binary packages, install:

apt install open-space-toolkit-mathematics-*.deb

Fedora / CentOS

After downloading the relevant .rpm binary packages, install:

dnf install open-space-toolkit-mathematics-*.rpm

Python

Install from PyPI:

pip install open-space-toolkit-mathematics

Structure

The Mathematics library exhibits the following structure:

├── Objects
│   ├── Vector
│   ├── Matrix
│   └── Interval
├── Geometry
│   ├── 2D
|   │   ├── Objects
│   │   │   ├── Point
│   │   │   ├── Point Set
│   │   │   ├── Line
│   │   │   ├── Line String
│   │   │   ├── Multi Line String
│   │   │   └── Polygon
│   │   ├── Intersection
│   │   └── Transformations
│   │       ├── Identity
│   │       ├── Translation
│   │       ├── Rotation
│   │       ├── Reflection
│   │       ├── Scaling
│   │       └── Shear
│   ├── 3D
|   │   ├── Objects
│   │   │   ├── Point
│   │   │   ├── Point Set
│   │   │   ├── Line
│   │   │   ├── Ray
│   │   │   ├── Segment
│   │   │   ├── Line String
│   │   │   ├── Polygon
│   │   │   ├── Plane
│   │   │   ├── Cuboid
│   │   │   ├── Sphere
│   │   │   ├── Ellipsoid
│   │   │   ├── Cone
│   │   │   ├── Pyramid
│   │   │   └── Composite
│   │   ├── Intersection
│   │   └── Transformations
│   │       ├── Identity
│   │       ├── Translation
│   │       ├── Rotations
│   │       │   ├── Quaternion
│   │       │   ├── Euler Angle
│   │       │   ├── Rotation Vector
│   │       │   └── Rotation Matrix
│   │       ├── Reflection
│   │       ├── Scaling
│   │       └── Shear
├── Dynamics
│   ├── State
│   ├── Solvers
│   │   ├── Runge–Kutta 4 (RK4)
│   │   ├── Dormand–Prince 5 (DP5)
│   │   └── Runge–Kutta–Fehlberg 78 (F78)
│   └── Systems
├── Curve Fitting
│   ├── Interpolation
│   │   ├── Linear
│   │   ├── Cubic Spline
│   │   └── Lagrange
│   └── Smoothing
├── Optimization
│   ├── Problem
│   └── Algorithms
│       ├── Gradient Descent
│       └── Evolutionary
│           ├── Genetic
│           ├── Differential Evolution
│           └── Swarm
└── Statistics

Documentation

Documentation is available here:

Tutorials

Tutorials are available here:

Features

Geometry Queries

  • : query only
  • : query / intersection set
  • : to be implemented
  • -: undefined

3D

Intersect Point Point Set Line Ray Segment Line String Polygon Plane Cuboid Sphere Ellipsoid Cone Pyramid Composite
Point
Point Set
Line
Ray
Segment
Line String
Polygon
Plane
Cuboid
Sphere
Ellipsoid
Cone
Pyramid
Composite
Contain Point Point Set Line Ray Segment Line String Polygon Plane Cuboid Sphere Ellipsoid Cone Pyramid Composite
Point - - - - - - - - - - -
Point Set - - - - - - - - - - -
Line - - - - - - -
Ray - - - - - - - -
Segment - - - - - - - - -
Line String - - - - - - - - -
Polygon - - - - - - - -
Plane - - - - -
Cuboid - - -
Sphere - - - - - -
Ellipsoid - - - - - -
Cone - - -
Pyramid -
Composite

Setup

Development Environment

Using Docker for development is recommended, to simplify the installation of the necessary build tools and dependencies. Instructions on how to install Docker are available here.

To start the development environment:

make start-development

This will:

  1. Build the openspacecollective/open-space-toolkit-mathematics-development Docker image.
  2. Create a development environment container with local source files and helper scripts mounted.
  3. Start a bash shell from the ./build working directory.

If installing Docker is not an option, you can manually install the development tools (GCC, CMake) and all required dependencies, by following a procedure similar to the one described in the Development Dockerfile.

Build

From the ./build directory:

cmake ..
make

Tip: helpers/build.sh simplifies building from within the development environment.

Test

To start a container to build and run the tests:

make test

Or to run them manually:

./bin/open-space-toolkit-mathematics.test

Tip: helpers/test.sh simplifies running tests from within the development environment.

Dependencies

Name Version License Link
Boost 1.69.0 Boost Software License boost.org
Eigen 3.3.7 MPL2 eigen.tuxfamily.org
Geometric Tools Engine 3.28 Boost Software License geometrictools.com
Core master Apache License 2.0 github.com/open-space-collective/open-space-toolkit-core

Contribution

Contributions are more than welcome!

Please read our contributing guide to learn about our development process, how to propose fixes and improvements, and how to build and test the code.

Special Thanks

To be completed...

License

Apache License 2.0