Class: Optical::PlanoConvexLens
- Defined in:
- lib/optical/plano_convex_lens.rb
Overview
A representation of a plano convex lens
Instance Attribute Summary collapse
-
#radius_of_curvature ⇒ Object
Returns the value of attribute radius_of_curvature.
- #thickness ⇒ Object
Attributes inherited from Lens
#center_thickness, #clear_diameter, #clear_radius, #diameter, #edge_thickness, #focal_length, #numerical_aperture, #radius
Method Summary
Methods inherited from Lens
Constructor Details
This class inherits a constructor from Optical::Lens
Instance Attribute Details
#radius_of_curvature ⇒ Object
Returns the value of attribute radius_of_curvature.
8 9 10 |
# File 'lib/optical/plano_convex_lens.rb', line 8 def radius_of_curvature @radius_of_curvature end |
#thickness ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/optical/plano_convex_lens.rb', line 13 def thickness(_radius=nil, **) return super() if !_radius && .empty? _radius ||= [:radius] || ([:diameter]/2) raise ArgumentError, "Requested radius (#{_radius}) is outside of the lens" if _radius > radius if _radius && center_thickness && radius_of_curvature center_thickness - radius_of_curvature + Math.sqrt(radius_of_curvature**2 - _radius**2) end end |