public NSlitDragger(XDragWidget widthDragger, XDragWidget distDragger, WTInt n) { // Get references to the Widgets widthWidget = widthDragger; distanceWidget = distDragger; // Add this as a Listener to the Widgets widthWidget.addListener(this); distanceWidget.addListener(this); // Get a reference to N N = n; }
public void updateDistanceDraggerConstraints() { float min = width * (N.getValue() - 1), max = APERTURE_WIDTH / 2.0f - width; // ** Manage book keeping variables for other classes **// min_distance = min; max_distance = max; distanceWidget.setMin(min); distanceWidget.setMax(max); distanceSetInternally = true; }
// If was single slit, evaluate differently public float evaluateSingle() { distanceSetInternally = true; distance = 2 * width; distanceWidgetPosition = distance * (N.getValue() - 1) / 2.0f; distanceWidget.setValue(distanceWidgetPosition); return distance / 500.0f; }
public void updateWidthDraggerConstraints() { float max, max1 = APERTURE_WIDTH / 2.0f - distanceWidgetPosition, // The slit touches the wall max2 = distance / 2.0f; // The two slits touch DebugPrinter.println( "distWidgetPosition-> " + distanceWidgetPosition + " distance->" + distance); if (N.getValue() == 1) { max = APERTURE_WIDTH / 2.0f; } else { max = (max1 < max2) ? max1 : max2; } min_width = 0; max_width = max; widthWidget.setMin(0); widthWidget.setMax(max); }
public void evaluateDistance() { distanceSetInternally = true; distanceWidgetPosition = distance * (N.getValue() - 1) / 2.0f; distanceWidget.setValue(distanceWidgetPosition); }