Giter Club home page Giter Club logo

sine-cosine's Introduction

Plotting Sine and Cosine

In this assignment you must use list comprehensions to generate sprites that show the behavior of certain mathematical functions: sine and cosine. See the references at the end for a tutorial that introduces this technique.

Fork this repository and create your program in the sinecosine.py file.

The sine and cosine functions are provided in the Python math library. These functions are used to relate angles to rectangular (x,y) coordinate systems and can be very useful in computer game design.

Unlike the last assignment using ggame, this one will not provide any "skeleton" code to fill in. You should use your submission for the Picture assignment as a reference for starting this assignment.

Your program must:

  1. Import the necessary names (e.g. CircleAsset, App, etc.) from the ggame library.
  2. Import sin, cos, and radians names from the math library.
  3. Using the technique in the last tutorial, generate a series of blue circles, a series of red circles, and a series of purple circles, such that:
  4. The x-coordinates of the blue and red circles will vary between 0 and 360, in steps of 10.
  5. The y-coordinates of the blue circles will be calculated using: 100+100*sin(radians(x))), where x values come from the x-coordinates in step 4.
  6. The y-coordinates of the red circles will be calculated using: 100+100*cos(radians(x))), where x values come from the x-coordinates in step 4.
  7. The x-coordinates of the purple circles will be calculated using: 100+100*cos(radians(x)), where x values come from the x-coordinates in step 4.
  8. The y-coordinates of the purple circles will be calculated using: 400+100*sin(radians(x)), where x values come from the x-coordinates in step 4.

The final result should look like sine and cosine curves in blue and red, and a circle of circles in purple.

Submit your work in the usual way.

References

sine-cosine's People

Contributors

tiggerntatie avatar

Watchers

 avatar  avatar

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.