Coder Social home page Coder Social logo

benruehl / android-sensor-mandala Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 653 KB

A mandala generator for Android that uses accelerometer sensor data as input

License: GNU General Public License v3.0

Kotlin 100.00%
android sensor accelerometer mandala chart

android-sensor-mandala's Introduction

Sensor Mandala

This Android app is a university project demonstrating the use of sensor data generated by a phone's accelerometer. To achieve that, it presents received data either as a seismograph-like chart or as a generated piece of art, called mandala.

Menu

Launching the app brings the user to the menu view first. At the top the phone's current acceleration is displayed in 3 progress bars, one for each axis. At the bottom there are buttons to navigate to the other views of the app.

Menu view

Seismograph

The seismograph-like chart displays the phone's acceleration in all 3 axes. It is refreshed at a regular interval and shows data changes over a few seconds. It makes use of MPAndroidChart's LineChart component.

Seismograph view

Mandala Generator

The mandala generator uses the sensor data generated by the phones accelerometer as input to generate its visuals. Each mandala consists of multiple segments whereas each second segment is a mirror to the one before. It takes the sensor data points over a certain amount of time and maps them to coordinates inside each segment. All coordinates are connected using lines on a canvas. The result looks like the following:

Mandala generator view

Moving and shaking the phone generates data points which change the appearance of the mandala. A snapshot of the current mandala state can be taken at any time by the press of a button.

Calculation

The calculation of a coordinate by a data point is shown in the following listing. The acceleration on the x-axis of each data point is translated to an angle offset in each segment. The y-axis is mapped to the distance from the mandala center. The z-axis is only used for the thickness of the lines between coordinates.

Mandala generator calculation

Filters

The generator offers filters that can be applied to modify the collection of data points that are used for drawing. High-pass and low-pass filters for example ignore data points that are higher or lower a specific threshold. The ReduceCloseNeighbors filter ignores data points that have a low delta to their predecessor. This improves rendering performance by leaving out very short lines that are hardly visible anyways.

Color

The generator offers different coloring options called Colorizers. Each implementation of a colorizer determines a color for each data point. Currently, black, red and rainbow coloring is supported.

Mandala Gallery

Mandala snapshots can be viewed in the gallery. Tapping a mandala shows it in full screen size.

Mandala gallery view

App Architecture

UML class diagram of MandalaGeneratorActivity and associated components

Class diagram of MandalaGeneratorActivity

UML class diagram of data layer

Class diagram of data layer

android-sensor-mandala's People

Contributors

benruehl avatar neocortexxx avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

adslqa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.