MobAppDev (Fall 2014): Circular Motion, Sinusoid Curves, & Application Objects

Post on 01-Dec-2014

163 views 0 download

description

 

Transcript of MobAppDev (Fall 2014): Circular Motion, Sinusoid Curves, & Application Objects

MobAppDev

Circular Motion, Sinusoid Curves, &

Application Objects

Part 01Vladimir Kulyukin

www.vkedco.blogspot.com

Outline

● Basic Harmonics● Modeling Circular Motion with Harmonics● Application Objects

Basic Harmonics

Periodic Functions

.

,0any for if periodic called is function A

xfTxf

Tf

Periodic Functions

...32

...,4 ,3 ,2 are so then period, a is 0 If

TxfTxfTxfxf

TTTT

Sinusoid Equation

phase. initial theis and

frequency,angular theis amplitude, theis where

,sin

A

xAxf

Period of Sinusoid

.sin

2sin2

sin2

because,2

is sin of period The

xfxA

xAxAxf

xAxfT

Example

.3

2 period

and ,3

3, 2, where

,3

3sin2

T

A

xxf

Sinusoid Compression & Expansion

.1 if 1

offactor aby

axis- x thealongexpansion uniform a )2

;1 if offactor aby

axis- x thealongn compressio uniform a 1)

by sin ofgraph the

from obtained is sin ofgraph The

x

xxf

Horizontal Shift

.-by axis- x thealongit shifting

by sin ofgraph thefrom obtained

is sin ofgraph The

x

xxf

Amplitude Adjustment

.by scoordinate-y all gmultiplyin

by sin ofgraph thefrom obtained

is sin ofgraph The

A

x

xAxf

Modeling Circular Motion with Harmonics

Joseph Fourier

http://en.wikipedia.org/wiki/Joseph_Fourier

Circular Motion Application● Let us develop an application that models circular motion with basic

sinusoids● The application rotates four circles (red, blue, magenta, and yellow)

of specific radii on the left side of the custom view and translates their circular motion into the corresponding sinusoids displayed on the right side of the view

● The user can control which circles are displayed and the amplitude of each circle

● Source code is at https://github.com/VKEDCO/CircularMotion

Application Objects

● All activities within one application share the Application object that each activity can obtain via getApplication()

● An application can extend the Application class and request Android to create the object of that class

● The custom Application subclass can create data structures for each activity can access for inter-activity data transfers

Main Activity

Main screen with a customized view. The left side models four rotating circles. The right side translates the motion of each rotating circle into a corresponding sinusoid.

Options Menu

Menu option that allows the user to tune up which circles are displayed and the circle's amplitudes.

Tuneup Activity

Tuneup activity starts with an explicit intent. The radio buttons allow the user to control which circles are displayed. The seek bars allow the user to control the amplitude (radius) of each circle.

Tuneup Activity

The user unchecks the magenta circle, sets the amplitude of the red circle to 41, and clicks Confirm. The main activity will be displayed again.

Main Activity Modified

The main activity is displayed again. The magenta circle is no longer displayed. The red circle's amplitude is now 41 as shown in the red rotating circle on the left and the corresponding red sinusoid on the left.

Tuneup Activity

The user selected the Tuneup menu option again. The tuneup activity shows that the magenta circle is unchecked and the red amplitude is 41.