List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D
public Vector3D(double x, double y, double z)
From source file:ch.epfl.leb.sass.models.illuminations.internal.SquareUniformElectricField.java
/** * Creates a new instance of this command. * /*ww w.j av a2 s. c o m*/ * Any z-component of the E-field orientation will be ignored since this * class propagates along the +z direction by default. * * @param width The extent of the field in x from 0 to width. * @param height The extend of the field in y from 0 to height. * @param orientation The orientation of the electric field vector. * @param wavelength The wavelength of the radiation. * @param refractiveIndex The sample's refractive index distribution. */ private SquareUniformElectricField(double width, double height, Vector3D orientation, double wavelength, RefractiveIndex refractiveIndex) { this.width = width; this.height = height; this.wavelength = wavelength; this.refractiveIndex = refractiveIndex; // Ignore any z-component of the field. this.orientation = (new Vector3D(orientation.getX(), orientation.getY(), 0)).normalize(); }
From source file:lambertmrev.conversions.java
public static CartesianOrbit hyp2ele(double[] hyp, Vector<Tracklet> subSet, constraints set, TopocentricFrame staF, Frame inertialFrame, TimeScale utc) { int N = subSet.size(); AbsoluteDate year = new AbsoluteDate(Main.YEAR, utc); double tof = FastMath.abs(subSet.elementAt(0).getDOY() - subSet.elementAt(N - 1).getDOY()) * 24 * 3600; // System.out.println("RA\t:" + subSet.elementAt(0).getRA() + "\tDEC:\t" + subSet.elementAt(0).getDEC() + "\thyp:\t" + hyp[0]); Vector3D geoPos1 = conversions.radec2geo(subSet.elementAt(0), hyp[0], staF, inertialFrame, utc); Vector3D geoPos2 = conversions.radec2geo(subSet.elementAt(N - 1), hyp[1], staF, inertialFrame, utc); // System.out.println("x1:\t" + geoPos1.getX() + "\ty1:\t" + geoPos1.getY() + "\tz1:\t" + geoPos1.getZ()); // define epoch of first tracklet AbsoluteDate epoch0 = new AbsoluteDate(year, subSet.elementAt(0).getDOY() * 24 * 3600); // perform lambert solver Lambert solve = new Lambert(); solve.lambert_problem(geoPos1, geoPos2, tof, Constants.EIGEN5C_EARTH_MU, Boolean.FALSE, 1); RealMatrix v1 = solve.get_v1();/*from w w w . j av a 2s . c om*/ // get the orbital elements at epoch 0 Vector3D v1vec = new Vector3D(v1.getEntry(0, 0), v1.getEntry(0, 1), v1.getEntry(0, 2)); PVCoordinates PVgeo1 = new PVCoordinates(geoPos1, v1vec); CartesianOrbit orbit = new CartesianOrbit(PVgeo1, inertialFrame, epoch0, Constants.EIGEN5C_EARTH_MU); // System.out.println("a:\t" + orbit.getA() + "\ti:\t" + orbit.getI() + "\te:\t" + orbit.getE()); return orbit; }
From source file:com.mapr.synth.drive.DriveTest.java
@Test public void testCrazyPlan() { Random rand = new Random(3); GeoPoint start = new GeoPoint(new Vector3D(0.84338521, 0.40330691, 0.35502805)); GeoPoint end = new GeoPoint(new Vector3D(0.84293820, 0.40512281, 0.35402076)); for (int i = 0; i < 100000; i++) { List<Car.Segment> plan = Car.plan(start, end, rand); GeoPoint old = start;/*from ww w .ja va 2 s . c o m*/ for (Car.Segment segment : plan.subList(1, plan.size())) { double distance = old.distance(segment.getEnd()); if (distance > 100 || Double.isNaN(distance)) { Assert.fail("Got bad distance"); } old = segment.getEnd(); } } }
From source file:fr.amap.lidar.format.jleica.GriddedPointScan.java
/** * Compute minimum and maximum azimutal and elevation angles of the scan. *///from ww w. ja v a 2s.c o m public void computeExtremumsAngles() { Statistic minAzimutalAngle = new Statistic(); Statistic maxAzimutalAngle = new Statistic(); resetRowLimits(); resetColumnLimits(); //compute min azimutal angle int i; for (i = 0; i < header.getNumCols(); i++) { setUpColumnToRead(i); Iterator<LPoint> iterator = this.iterator(); while (iterator.hasNext()) { LPoint point = iterator.next(); SphericalCoordinates sc; if (header.isPointInFloatFormat()) { LFloatPoint floatPoint = (LFloatPoint) point; sc = new SphericalCoordinates( new Vector3D(floatPoint.x, floatPoint.y, floatPoint.z).normalize()); } else { LDoublePoint doublePoint = (LDoublePoint) point; sc = new SphericalCoordinates( new Vector3D(doublePoint.x, doublePoint.y, doublePoint.z).normalize()); } minAzimutalAngle.addValue(sc.getTheta()); } if (minAzimutalAngle.getNbValues() > 0) { break; } } azim_min = minAzimutalAngle.getMean(); colIndexAzimMin = i; //compute max azimutal angle // for (i = colIndexAzimMin+100; i < header.getNumCols(); i+=100) { // // setUpColumnToRead(i); // // Iterator<LPoint> iterator = this.iterator(); // // while(iterator.hasNext()){ // // LPoint point = iterator.next(); // // SphericalCoordinates sc = new SphericalCoordinates(); // // if(header.isPointInFloatFormat()){ // // LFloatPoint floatPoint = (LFloatPoint)point; // sc.toSpherical(new Point3d(floatPoint.x, floatPoint.y, floatPoint.z)); // }else{ // LDoublePoint doublePoint = (LDoublePoint)point; // sc.toSpherical(new Point3d(doublePoint.x, doublePoint.y, doublePoint.z)); // } // // maxAzimutalAngle.addValue(sc.getAzimuth()); // } // // if(maxAzimutalAngle.getNbValues() > 0){ // break; // } // } // // azim_max = maxAzimutalAngle.getMean(); // colIndexAzimMax = i; for (i = header.getNumCols() - 1; i >= 0; i--) { setUpColumnToRead(i); Iterator<LPoint> iterator = this.iterator(); while (iterator.hasNext()) { LPoint point = iterator.next(); SphericalCoordinates sc; if (header.isPointInFloatFormat()) { LFloatPoint floatPoint = (LFloatPoint) point; sc = new SphericalCoordinates( new Vector3D(floatPoint.x, floatPoint.y, floatPoint.z).normalize()); } else { LDoublePoint doublePoint = (LDoublePoint) point; sc = new SphericalCoordinates( new Vector3D(doublePoint.x, doublePoint.y, doublePoint.z).normalize()); } maxAzimutalAngle.addValue(sc.getTheta()); } if (maxAzimutalAngle.getNbValues() > 0) { break; } } azim_max = maxAzimutalAngle.getMean(); colIndexAzimMax = i; //compute min zenithal angle //compute max azimutal angle resetColumnLimits(); Statistic minZenithalAngle = new Statistic(); Statistic maxZenithalAngle = new Statistic(); for (i = 0; i < header.getNumRows(); i++) { setUpRowToRead(i); Iterator<LPoint> iterator = this.iterator(); while (iterator.hasNext()) { LPoint point = iterator.next(); SphericalCoordinates sc; if (header.isPointInFloatFormat()) { LFloatPoint floatPoint = (LFloatPoint) point; sc = new SphericalCoordinates( new Vector3D(floatPoint.x, floatPoint.y, floatPoint.z).normalize()); } else { LDoublePoint doublePoint = (LDoublePoint) point; sc = new SphericalCoordinates( new Vector3D(doublePoint.x, doublePoint.y, doublePoint.z).normalize()); } minZenithalAngle.addValue(sc.getPhi()); } if (minZenithalAngle.getNbValues() > 0) { break; } } elev_min = minZenithalAngle.getMean(); rowIndexElevMin = i; for (i = header.getNumRows() - 1; i >= 0; i--) { setUpRowToRead(i); Iterator<LPoint> iterator = this.iterator(); while (iterator.hasNext()) { LPoint point = iterator.next(); SphericalCoordinates sc; if (header.isPointInFloatFormat()) { LFloatPoint floatPoint = (LFloatPoint) point; sc = new SphericalCoordinates( new Vector3D(floatPoint.x, floatPoint.y, floatPoint.z).normalize()); } else { LDoublePoint doublePoint = (LDoublePoint) point; sc = new SphericalCoordinates( new Vector3D(doublePoint.x, doublePoint.y, doublePoint.z).normalize()); } maxZenithalAngle.addValue(sc.getPhi()); } if (maxZenithalAngle.getNbValues() > 0) { break; } } elev_max = maxZenithalAngle.getMean(); rowIndexElevMax = i; resetRowLimits(); resetColumnLimits(); }
From source file:magma.tools.benchmark.model.proxy.BenchmarkAgentProxy.java
private String extractGazeboGroundTruth(String message) { int groundTruthIndex = message.lastIndexOf(" (mypos"); if (groundTruthIndex < 0) { return message; }//from ww w . j a v a 2 s. com String groundTruth = message.substring(groundTruthIndex).trim(); SymbolNode result = parser.parse(groundTruth); SymbolNode myPos = (SymbolNode) result.children.get(0); groundTruthPosition = new Vector3D(parseFloat(myPos, 1), parseFloat(myPos, 2), parseFloat(myPos, 3)); SymbolNode myOrien = (SymbolNode) result.children.get(1); groundTruthOrientation = parseFloat(myOrien, 1); // ground truth in gazebo is always at end return message.substring(0, groundTruthIndex); }
From source file:jat.core.cm.CRTBP.java
public void findLibrationPoints() { BisectionSolver bs = new BisectionSolver(); UnivariateFunction Lfunction = new L123Func(); double L1 = bs.solve(100, Lfunction, 0, 1.); LibPoints[0] = new Vector3D(L1, 0, 0); C1 = JacobiIntegral(L1, 0, 0, 0, 0, 0); double L2 = bs.solve(100, Lfunction, 1, 2.); LibPoints[1] = new Vector3D(L2, 0, 0); C2 = JacobiIntegral(L2, 0, 0, 0, 0, 0); double L3 = bs.solve(100, Lfunction, -2.0, 0); LibPoints[2] = new Vector3D(L3, 0, 0); C3 = JacobiIntegral(L3, 0, 0, 0, 0, 0); double y45 = Math.sqrt(3.) / 2; LibPoints[3] = new Vector3D(.5 - mu, y45, 0); LibPoints[4] = new Vector3D(.5 - mu, -y45, 0); System.out.println("L1: " + L1 + " C1 " + C1); System.out.println("L2: " + L2 + " C2 " + C2); System.out.println("L3: " + L3 + " C3 " + C3); System.out.println("L4= (" + LibPoints[3].getX() + "," + LibPoints[3].getY() + ")"); System.out.println("L5= (" + LibPoints[4].getX() + "," + LibPoints[4].getY() + ")"); }
From source file:edu.stanford.cfuller.imageanalysistools.filter.ConvexHullByLabelFilter.java
/** * Applies the convex hull filter to the supplied mask. * @param im The Image to process-- a mask whose regions will be replaced by their filled convex hulls. *///from w ww .jav a2 s .co m @Override public void apply(WritableImage im) { RelabelFilter RLF = new RelabelFilter(); RLF.apply(im); Histogram h = new Histogram(im); java.util.Hashtable<Integer, java.util.Vector<Integer>> xLists = new java.util.Hashtable<Integer, java.util.Vector<Integer>>(); java.util.Hashtable<Integer, java.util.Vector<Integer>> yLists = new java.util.Hashtable<Integer, java.util.Vector<Integer>>(); java.util.Vector<Integer> minValues = new java.util.Vector<Integer>(h.getMaxValue() + 1); java.util.Vector<Integer> minIndices = new java.util.Vector<Integer>(h.getMaxValue() + 1); for (int i = 0; i < h.getMaxValue() + 1; i++) { minValues.add(im.getDimensionSizes().get(ImageCoordinate.X)); minIndices.add(0); } for (ImageCoordinate i : im) { int value = (int) im.getValue(i); if (value == 0) continue; if (!xLists.containsKey(value)) { xLists.put(value, new java.util.Vector<Integer>()); yLists.put(value, new java.util.Vector<Integer>()); } xLists.get(value).add(i.get(ImageCoordinate.X)); yLists.get(value).add(i.get(ImageCoordinate.Y)); if (i.get(ImageCoordinate.X) < minValues.get(value)) { minValues.set(value, i.get(ImageCoordinate.X)); minIndices.set(value, xLists.get(value).size() - 1); } } java.util.Vector<Integer> hullPointsX = new java.util.Vector<Integer>(); java.util.Vector<Integer> hullPointsY = new java.util.Vector<Integer>(); ImageCoordinate ic = ImageCoordinate.createCoordXYZCT(0, 0, 0, 0, 0); for (int k = 1; k < h.getMaxValue() + 1; k++) { hullPointsX.clear(); hullPointsY.clear(); java.util.Vector<Integer> xList = xLists.get(k); java.util.Vector<Integer> yList = yLists.get(k); int minIndex = (int) minIndices.get(k); //start at the leftmost point int currentIndex = minIndex; int currentX = xList.get(currentIndex); int currentY = yList.get(currentIndex); hullPointsX.add(currentX); hullPointsY.add(currentY); org.apache.commons.math3.linear.RealVector angles = new org.apache.commons.math3.linear.ArrayRealVector( xList.size()); Vector3D currentVector = new Vector3D(0, -1, 0); java.util.HashSet<Integer> visited = new java.util.HashSet<Integer>(); do { visited.add(currentIndex); int maxIndex = 0; double maxAngle = -2 * Math.PI; double dist = Double.MAX_VALUE; for (int i = 0; i < xList.size(); i++) { if (i == currentIndex) continue; Vector3D next = new Vector3D(xList.get(i) - xList.get(currentIndex), yList.get(i) - yList.get(currentIndex), 0); double angle = Vector3D.angle(currentVector, next); angles.setEntry(i, angle); if (angle > maxAngle) { maxAngle = angle; maxIndex = i; dist = next.getNorm(); } else if (angle == maxAngle) { double tempDist = next.getNorm(); if (tempDist < dist) { dist = tempDist; maxAngle = angle; maxIndex = i; } } } currentX = xList.get(maxIndex); currentY = yList.get(maxIndex); currentVector = new Vector3D(xList.get(currentIndex) - currentX, yList.get(currentIndex) - currentY, 0); hullPointsX.add(currentX); hullPointsY.add(currentY); currentIndex = maxIndex; } while (!visited.contains(currentIndex)); //hull vertices have now been determined .. need to fill in the lines //between them so I can apply a fill filter //approach: x1, y1 to x0, y0: //start at min x, min y, go to max x, max y // if x_i, y_i = x0, y0 + slope to within 0.5 * sqrt(2), then add to hull double eps = Math.sqrt(2); for (int i = 0; i < hullPointsX.size() - 1; i++) { int x0 = hullPointsX.get(i); int y0 = hullPointsY.get(i); int x1 = hullPointsX.get(i + 1); int y1 = hullPointsY.get(i + 1); int xmin = (x0 < x1) ? x0 : x1; int ymin = (y0 < y1) ? y0 : y1; int xmax = (x0 > x1) ? x0 : x1; int ymax = (y0 > y1) ? y0 : y1; x1 -= x0; y1 -= y0; double denom = (x1 * x1 + y1 * y1); for (int x = xmin; x <= xmax; x++) { for (int y = ymin; y <= ymax; y++) { int rel_x = x - x0; int rel_y = y - y0; double projLength = (x1 * rel_x + y1 * rel_y) / denom; double projPoint_x = x1 * projLength; double projPoint_y = y1 * projLength; if (Math.hypot(rel_x - projPoint_x, rel_y - projPoint_y) < eps) { ic.set(ImageCoordinate.X, x); ic.set(ImageCoordinate.Y, y); im.setValue(ic, k); } } } } } ic.recycle(); FillFilter ff = new FillFilter(); ff.apply(im); }
From source file:Engine.Projectile.java
private IRenderableGameObject CoolideWithGameObjectsOnMap(Screen screen) { int x = (int) (actualPosition.getX() / GenerateTerrain.Size); int y = (int) (actualPosition.getY() / GenerateTerrain.Size); for (int a = x - Configurations.MaximalObjectSize; a <= x + Configurations.MaximalObjectSize; a++) for (int b = y - Configurations.MaximalObjectSize; b <= y + Configurations.MaximalObjectSize; b++) { int a1 = a; int b1 = b; int aCorrection = 0; int bCorrection = 0; if (a1 < 0) { a1 = screen.worldMap.ObjectsMap.length + a1; aCorrection = a;/*from w ww . j a v a 2 s .c om*/ } if (a1 >= screen.worldMap.ObjectsMap.length) { a1 -= screen.worldMap.ObjectsMap.length; aCorrection = a; } if (b1 < 0) { b1 = screen.worldMap.ObjectsMap[0].length + b1; bCorrection = b; } if (b1 >= screen.worldMap.ObjectsMap[0].length) { b1 -= screen.worldMap.ObjectsMap[0].length; bCorrection = b; } if (a1 < screen.worldMap.ObjectsMap.length) { //System.out.println(a + " " + b + "," + screen.worldMap.ObjectsMap.length + " " + screen.worldMap.ObjectsMap[0].length); if (b1 < screen.worldMap.ObjectsMap[a1].length) { for (int c = 0; c < screen.worldMap.ObjectsMap[a1][b1].size(); c++) { if (screen.worldMap.ObjectsMap[a1][b1].get(c) != this && !isOwner(screen.worldMap.ObjectsMap[a1][b1].get(c))) { BoundingBox bb = screen.worldMap.ObjectsMap[a1][b1].get(c).getBoundingBox(); IRenderableGameObject rgo = screen.worldMap.ObjectsMap[a1][b1].get(c); //if (a < 0 || b < 0 || a >= screen.worldMap.ObjectsMap.length || b >= screen.worldMap.ObjectsMap[0].length) if (aCorrection != 0 || bCorrection != 0) { bb = new BoundingBox(new Vector3D( bb.bottomLeftFront.getX() + (aCorrection * GenerateTerrain.Size), bb.bottomLeftFront.getY() + (bCorrection * GenerateTerrain.Size), bb.bottomLeftFront.getZ()), new Vector3D( bb.topRightBack.getX() + (aCorrection * GenerateTerrain.Size), bb.topRightBack.getY() + (bCorrection * GenerateTerrain.Size), bb.topRightBack.getZ())); } if (Collide(bb)) return screen.worldMap.ObjectsMap[a1][b1].get(c); } } } } } return null; }
From source file:com.rvantwisk.cnctools.controls.opengl.ArrowsActor.java
private void addArrow(double[][] arrow, double[] loc, double rA, final Vector3D p1, final Vector3D p2) { try {//from w ww .j a v a 2s . c om double angleZ = Point.angleBetween2Lines(new Point(p1.getX(), p1.getY()), new Point(p2.getX(), p2.getY()), new Point(0.0, 0.0), new Point(0.0, 1.0)); // double angleX = Point.angleBetween2Lines(new Point(lastY, lastZ), new Point(rY, rZ), new Point(0.0, 0.0), new Point(0.0, 1.0)); double dx = p1.getX() - p2.getX(); double dy = p1.getY() - p2.getY(); double d = Math.sqrt(dx * dx + dy * dy); double angle; Rotation myRotation; if (d != 0.0) { angle = Point.angleBetween2Lines(new Point(0.0, 0.0), new Point(1.0, 0.0), new Point(0.0, 0.0), new Point(d, p1.getZ() - p2.getZ())); myRotation = new Rotation(new Vector3D(1, 0, 0.0), angle + (0.0 / 360.0 * Math.PI * 2.0)); } else if ((p1.getZ() - p2.getZ()) < 0.0) { angle = (90.0 / 360.0 * Math.PI * 2.0); myRotation = new Rotation(new Vector3D(0, 1, 0.0), angle + (0.0 / 360.0 * Math.PI * 2.0)); } else { angle = (-90.0 / 360.0 * Math.PI * 2.0); myRotation = new Rotation(new Vector3D(0, 1, 0.0), angle + (0.0 / 360.0 * Math.PI * 2.0)); } Rotation myRotationZ = new Rotation(new Vector3D(0, 0, 1.0), angleZ + (-90.0 / 360.0 * Math.PI * 2.0)); Rotation myRotationA = new Rotation(new Vector3D(1.0, 0.0, 0.0), (rA / 360.0 * Math.PI * 2.0)); double[] out = new double[3]; double[] out2 = new double[3]; for (double[] v : arrow) { myRotationZ.applyTo(v, out); myRotation.applyTo(out, out2); out2[0] = out2[0] + loc[0]; out2[1] = out2[1] + loc[1]; out2[2] = out2[2] + loc[2]; myRotationA.applyTo(out2, out2); data.add((float) (out2[0] + 0.0)); data.add((float) (out2[1] + 0.0)); data.add((float) (out2[2] + 0.0)); setMotionColor(machine.getMotionMode()); } } catch (Exception e) { // If for some reason we get a exception, we just don't add the arrow logger.warn("Add arrow : This should normally not happen, please report back.", e); } }
From source file:ch.epfl.leb.sass.server.RPCServerIT.java
/** * Sets up two different Microscopes for acquisition simulations. *//*from w w w .j a v a 2 s . co m*/ @Before public void setUp() throws InterruptedException { // The seed determines the outputs of the random number generator. RNG.setSeed(42); DefaultCamera.Builder cameraBuilder = new DefaultCamera.Builder(); cameraBuilder.nX(32); // Number of pixels in x cameraBuilder.nY(32); // Number of pixels in y cameraBuilder.readoutNoise(1.6); // Standard deviation, electrons cameraBuilder.darkCurrent(0.06); cameraBuilder.quantumEfficiency(0.8); cameraBuilder.aduPerElectron(2.2); cameraBuilder.emGain(0); // Set to zero for CMOS cameras cameraBuilder.baseline(100); // ADU cameraBuilder.pixelSize(6.45); // microns cameraBuilder.thermalNoise(0.05); // electrons/frame/pixel // DefaultObjective DefaultObjective.Builder objectiveBuilder = new DefaultObjective.Builder(); objectiveBuilder.NA(1.3); // Numerical aperture objectiveBuilder.mag(60); // Magnification // DefaultLaser DefaultLaser.Builder laserBuilder = new DefaultLaser.Builder(); laserBuilder.currentPower(0.0); laserBuilder.minPower(0.0); laserBuilder.maxPower(500.0); laserBuilder.wavelength(0.642); // Illumination profile // TODO: Add illumination setup to the GUI RefractiveIndex n = new UniformRefractiveIndex(new Complex(1.33)); SquareUniformIllumination.Builder illumBuilder = new SquareUniformIllumination.Builder(); illumBuilder.height(32 * 6.45 / 60); illumBuilder.orientation(new Vector3D(1.0, 0, 0)); // x-polarized illumBuilder.refractiveIndex(n); illumBuilder.width(32 * 6.45 / 60); // DefaultStage DefaultStage.Builder stageBuilder = new DefaultStage.Builder(); stageBuilder.x(0); stageBuilder.y(0); stageBuilder.z(0); // Coverslip surface is at z = 0 // PSF, create a 2D Gaussian point-spread function Gaussian2D.Builder psfBuilder = new Gaussian2D.Builder(); // Fluorophore dynamics and properties; rates are in units of 1/frames PalmDynamics.Builder fluorPropBuilder = new PalmDynamics.Builder(); fluorPropBuilder.signal(2500); // Photons per fluorophore per frame fluorPropBuilder.wavelength(0.6); // Wavelength, microns fluorPropBuilder.kA(100); // Activation rate fluorPropBuilder.kB(0); // Bleaching rate fluorPropBuilder.kD1(0.065); // Transition rate to first dark state fluorPropBuilder.kD2(0.013); // Transition rate to second dark state fluorPropBuilder.kR1(0.004); // Return rate from first dark state fluorPropBuilder.kR2(0.157); // Return rate from second dark state // Fluorophore positions on a square grid GenerateFluorophoresGrid2D.Builder fluorPosBuilder = new GenerateFluorophoresGrid2D.Builder(); fluorPosBuilder.spacing(4); // pixels // Add fiducials to the field of view at a random location GenerateFiducialsRandom2D.Builder fidBuilder = new GenerateFiducialsRandom2D.Builder(); fidBuilder.numFiducials(2); fidBuilder.brightness(3000); // photons per frame // Add a constant background GenerateUniformBackground.Builder backgroundBuilder = new GenerateUniformBackground.Builder(); backgroundBuilder.backgroundSignal(10); // photons // Assemble the microscope and the simulator. Microscope microscope1 = new Microscope(cameraBuilder, laserBuilder, objectiveBuilder, psfBuilder, stageBuilder, fluorPosBuilder, fluorPropBuilder, fidBuilder, backgroundBuilder, illumBuilder); RPCSimulator sim0 = new RPCSimulator(microscope1); sims[0] = sim0; // Change the number of pixels for the second microscopy cameraBuilder.nX(64); cameraBuilder.nY(64); Microscope microscope2 = new Microscope(cameraBuilder, laserBuilder, objectiveBuilder, psfBuilder, stageBuilder, fluorPosBuilder, fluorPropBuilder, fidBuilder, backgroundBuilder, illumBuilder); RPCSimulator sim1 = new RPCSimulator(microscope2); sims[1] = sim1; // Adds the simulations to the manager. manager = new DefaultSimulationManager(); manager.addSimulator(sims[0]); manager.addSimulator(sims[1]); // Starts the server. rpcServer = new RPCServer(manager, PORT); Runnable serverRunnable = new Runnable() { public void run() { rpcServer.serve(); } }; new Thread(serverRunnable).start(); Thread.sleep(500); // Give the server time to start System.out.println("Server started!"); // Creates the client. rpcClient = new RPCClient(HOST_URL, PORT); RemoteSimulationService.Client client = rpcClient.getClient(); }