TheNumber5 / huygens-principle-unity

A method of simulating the 2-dimensional Huygens principle in Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

In Physics, the Huygens principle states that all points touched at a given moment by a wave become themselves elementary sources of spherical oscillations, in 2-dimensional space the points become elementary sources of circular oscillations. The new wavefront is the tangent of all the wavefronts of the generated elementary waves.

This principle can be used to demonstrate visually reflection and refraction.

Reflection is defined as being the phenomena where a wave returns to the medium it originated from at the surface separating 2 different spaces. In reflection, the angle of incidence between the wave and the normal of the surface is equal to the reflected angle, being the angle between the reflected wave and the normal of the surface.

Equation 1

Refraction is the phenomena where the direction of propagation of a wave changes when passing through a surface separating 2 different spaces. Here the ratio between the sine of the incident angle and the sine of the refracted angle is equal to the ratio between the speed of the wave in the first medium and the speed of the wave in the second medium, and is equal to a constant called the index of refraction.

Equation 2

Information

You can control the position of the wave using 8456 on the numpad, and the wave can be rotated with 7 and 9 on the numpad. The camera can be moved with the arrow keys, and zoomed in and out with Z and X. The wave can be spanwed with the space key, the Huygens simulation can be started with the left control key, and the simulation can be reset with the Q key. Please note that the maximum number of particles in the scene for the Huygens principle simulation to start is 20. You can change that in the Huygens Principle.cs script. Download the Huygens Principle.unityscene and import it to Unity to get the simulation as seen in the images.

Images

Image 1 Image 2 Image 3 Image 4

About

A method of simulating the 2-dimensional Huygens principle in Unity.

License:The Unlicense


Languages

Language:C# 100.0%