rayoptics.parax.diagram module

light_or_dark(is_dark=True)[source]
class Diagram(opt_model, parax_model, parax_model_key, dgm_type, seq_start=1, do_barrel_constraint=False, barrel_constraint=1.0, label='paraxial', bend_or_gap='bend', do_node_annotation=False, is_dark=True)[source]

Bases: object

class for paraxial ray rendering/editing

setup_dgm_type(dgm_type)[source]
get_label()[source]
sync_light_or_dark(is_dark)[source]
set_active_layer(layer_key)[source]
update_data(fig, **kwargs)[source]
apply_data(node, vertex)[source]
assign_object_to_node(node, factory, **kwargs)[source]
register_commands(*args, **inputs)[source]
register_add_replace_element(*args, **inputs)[source]
render_shape()[source]

render the diagram into a shape list

update_diagram_from_shape(shape)[source]

use the shape list to update the paraxial model

fit_axis_limits()[source]

define diagram axis limits as the extent of the shape polygon

compute_slide_line(shape, node, imode)[source]

compute a constraint line to keep the overall length of the airspaces surrounding node constant

constrain_to_line_action(pt0, pt2)[source]
class DiagramNode(diagram, idx)[source]

Bases: object

update_shape(view)[source]
get_label()[source]
handle_actions()[source]
class DiagramEdge(diagram, idx)[source]

Bases: object

update_shape(view)[source]
render_color()[source]
get_label()[source]
handle_actions()[source]
class BarrelConstraint(diagram)[source]

Bases: object

update_shape(view)[source]
get_label()[source]
handle_actions()[source]
class ConjugateLine(diagram, line_type)[source]

Bases: object

update_shape(view)[source]
get_label()[source]
edit_conjugate_line_actions()[source]
handle_actions()[source]
class EditNodeAction(dgm_node, filter=None, constrain_to_wedge=True)[source]

Bases: object

Action to move a diagram node, using an input pt

class EditLensAction(dgm_edge)[source]

Bases: object

Action for diagram edge, using an input pt

This is a simple wrapper class to choose the correct action, i.e. bending or thickness change, depending on the UI setting.

class EditAreaAction(dgm_edge)[source]

Bases: object

Action for diagram area, placeholder for now

This is a simple wrapper class to choose the correct action, i.e. bending or thickness change, depending on the UI setting.

class EditThicknessAction(dgm_edge)[source]

Bases: object

Action to move a diagram edge, using an input pt

The movement is constrained to be parallel to the original edge. By doing this the power and bending of the element remains constant, while the element thickness changes. Movement of the edge is limited to keep the thickness greater than zero and not to interfere with adjacent spaces.

class EditBendingAction(dgm_edge)[source]

Bases: object

Action to bend the lens element for diagram edge, using an input pt.

The movement is constrained to be along the object ray for the lens if the input point is closer to the leading node of the edge. Otherwise the movement is constrained to be along the image ray. The unconstrained point is solved to keep the element thickness constant and maintain the object-image properties of the lens.

class AddReplaceElementAction(diagram, **kwargs)[source]

Bases: object

insert or replace a node with a chunk from a factory fct

The do_command_action fct registered for this operation passes the shape being operated upon; these can be:

  • DiagramEdge: insert/add the chunk returned by the factory fct

  • DiagramNode: replace the selected node with the factory fct output

Inserting is done by splitting the corresponding gap in two. A new gap and an AirGap element are tacked on to the chunk returned from the factory fct. Replacing is done when a DiagramNode is selected. The gaps surrounding the node are retained, and modified as needed to accomodate the chunk.

class GlassDropAction[source]

Bases: object

dragEnterEvent(view, event)[source]
dragMoveEvent(view, event)[source]
dragLeaveEvent(view, event)[source]
dropEvent(view, event)[source]