-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Components linked together by two or more different paths cause problems for the layout engine. For example, a beam splitter linked to itself via three 45 degree mirrors.
Currently, Optivis just draws a straight line between the relevant nodes if it encounters this problem. This is usually not what the user wants. Right now, it is left to the user to tune their link lengths and component angles of incidence so that Optivis' straight line still works, e.g.
However, if a component that is doubly-linked is also itself linked to other components, then you get nasty layout problems:
Since the second beam splitter (the one that appears to be at the wrong angle) is linked to the top right mirror before it is linked to the main beam splitter (the one attached to the laser), it is clamped into position. When Optivis tries to link the second beam splitter to the first, it discovers that both components are already constrained, so it draws a straight line and warns the user.
In this instance it might be better to ignore the user-defined angle of incidence on the second beam splitter, and instead set it to a value which would properly obey the law of reflection. This would then involve propagating the rotation of the second beam splitter back to M5.
It gets even more complicated if M5 is already linked to, for example, the top right mirror. Then Optivis would possibly have to also ignore the angle of incidence on M5.
Food for thought.
Code:
import optivis.scene as scene
import optivis.bench.links as links
import optivis.bench.components as components
import optivis.view.canvas as canvas
scene = scene.Scene(title="Double Links")
l1 = components.Laser(name="L1")
bs1 = components.BeamSplitter(name="BS1", aoi=22.5)
m2 = components.CavityMirror(name="M2", aoi=-23)
bs2 = components.BeamSplitter(name="BS2", aoi=10)
m4 = components.CavityMirror(name="M4")
m5 = components.SteeringMirror(name="M5")
scene.reference = l1
scene.link(bs2.getOutputNode('bkA'), m5.getInputNode('fr'), 100)
scene.link(l1.getOutputNode('out'), bs1.getInputNode('bkA'), 50)
scene.link(bs1.getOutputNode('frB'), m2.getInputNode('fr'), 50)
scene.link(bs1.getOutputNode('frA'), bs2.getInputNode('frA'), 50)
scene.link(bs1.getOutputNode('bkA'), m4.getInputNode('fr'), 50)
scene.link(m2.getOutputNode('fr'), bs2.getInputNode('frB'), 35)
gui = canvas.Simple(scene=scene)
gui.show()
