6. Visualizing Your System

6.1 Introduction

6.2 Adjusting Graphics

6.2.1 Magnifying Graphics
6.2.2 Manual Graphics Control
6.2.3 Custom Graphics
6.2.4 Interactive 3D Graphics and Stereo Graphics

6.3 ShowText
6.4 ShowRange
6.5 ColorView
6.6 RayChoice
6.7 OutputType
6.8 LineStyle and FillStyle
6.9 Other Rendering Options
6.10 ModelRayColor

6.11 Labelling of Components

6.11.1 Labelling Your Printed Output

6.11.2 Labelling Your Graphics

Numbering Your Labels
Rayica's Default Treatment of Labels
Placement of Your Labels
Labels with Resonate
The Labels Option
Surpressing Labels

6.1 Introduction

Ray-tracing is independent of graphical output.  Rayica uses exact surface equations for ray-tracing.  Yet for rendering  purposes, Rayica employs visual approximations.  You can produce the same analysis using  fine graphics, rough graphics, or no graphics at all.  Moreover, individual  components can be rendered at different levels of graphic quality.

In this chapter, we discuss in more detail the various rendering options of AnalyzeSystem and ShowSystem. Typically, you first perform a ray-tracing operation by evaluating AnalyzeSystem. This process can be quite slow in Rayica. After this initial ray-tracing step, you can examine various parameter characteristics very quickly using ShowSystem.  ShowSystem shares its options with AnalyzeSystem. In this chapter, we will examine the use of some of these options.

Options[AnalyzeSystem]

RowBox[{{, RowBox[{AddLabelsAddLabels, ,, AppendGraphics {}, ,, BoxedF ... dIntensity1, ,, TracingEnginePropagateSystem, ,, ZeroShapeAutomatic}], }}]

In addition to the AnalyzeSystem/ShowSystem options, you can use any of the Graphics or Graphics3D options for rendering. In this way, you can include labels and titles with the rendered objects. For the rest of this section, we examine the rendering options uniquely associated with Rayica.

Go to list of topics

6.2 Adjusting Graphics

Sometimes a component's graphics do not seem to match the underlying  model.  When such a mismatch presents itself, bear in mind the distinction  between models and graphics.  You may be tempted to alter your model merely  for the sake of graphics.  This approach is mistaken.  Instead, use  designated graphics options.  Rayica includes a variety of tools for adjusting graphics.  For example, here is  a SphericalLens with PlotPoints→30.

