Giter VIP home page Giter VIP logo

optics's Introduction

optics

Demonstrates the laws of reflection and refraction using VPython.

Table of Contents

General Info

This demo file calculates the paths of light rays travelling through different media using the laws of reflection and refraction:

  1. incident angle = reflected angle
  2. incident index x sin(incident angle) = transmitted index x sin(transmitted angle) ,

where incident angle is the angle of the incident light ray, reflected angle is the angle of the reflected light ray, transmitted angle is the angle of the transmitted light ray, incident index is the refractive index of the medium containing the incident light ray, and transmitted index is the refractive index of the medium containing the transmitted light ray (all angles are measured from the normal).

There are also the options to animate the light rays through a range of incident angle values and to visually display the reflectance and transmittance of the light.

The user must provide an incident angle, incident index, and transmitted index to run main.

Technologies

Project was created with:

  • Python 3.6

How to Use

All you need to do is 'from optics import optics optics.main()'.
Here are the arguments for main:

  • incident_angle: (float) The angle of the incident light ray in units of degrees (0 <= angle <= 90).
  • incident_index: (float) Refractive index of incident medium (speed of light in vacuum / speed of light in incident medium).
  • transmitted_index: (float) Refractive index of transmitted medium (speed of light in vacuum / speed of light in transmitted medium).
  • parallel: (bool) True if electric field is parallel to the plane of incidence and False if not (default is False).
  • labels: (bool) True if you want to display boxes containing important values (default is True).
  • irradiance: (bool) True if you want to visualize the reflectance and transmittance of the light (default is True).
  • incident_medium: (str) The label for the incident medium; must be a string (default is '').
  • transmitted_medium: (str) The label for the transmitted medium; must be a string (default is '').
  • display_width: (int) VPython canvas width (default is 1900).
  • display_height: (int) VPython canvas height (default is 950).
  • animate: (bool) If true, will animate the light rays through a range of angles (default is False).
  • angle_range: (lsit) A tuple that represents the start, end, and step size angles that you wish to animate in degrees; will override the incident_angle value given; should only be within the range of 0 to 90 (default is (0, 90, 10)).

optics's People

Contributors

anthony-giacinto avatar

Stargazers

 avatar

Watchers

 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.