Optics functions.
More...
|
file | optics.h |
| API header file for optics in zscilib.
|
|
|
int | zsl_phy_opt_refrac_index (zsl_real_t v, zsl_real_t *n) |
| Calculates index of refraction of a medium based on the velocity of light in the medium. More...
|
|
int | zsl_phy_opt_snell (zsl_real_t n1, zsl_real_t n2, zsl_real_t o1, zsl_real_t *o2) |
| Calculates the angle of refraction of a light beam changing the medium of propagation based on the incident angle and the index of refraction of both mediums. More...
|
|
int | zsl_phy_opt_focus (zsl_real_t sr, zsl_real_t si, zsl_real_t *f) |
| Calculates the distance of the focus of a curved mirror based on the position of the real (sr) and imaginary (si) images. More...
|
|
int | zsl_phy_opt_critic_angle (zsl_real_t n1, zsl_real_t n2, zsl_real_t *oc) |
| Calculates the critical angle of incision from which the refraction effect does not occur. More...
|
|
int | zsl_phy_opt_power (zsl_real_t f, zsl_real_t *p) |
| Calculates the power of a lens based on its focal length. More...
|
|
int | zsl_phy_opt_magn (zsl_real_t y1, zsl_real_t y2, zsl_real_t *m) |
| Calculates the magnification of a lens based on the real length of an object and its apparent length through the lens. More...
|
|
int | zsl_phy_opt_dif (uint8_t n, zsl_real_t lambda, zsl_real_t o, zsl_real_t *d) |
| Calculates the distance between two objects when a light beam of wavelength comparable to the distance passes through them and difracts producing spectral lines. More...
|
|
Optics functions.
◆ zsl_phy_opt_critic_angle()
Calculates the critical angle of incision from which the refraction effect does not occur.
- Parameters
-
n1 | Index of refraction of the first medium. |
n2 | Index of refraction of the second medium. |
oc | Pointer to the output critical angle in radians. Will be set to NAN if any of the indexes is negative or if n2 > n1. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_dif()
Calculates the distance between two objects when a light beam of wavelength comparable to the distance passes through them and difracts producing spectral lines.
- Parameters
-
n | Number of the spectral line. |
lambda | Wavelength of the light beam in nanometers. |
o | Angle between the center of the distance and the n-th spectral line in radians. |
d | Pointer to the output distance in nanometers. Will be set to NAN if either 'n', 'lambda' or sin(o) are negative or if sin(o) = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_focus()
Calculates the distance of the focus of a curved mirror based on the position of the real (sr) and imaginary (si) images.
- Parameters
-
sr | Distance to the real image in meters. |
si | Distance to the imaginary image in meters. |
f | Pointer to the output distance to the focus in meters. Will be set to NAN if the mirror is plane AKA sr + si = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_magn()
Calculates the magnification of a lens based on the real length of an object and its apparent length through the lens.
- Parameters
-
y1 | Real length of the object in meters. |
y2 | Apparent length of the object in meters. |
m | Pointer to the output magnification value. Will be set to NAN if any of the input values is negative of if y1 = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_power()
Calculates the power of a lens based on its focal length.
- Parameters
-
f | Focal length in meters. |
p | Pointer to the output power in 1 / meter. Will be set to NAN if f = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_refrac_index()
Calculates index of refraction of a medium based on the velocity of light in the medium.
- Parameters
-
v | Velocity of light in the medium in meters per second. |
n | Pointer to the output index of refraction. Will be set to NAN if the velocity is negative or greater than the speed of light. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_opt_snell()
Calculates the angle of refraction of a light beam changing the medium of propagation based on the incident angle and the index of refraction of both mediums.
- Parameters
-
n1 | Index of refraction of the first medium. |
n2 | Index of refraction of the second medium. |
o1 | Angle of incision in radians. |
o2 | Pointer to the output angle of refraction in radians. Will be set to NAN if any of the indexes is negative or if the light beam does not change of medium. |
- Returns
- 0 if everything executed properly, error code on failure.