/** * {@inheritDoc} * * @see org.eclipse.draw3d.ISurface#findFigureAt(int, int, org.eclipse.draw2d.TreeSearch) */ public IFigure findFigureAt(int i_sx, int i_sy, TreeSearch i_search) { Point sLocation = Draw3DCache.getPoint(); Vector3f rayPoint = Draw3DCache.getVector3f(); try { Picker picker = m_scene.getPicker(); ISurface currentSurface = picker.getCurrentSurface(); sLocation.setLocation(i_sx, i_sy); currentSurface.getWorldLocation(sLocation, rayPoint); Hit hit = picker.getHit(rayPoint, i_search); if (hit != null) return hit.getSearchResult(); if (i_search == null || (!i_search.prune(m_host) && i_search.accept(m_host))) return m_host; return null; } finally { Draw3DCache.returnPoint(sLocation); Draw3DCache.returnVector3f(rayPoint); } }
public void testCalc() throws Exception { imitators.Calc c = new imitators.Calc(); // Setup box params c.xmin = 0; c.xmax = 10; c.ymin = 0; c.ymax = 5; // Tube center coordinates c.xp = 5; c.yp = 4; c.setAlphaGrag(50); // Check convert Rad <-> Grad double eps = 0.001; assertEquals(50.0, c.getAlphaGrad()); assertEquals(0.873, c.getAlphaRad(), eps); assertEquals(-0.195, c.ylx(0), eps); ISurface s = new TestSurface(); assertEquals(1.0, s.y(0.0)); double x0 = c.findRoot(s, 0.0, 5.0, eps); assertEquals(2.307, x0, eps); assertEquals(1.741, s.y(x0), eps); }