AnalyzeSystem[ {LineOfRays[40, NumberOfRays7], Move[SphericalL ... }, RayPointSize4, PlotTypeTopView, PlotPoints30] ;

[Graphics:HTMLFiles/index_3.gif]

This SphericalLens looks good with PlotPoints→30.

The graphical representation looks good.  Each face of the lens curves  smoothly.  Lowering the value of PlotPoints causes Rayica to approximate the spherical surfaces with fewer polygons.

AnalyzeSystem[ {LineOfRays[40, NumberOfRays7], Move[SphericalL ... }, RayPointSize4, PlotTypeTopView, PlotPoints10] ;

[Graphics:HTMLFiles/index_5.gif]

This SphericalLens looks poor with PlotPoints→10.  However the ray trace is still good because graphics do not  affect ray-tracing.

The lens now looks jagged, but the ray intercepts are the same everywhere.   This result shows that Rayica can produce different graphics for the same optical system models,  depending on graphics settings.

PlotPoints is a standard Mathematica graphics option.  In Rayica, it can apply either to individual components or to your entire system, depending on where the option is inserted.  GraphicDesign is an important option for individual components.  It can take the values  Automatic, Sketch, Wire, Solid, or Off.  You may render different components in the same system with different  GraphicDesign settings between them.

The distinction between graphics and underlying models also bears upon the question of lens edges, discussed previously in Section 3.4.2.

6.2.1 Magnifying Graphics

Another way to modify Rayica's graphics is the Magnification option.  This option scales Rayica graphics by multiplication factor.  This option requires a certain care,  because it also affects ray intercepts.

The following system has two lenses.  The physical shape of the smaller lens disappears at this scale.

light = LineOfRays[1, NumberOfRays5] ; RowBox[{RowBox[{smalllens, =, RowBox[{Move, [,  ... s, biglens, boundary}, PlotTypeTopView, FrameTrue, FrameTicksAutomatic] ;

[Graphics:HTMLFiles/index_7.gif]

You may define the same optical component with a different Magnification.  Sometimes this change necessitates parallel changes to LabelPositions for good-looking output.

RowBox[{RowBox[{magnifiedlens, =, RowBox[{Move, [, RowBox[{RowBox[{PlanoConcaveLens, [, RowBox ... s, biglens, boundary}, PlotTypeTopView, FrameTrue, FrameTicksAutomatic] ;

[Graphics:HTMLFiles/index_9.gif]

Graphics incorporating the Magnification option require care in interpretation.  Rayica magnifies the ray intercepts on the altered lens so that they emerge from  the same relative positions on the surface.  Technically, the graphics no  longer match the actual physics.  The angles of the rays have changed to  follow the graphical magnification.  The trace data is identical, however.   Only the visual representation has changed.

Go to list of topics

6.2.2 Manual Graphics Control

Rayica's graphics are often the best feedback about a system's performance.  AnalyzeSystem produces graphics automatically.

However, Rayica can also trace systems without producing graphics.  The primary advantage  of doing so is speed.  The speed advantage is especially important within  iterative design loops.  Some parameter increments with each iteration, and  you are mostly interested in numerical results.

The Rayica function for tracing without graphics is called PropagateSystem.  When you call PropagateSystem, be sure to assign its return value into a variable.  Otherwise there  will be no data source for subsequent data extraction.

sys = PropagateSystem[{LineOfRays[40, NumberOfRays7], Move[SphericalLens[30, -30, 50, 40], 10], Boundary[75] }] ;

Now sys holds the result of the trace.  If you later desire a visualization, do  not recompute sys with AnalyzeSystem.  Instead, use ShowSystem.  This function produces a graphic without performing trace  computations.

ShowSystem[sys] ;

[Graphics:HTMLFiles/index_12.gif]

ShowSystem produces a graphic without recomputing the system.

AnalyzeSystem effectively calls PropagateSystem to calculate a trace, and ShowSystem to display it.

Rayica's turbo trace capability presents a parallel suite of functions for turbo  systems.  These functions are discussed in a later section.

Go to list of topics

6.2.3 Custom Graphics

Rayica graphics are Mathematica graphics.  You can edit them using Mathematica graphics primitives.  These include lines, circles, text, solids, and  other objects.  There are several ways to customize graphics with these  objects.

Mathematica features an Epilog option to permit customization of graphical output.  Epilog defines a list of graphics primitives for Mathematica to insert into the output.   

result = Plot[Sin[x], {x, 0, 2 π}, Epilog  Line[{{2, 0}, {2, Sin[2]}}]]

[Graphics:HTMLFiles/index_14.gif]

⁃Graphics⁃

Use of Epilog to customize graphics.

However, pilog can only augment graphics, not alter them.  For alterations you will need  the underlying primitives.  Rayica includes a mechanism to fill this need.  The OutputType option for AnalyzeSystem and ShowSystem  has a special setting, StandardGraphics.  Under this setting, Rayica changes the output type to standard Mathematica graphics.

Rayica normally returns an optical system.  The optional behavior instead  returns graphics.  This output is the normal kind that you get from Mathematica after calling any graphics function.  For instance, the return value from  Plot is of type Graphics.

Head[result]

Graphics

In three dimensions, it is Graphics3D or possibly SurfaceGraphics.  Usually you would employ a semicolon to suppress the output echo from  the Plot call, which otherwise consumes memory.

You can see the individual graphics primitives.

InputForm[result]

This call produces the equivalent input expression that, in the absence of  Plot, would have to be entered by hand to assign the same result.  Incidentally, the graphics expression includes any primitives that were  inserted by means of Epilog.

Returning then to Rayica, you can use OutputType→StandardGraphics and verify that you get a legitimate graphics variable.

myComponent = PlanoConvexLens[50, 25, 5] ; RowBox[{RowBox[{mySource, =, RowBox[{Move, [, RowBo ...  result = AnalyzeSystem[mySystem, PlotTypeSideView, OutputTypeStandardGraphics] ;

[Graphics:HTMLFiles/index_20.gif]

Head[result]

Graphics

Use of OutputType→StandardGraphics in Rayica.  The variable result now holds Mathematica graphics instead of an optical system.

You may employ this Graphics object in any kind of Mathematica work.  At this stage it is completely independent of Rayica.  The variable holds a Graphics object with standard Mathematica graphics primitives.

Go to list of topics

6.2.4 Interactive 3D Graphics and Stereo Graphics

Often there is no substitute for a three-dimensional visualization.  If  you are running Mathematica Version 4 or higher, Rayica can produce interactive graphics.  These graphics allow you to change the  viewpoint with your mouse in real time.  This capability depends upon the RealTime3D package (automatically loaded with Rayica).  This package is not well documented in the Mathematica literature, but ships standard with Version 4.  Use the option PlotType→RealTime3D to get this kind of output.

Here is a collection of lenses shown in standard 3D format.

lens = PlanoConvexLens[100, 50, 10] ; sys = AnalyzeSystem[{Move[lens, 50], Mov ... 125, 125, 125}] }, FrameTrue, FrameTicksTrue, AxesTrue] ;

[Graphics:HTMLFiles/index_24.gif]

Standard 3D plotting.

The option PlotType→RealTime3D yields a dynamic, mouse-controlled graphic.

ShowSystem[sys, PlotTypeRealTime3D] ;

-Graphics3D-

Real-time 3D plotting.  This graphic can be swiveled with a mouse.

Rayica can also produce stereo graphics.  This kind of graphic requires colored  3D glasses.  The option is CreateStereoView→Colored.

ShowSystem[sys, CreateStereoViewColored] ;

[Graphics:HTMLFiles/index_28.gif]

Stereo graphics.  This graphic requires 3D glasses.

CreateStereoView→Crossed gives you a reversed stereo image pair.

ShowSystem[sys, CreateStereoView->Crossed];

[Graphics:HTMLFiles/index_29.gif]

Stereo graphics.  You can see this in 3D with your eyes crossed.

There are a total of four different stereo-image rendering possibities  built into Rayica.  Look in the Help Browser for other examples.

Go to list of topics

6.3 ShowText

?ShowText

ShowText is a PlugIn of ShowSystem and an Option of Component, Ray and ShowSystem (the rule is ... LabelPositions, ShowSystem, ShowText, ShowSurfaceEllipse, ShowEllipse, ShowSurfacePlot, ShowValue.

AnalyzeSystem[{
    Move[LineOfRays[40],{0,-5},5],
    Move[PlanoConvexLens[100,50,10, FresnelReflections -> True],50],
    Boundary[100]},
    PlotType->TopView, ShowText -> Intensity];

[Graphics:HTMLFiles/index_31.gif]

Go to list of topics

6.4 ShowRange

ShowRange is very useful for viewing segments of very large optical systems. By displaying a subset of components in the system, ShowRange can be used to "zoom-in" on a particular component area.


ShowRange->
values uses ComponentNumber values to select the components and ray segments being displayed.

ShowRange can either take the value All or a list of the ComponentNumber values.

sys = AnalyzeSystem[
    {LineOfRays[1, NumberOfRays -> 7],
    Move[PlanoConvexLens[5,2,.5],5],
    Move[PinHole[1.0,.1],10],
    Move[PlanoConvexLens[100,50,10, CurvatureDirection->Back],110],
    Boundary[{0,-100,-100},{150,100,100}]},
    PlotType->TopView];

[Graphics:HTMLFiles/index_32.gif]

In the picture shown above, the first two elements are too small to be clearly seen. We next zoom-in on the first two elements using ShowRange.

ShowSystem[sys,ShowRange->{1,2}];

[Graphics:HTMLFiles/index_33.gif]

ShowRange points to a list of one or more numbers. These numbers refer to the ComponentNumber of the elements to be displayed. Rays are displayed that contain the ComponentNumber parameters specified with ShowRange.

Go to list of topics

6.5 ColorView

ColorView is a powerful visualization tool that chooses the ray parameter to be represented by the ray color. Normally, each ray is colored to represent its wavelength. You can use ColorView to have ray colors associated with ray parameters in addition to wavelength. Here we define ColorView.


ColorView->
rayparameterlabel is used to render rays with specified colors according to rayparameterlabel.

ColorView gives rayparameterlabel to ModelRayColor for determining ray colors. As  examples: ColorView->WaveLength attempts to match the color of the ray to the wavelength; ColorView->Automatic displays the initial RGBColor values assigned for the RayLineRGB ray parameter; ColorView->rayparameterlabel for any rayparameterlabel other than WaveLength attempts to colorize each ray segment according to the rank of the rayparameterlabel value within the possible range of rayparameterlabel values, for the displayed rays selected by RayChoice and ShowRange.

If more than one rayparameterlabel is indicated or the parameter gives a vector of three elements, then each of three values is assigned to the red, green, and blue colors. ColorView may also point to a list of three numbers representing the red, green, and blue colors used.

ColorView uses the ModelRayColor function for rendering rays in different formats. You can develop your own color mapping schemes with ModelRayColor. Section 6.5 discusses ModelRayColor in more detail.

Now we look at some examples using the ColorView option. You can use ColorView -> Intensity in order to have the ray color represent the relative intensity value of each ray segment.

AnalyzeSystem[{
    Move[LineOfRays[40],{0,-5},5],
    Move[PlanoConvexLens[100,50,10, FresnelReflections -> True],50],
    Boundary[100]},
    PlotType->TopView, ColorView -> Intensity];

[Graphics:HTMLFiles/index_34.gif]

You can also give expressions that contain different ray parameters to ColorView. Here we use ColorView -> Log[Intensity] in order to have the ray color represent the natural log of its relative intensity value where red is the strongest intensity and dark blue is the weakest intensity value.

AnalyzeSystem[{
    Move[LineOfRays[40],{0,-5},5],
    Move[PlanoConvexLens[100,50,10, FresnelReflections -> True],50],
    Boundary[100]},
    PlotType->TopView, ColorView -> Log[Intensity]];

[Graphics:HTMLFiles/index_35.gif]

Next we look at some examples using the ColorView option with other ray parameters. First we use AnalyzeSystem in the normal fashion.

ill = AnalyzeSystem[{
    ConeOfRays[10,NumberOfRays->20],
    Move[BiConvexLens[50,50,20],90,1],
    Move[ThinBaffle[2],{197,0,0}]},PlotType->TopView, ModularSystem -> True];

[Graphics:HTMLFiles/index_36.gif]

By selecting PlotType->Surface and ColorView->OpticalLength, we monitor the variance in optical path length across the lens surface.

ShowSystem[ill,PlotType->Surface,
    RayChoice->{IntersectionNumber->3},
    ColorView->OpticalLength];

[Graphics:HTMLFiles/index_37.gif]

Similarly, we can color-render the variance in tilt angles for the rays plotted in either two or three dimensions.

ShowSystem[ill,PlotType->TopView,ColorView->RayTilt];

[Graphics:HTMLFiles/index_38.gif]

ShowSystem[ill,ColorView->RayTilt];

[Graphics:HTMLFiles/index_39.gif]

We can change the rendering to a graylevel format using the option, ColorView->{RayLength,GrayLevel}.

ShowSystem[ill,PlotType->TopView,ShowRange->{2},    
    ColorView->{RayLength,GrayLevel}];

[Graphics:HTMLFiles/index_40.gif]

Go to list of topics

6.6 RayChoice

In many cases it is desirable to follow a group of rays through an optical system. You can use the RayChoice option to selectively display a particular group of rays.

?RayChoice

RayChoice -> selectionproperties that is used to selectively display ray segments in DrawSy ... -> 1, ConfinedPosition -> 2}. See RaySelect about how selectionproperties can be structured.


RayChoice -> selectionproperties is used to selectively display ray segments in DrawSystem/AnalyzeSystem, TurboPlot,  and ShowSystem.

A typical option value of RayChoice would be RayChoice -> {ComponentNumber -> 1, SurfaceNumber -> 1}.

ill = AnalyzeSystem[{
    ConeOfRays[10,NumberOfRays->20],
    Move[BiConvexLens[50,50,20],90,1],
    Move[ThinBaffle[2],{197,0,0}]}, RayChoice->{ComponentNumber -> 1, SurfaceNumber -> 1}, PlotType->TopView];

[Graphics:HTMLFiles/index_42.gif]

ShowSystem[ill, PlotType->Surface, RayChoice->{ComponentNumber->2}];

[Graphics:HTMLFiles/index_43.gif]

TurboPlot[{
    ConeOfRays[10,NumberOfRays->20],
    Move[BiConvexLens[50,50,20],90,1],
    Move[ThinBaffle[2],{197,0,0}]}, RayChoice->{IntersectionNumber -> 3}, PlotType->TopView];

[Graphics:HTMLFiles/index_44.gif]

Go to list of topics

6.7 OutputType

It is sometimes desirable to create graphics in Rayica to be used in other Mathematica packages or displayed with non-Rayica produced images. These things can be done with the OutputType.option of AnalyzeSystem and ShowSystem.


OutputType
specifies the final output form from ShowSystem and AnalyzeSystem.

OutputType uses word values OpticalSystem and StandardGraphics. If StandardGraphics mode is indicated, then ShowSystem and AnalyzeSystem return a graphics object in the standard Mathematica format. In the default OpticalSystem mode, ShowSystem and AnalyzeSystem return component and ray information that can be analyzed and manipulated by Rayica. The following system will be used to demonstrate OutputType.

sys = AnalyzeSystem[{
    WedgeOfRays[10],
    Move[PlanoConvexLens[100,50,10],100],
    Boundary[{-100,-100,-100},{200,100,100}]}, PlotType->TopView];
Head[sys]

[Graphics:HTMLFiles/index_45.gif]

OpticalSystem

Here we see that an OpticalSystem object is returned from AnalyzeSystem. This OpticalSystem object contains all information to completely describe the system of rays and components. Even though the image displays a flattened two-dimensional view of the objects, we can quickly see the full three-dimensional view using ShowSystem.

ShowSystem[sys];
Head[%]

[Graphics:HTMLFiles/index_47.gif]

OpticalSystem

Once again, an OpticalSystem is returned by ShowSystem. We now set OutputType->StandardGraphics in ShowSystem.

standardgraphics = ShowSystem[sys,PlotType->TopView, OutputType->StandardGraphics];
Head[standardgraphics]

[Graphics:HTMLFiles/index_49.gif]

Graphics

This time a Graphics object is returned by ShowSystem. We can now display this object with other graphic objects in Mathematica by using the standard Show function. As an example, we make a standard plot of the parabola function.

plot = Plot[.01 x^2 - 25,{x,0,100}]

[Graphics:HTMLFiles/index_51.gif]

⁃Graphics⁃

Next, we use Show to merge the rendering of the parabola with the ray tracing of the lens.

Show[standardgraphics,plot]

[Graphics:HTMLFiles/index_53.gif]

⁃Graphics⁃

You can also work with three-dimensional rendering with Graphics3D in a similar fashion.

Go to list of topics

6.8 LineStyle and FillStyle

FillStyle and LineStyle are options of AnalyzeSystem that give the component rendering styles.


FillStyle
carries a list of graphics styles for rendering of filled surfaces.

LineStyle carries a list of graphics styles for rendering of edges and wire-framed surfaces.

You can modify the thickness and color in rendered component lines with LineStyle. The default option setting for LineStyle is
LineStyle->{GrayLevel[0.], AbsoluteThickness[0.5]}. This means that component edges are rendered in black with a 0.5-point line thickness.

FillStyle lets you change the color of shaded component surfaces. The default option setting for FillStyle is FillStyle->{GrayLevel[0.5]}. This means that shaded component surfaces are rendered in gray. However, you can use the FillStyle option to change the color of an optical component as follows:

DrawSystem[{PlanoConvexLens[100,50,10,FillStyle->{RGBColor[1,0,0]}],
    Move[PlanoConvexLens[100,50,10,FillStyle->{RGBColor[0,1,0]}],50]}, PlotType->TopView];

[Graphics:HTMLFiles/index_55.gif]

Go to list of topics

6.9 Other Rendering Options

In this section we examine the several options available for altering the graphical rendering of components and rays. The default rendering options of a Component object can be identified by examining Options[componentname]. As an example, we examine Options[PlanoConvexLens].

Options[PlanoConvexLens]

RowBox[{{, RowBox[{LabelsL, ,, LabelPositionsAutomatic, ,, ComponentDescriptio ... eRendering {{Fill, Trace}}, EdgeRenderingFill, CrossRenderingEmpty}}], }}]

Listed above are several graphics-related options. These options are given in a hierarchy of levels. At the top of the hierarchy is the GraphicDesign option.


GraphicDesign
is an option of all rendered components indicating the style of rendering.

The GraphicDesign option uses Automatic, Sketch, Wire, and Solid to denote different rendering styles for PlanoConvexLens. Automatic, Sketch, Wire, and Solid are themselves options of PlanoConvexLens, and can take a combination of the four word values defined below.

Empty indicates that no graphics will be created.
Fill denotes that the surface graphics should be filled with shaded areas.
Mesh designates that the surface graphics should be rendered with mesh outlines.
Trace specifies that surfaces are rendered with outlined borders and no shading.

Component rendering commands.

When specifying the graphical rendering of a component, it is possible to modify a particular GraphicDesign option in two different ways. The broadest method is to simply change the definition of a particular suboption using SetOptions. The usual method, however, is to directly change the GraphicDesign setting for a given component funciton.

As an example, here are several GraphicDesign settings for PlanoConvexLens, starting with the default setting.

AnalyzeSystem[PlanoConvexLens[100,50,10]];

[Graphics:HTMLFiles/index_57.gif]

AnalyzeSystem[PlanoConvexLens[100,50,10, GraphicDesign -> Wire]];

[Graphics:HTMLFiles/index_58.gif]

AnalyzeSystem[PlanoConvexLens[100,50,10, GraphicDesign -> Solid]];

[Graphics:HTMLFiles/index_59.gif]

An additional method is to directly include a suboption of GraphicDesign at the time of rendering. Here, we replace Mesh of the EdgeRendering suboption with Fill.

AnalyzeSystem[
    PlanoConvexLens[100,50,10,EdgeRendering->Fill]];

[Graphics:HTMLFiles/index_60.gif]

In this way we can custom-render various objects. Similarly, you can change the rendering options of rays. Ray-rendering options include RayLineRGB, RayPointRGB, RayLineThickness, RayPointSize, RayLineStyle, and RayPointStyle. By including one or more of these options within a ray-source function, the rays from that source will be rendered accordingly. Ray-rendering options may also be inserted into AnalyzeSystem and ShowSystem to change the rendering effects, even after the ray tracing is completed. See Section 9.4 for details about ray-rendering parameters.

Go to list of topics

6.10 ModelRayColor

ModelRayColor determines the way rays get rendered including their colors. Here we define ModelRayColor.


ModelRayColor[
rayparameterlabels, {minvalue, maxvalue}] = Function[ parametervalue ] attempts to convert the ray parameters indicated by rayparameterlabels into rendered color values.

Custom ray-rendering schemes can be defined for various ray-parameter labels by using ModelRayColor[rayparameterlabel, {min_, max_}] = Function[{parametervalue}, function[parametervalue]], where function[parametervalue] returns graphics styles such as Hue, GreyLevel, and RGBColor.  

ModelRayColor uses the rayparameterlabel from the ColorView option of AnalyzeSystem. Arguments minvalue and maxvalue are calculated based on the minimum and maximum parameter values from the currently displayed rays, selected by the RayChoice option. As a default for undefined ray parameter labels given by the ColorView option, ModelRayColor assigns a color Hue to each ray according to the segment parameter's numerical position between minvalue and maxvalue, with red being assigned to the maximum encountered parameter value. Parameters composed of three elements are evaluated by independently representing each element with a red, green, or blue value. Two-element parameters are assigned a red and a green value, each representing an element. AnalyzeSystem option ColorView->WaveLength attempts to match the wavelength of the ray to the perceived visual color of that wavelength. Before the user can define new ModelRayColor functions, ModelRayColor must be unprotected.

In practice, however, ModelRayColor is rarely altered or directly specified by the user.

Go to list of topics

6.11 Labelling of Components

Another topic worthy of consideration is Rayica's treatment of component labelling.  Basically, there are two ways of  using labels: in your graphics and in the printed output of your system, but  often, these two things go hand in hand.  Labels can be very important for  both illustrating and explaining your systems.  In this section, we will  examine Rayica's use of labels with components.

6.11.1 Labelling Your Printed Output

Rayica provides several approaches for attaching labels, but the most common  method is to include the label as a string for the last argument before the  options of your component function.

lens = PlanoConvexLens[100,50,10,"lens",GraphicDesign->Solid]
Move[lens,100]

lens

TagBox[RowBox[{Move, [, RowBox[{lens, ,, 100.}], ]}], HoldForm]

If no label is used, Rayica simply echos the input function back in the printed output.

PlanoConvexLens[100,50,10,GraphicDesign->Solid]

PlanoConvexLens[100, 50, 10, {GraphicDesignSolid}]

It can be especially helpful to give the same names to your variables and labels.  This lets you keep better track of the different components in your system.  However, the label and variable don't always have to match each other:

differentlens =
PlanoConvexLens[100,50,10,"anotherlens",GraphicDesign->Solid]

anotherlens

Go to list of topics

6.11.2 Labelling Your Graphics

Rayica uses the label not only in the printed output, but also in the display of  graphics.  Here two lenses together are rendered.

lens = PlanoConvexLens[100,50,10,"lens",GraphicDesign->Solid];

AnalyzeSystem[{lens, Move[lens,100]},PlotType->TopView]

[Graphics:HTMLFiles/index_65.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{lens, ,, RowBox[{Move, [, RowBox[{lens, ,, 100.}], ]}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-rendered system without rays-

The two lenses are each labeled with a unique number automatically attached by Rayica.

The label lens appears both in the graphics as well as in the echoed  system output.  Note that Rayica has automatically numbered the lens labels in the graphics.  However, in  the display of a single object, Rayica automatically surpresses the graphical labelling altogether.

AnalyzeSystem[lens, PlotType->TopView]

[Graphics:HTMLFiles/index_68.gif]

AnalyzeSystem[{lens}, PlotTypeTopView]

-rendered element-

Rayica has surpressed its graphical labelling for the single lens object.

Go to list of topics

Numbering Your Labels

When several identical labels appear in the graphics, Rayica automatically attaches a number to each duplicate label.  However, you  can over-ride the automatic numbering if you supply your own label numbers in  advance.  This can be important in order to keep a numbering correspondance  with your variable names.

lens1 = PlanoConvexLens[100,50,10,"lens1"];

lens2 = PlanoConvexLens[100,50,10,"lens2"];

AnalyzeSystem[{lens2, Move[lens1,100]},PlotType->TopView]

[Graphics:HTMLFiles/index_71.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{lens2, ,, RowBox[{Move, [, RowBox[{lens1, ,, 100.}], ]}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-rendered system without rays-

The labels are numbered in advance by the user.  This time each of the variable names, graphical labels, and printed output uses the same numbering convention.

Go to list of topics

Rayica's Default Treatment of Labels

Many times, you might not want to bother with labeling of components.   This is OK because the labels are always optional and not required by any Rayica function.  If object labels are not given explicitly by the user, Rayica will automatically assign a default label name to each component in the  graphics.

defaultSystem = AnalyzeSystem[{PlanoConvexLens[100, 50, 10], Move[Prism[{60, 50, 60},  ... [PlanoConvexLens[100, 50, 10], 100], Move[Mirror[{50, 50}, 5], 150, 30]}, PlotTypeTopView]

[Graphics:HTMLFiles/index_75.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{PlanoConvexLens[100, 50, 10], ,, R ... [{{, RowBox[{150., ,, 0}], }}], ,, 30.}], ]}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-rendered system without rays-

Rayica gives default labels automatically, while the printed output shows the  full function names.

In general, component labelling works for any two-dimensional PlotType setting but gets surpressed with three-dimensional plots.

ShowSystem[defaultSystem, PlotTypeSideView] ; ShowSystem[defaultSystem, PlotTypeFull3D] ;

[Graphics:HTMLFiles/index_79.gif]

[Graphics:HTMLFiles/index_80.gif]

The labels work with PlotType→SideView but gets surpressed with PlotType→Full3D.

Go to list of topics

Placement of Your Labels

Sometimes, you might not like the way that Rayica has automatically placed a label within the graphics.  You can change the  label placement with the LabelPositions option.

?LabelPositions

LabelPositions -> {{xpos, ypos, zpos}, ...} is an option of Component  that indic ... omatically  updated with subsequent Move operations. See also: Labels, Offx, Offy, Offz.

AnalyzeSystem[{Prism[{60, 50, 60}, 50, CenteredTrue, LabelPositions  { ... edTrue, LabelPositions  {{0, Offy, 0}}], 100]}, PlotTypeTopView] ;

[Graphics:HTMLFiles/index_83.gif]

These Prisms use LabelPositions to locate their labels.

LabelPositions always works in the local relative coordinates of each object.  For the  second prism, Offy was used to provide a scaled distance relative to the y-axis plot  dimensions.

A related option is LabelOffset.

?LabelOffset

LabelOffset is an option of DrawSystem/AnalyzeSystem and ShowSystem that scales the label offs ... verall dimensions of the system rendering. \n\nSee also: ShiftLabels, AddLabels, and RenameLabels.

You can use LabelOffset to change the relative distance of the labels to each component graphic.

Rayica's default value for LabelOffset is given by:

LabelOffset/.Options[AnalyzeSystem]

0.04

Therefore, we can use LabelOffset -> .1 to increase label to component distance.

AnalyzeSystem[{Prism[{60, 50, 60}, 50, CenteredTrue], Move[Prism[{60,  ...  60}, 50, CenteredTrue], 100]}, PlotTypeTopView, LabelOffset .1] ;

[Graphics:HTMLFiles/index_87.gif]

Go to list of topics

Labels with Resonate

Every component function as well as every genetic function of Rayica can take a label.  In previous versions of Rayica, some functions like Resonate used to require a specified label.  Today this is no longer the case, and  labels may always be given optionally to any component function of Rayica.  If a label is not indicated by the user, then Rayica assigns a built-in default label for the object.  If a label is not  assigned to Resonate, then the resulting graphics continues to display a distinct label for  each component inside the Resonate function.

AnalyzeSystem[{Move[LineOfRays[45, NumberOfRays8], 5], Resonate[{ɯ ... ], Move[Mirror[50, 5], 60]} ], Boundary[70, 60]}, PlotTypeTopView]

[Graphics:HTMLFiles/index_89.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{RowBox[{Move, [, RowBox[{LineOfRay ... ]}], ,, Boundary[{0, -30, -30}, {70, 30, 30}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-48 ray/surface intersections-

Resonate now works without a specified label.

Go to list of topics

The Labels Option

A different method of attaching graphical labels to your components is  with the Labels option.  This way, you can affect only the graphical rendering without  replacing the printed output.

mirror = Mirror[50,10,Labels->"mirror"]

Mirror[50, 10, {Labelsmirror}]


AnalyzeSystem[{mirror, Move[mirror, 100]}, PlotType->TopView]

[Graphics:HTMLFiles/index_93.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{Mirror[50, 10, {Labelsmirr ... , 10, {Labelsmirror}], ,, 100.}], ]}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-rendered system without rays-

Rayica uses your labels in the graphics, but the printed output shows the full  function names.

A Labels option is always in the default Options settings of every component.

Labels/.Options[Mirror]//InputForm

M

Go to list of topics

Surpressing Labels

There are two methods for surpressing labels.  In order to surpress all  labelling, you simply pass the option ShowLabels->False to AnalyzeSystem or ShowSystem.  However, you can otherwise supply an empty string as a label to  suppress the automatic labelling of an individual component graphic.

defaultSystem = AnalyzeSystem[{PlanoConvexLens[100, 50, 10], Move[Prism[{60, 50, 60}, 50, "", CenteredTrue], 50]}, PlotTypeTopView]

[Graphics:HTMLFiles/index_97.gif]

TagBox[RowBox[{AnalyzeSystem, [, RowBox[{RowBox[{{, RowBox[{PlanoConvexLens[100, 50, 10], ,, R ... [{62.5, ,, RowBox[{-, 21.6506}]}], }}]}], ]}]}], }}], ,, PlotTypeTopView}], ]}], HoldForm]

-rendered system without rays-

The prism label was surpressed with "".  The plano-convex lens label "L" still automatically appears.

Go to list of topics


Created by Mathematica  (November 19, 2004)