class Optical::PlanoConvexLens

A representation of a plano convex lens

Attributes

radius_of_curvature[R]

@!attribute radius_of_curvature

@return [Number]  the radius of curvature of the optical surface

Public Instance Methods

thickness(_radius=nil, **options) click to toggle source

@!attribute thickness

@param radius [Number]  the distance from the ceterline of the lens
@return [Number]  the thickness of the {Lens} at a given distance from the centerline
Calls superclass method Optical::Lens#thickness
# File lib/optical/plano_convex_lens.rb, line 13
def thickness(_radius=nil, **options)
    return super() if !_radius && options.empty?

    _radius ||= options[:radius] || (options[: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