×
Namespaces

Variants
Actions

Archived:Sine wave interference patterns using PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Tested with
Devices(s): Nokia N96
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition
Article
Keywords: canvas
Created: cyke64 (19 Mar 2007)
Last edited: hamishwillee (31 May 2013)

Overview

Following code provides a nice visualization in Python.

Code

# import modules
from appuifw import *
import e32, random
from math import *
 
# define canvas
app.body = c = Canvas()
width, height = c.size
# random frequency
freq = random.choice([25., 50., 100., 200., 400.])
 
# Draw
for y in range(height):
for x in range(width):
z1 = sin(x/freq*1.7*pi)
z2 = sin((x/3+y)/freq*1.5*pi)
z3 = sin(y/freq*0.1*pi)
 
z = abs(z1+z2+z3)*255
c.point((x,y), (z,z/4,z*4))
c.text((5, height-12), u'Freq = %d' %freq, 0xffffff)
 
e32.ao_sleep(5) # wait 5 sec then quit

Postconditions

Visual













.

This page was last modified on 31 May 2013, at 04:05.
47 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×