主要内容

changeGap

Change gap between components in optical system

Since R2026a

    Description

    Add-On Required: This feature requires the Optical Design and Simulation Library for Image Processing Toolbox add-on.

    changeGap(opsys,cInd,newGap,GapLocation=gapPos) changes the gap after the component at the specified index cInd to newGap. All of the components after the gap move up or down to maintain their relative position properties.

    example

    Examples

    collapse all

    Create an optical system that contains a double Gauss lens using the createDoubleGauss helper function. The function is attached to this example as a supporting file.

    opsys = createDoubleGauss;

    Display a 2-D visualization of the optical system using the view2d object function, and trace marginal rays through the optical system using the traceMarginalRays object function. Visualize the rays traced through the system using the addRays object function.

    hv = view2d(opsys,Labels="component");
    mr = traceMarginalRays(opsys);

    Visualize the rays traced through the system using the addRays object function.

    addRays(hv,mr)

    Figure contains an object of type optics.ui.opticalsystemviewer2d. The chart of type optics.ui.opticalsystemviewer2d has title 55-mm F/1.2 for 35-mm SLR.

    Use the changeGap object function to modify the gap between the various components of the optical system. Use the GapLocation name-value argument to specify whether to insert the modified gap after or before each specified optical component.

    changeGap(opsys,1,2,GapLocation="after")
    changeGap(opsys,4,10,GapLocation="before")
    changeGap(opsys,6,58,GapLocation="before")

    Display a 2-D visualization of the modified optical system using the view2d object function, and trace marginal rays through the optical system using the traceMarginalRays object function.

    hv = view2d(opsys,Labels="component");
    mr = traceMarginalRays(opsys);

    Visualize the rays traced through the modified optical system using the addRays object function.

    addRays(hv,mr)

    Figure contains an object of type optics.ui.opticalsystemviewer2d. The chart of type optics.ui.opticalsystemviewer2d has title 55-mm F/1.2 for 35-mm SLR.

    Input Arguments

    collapse all

    Optical system, specified as an opticalSystem object.

    Component index, specified as a positive scalar. The index indicates the position in the Components property of the opticalSystem object opsys before or after the gap specified by newGap.

    Gap size, specified as a positive scalar. This value indicates the new size, in millimeters, of the gap in the specified position gapPos relative to the optical component located at the index specified by cInd.

    Gap location, specified as "after" or "before". The gap location specifies whether to insert the modified gap after or before the optical component at the specified index cInd.

    Version History

    Introduced in R2026a