private float random() { return (random.nextFloat()*2 - 1) * (float)(d.getRadius()); }
private void updateFond(GrBoite _boite) { buildFond(null); if (_boite == null) return; double maxDist = Math.max(Math.max(_boite.getDeltaX(), _boite.getDeltaY()), _boite.getDeltaZ()); background_.setApplicationBounds(new BoundingSphere(new Point3d(_boite.getMidX(), _boite.getMidY(), _boite .getMidZ()), maxDist * 20)); }
protected void updateEchelle(final double _newEchelle) { if (_newEchelle == echelle_) { return; } final GrBoite boite = getBoite(); final Transform3D t3d = new Transform3D(); transformU_.getTransform(t3d); final Vector3d trans = new Vector3d(); t3d.get(trans); final double deltaInit = trans.z - boite.o_.z_ * echelle_; trans.z = boite.o_.z_ * _newEchelle + deltaInit; t3d.setTranslation(trans); transformU_.setTransform(t3d); for (final Enumeration en = lumieres_.getAllChildren(); en.hasMoreElements();) { final Object obj = en.nextElement(); if (obj instanceof BLumiereDirectionnelle) { final BLumiereDirectionnelle calque = (BLumiereDirectionnelle) obj; final BoundingSphere b = calque.getLightBounds(); final Point3d center = new Point3d(); b.getCenter(center); center.z = boite.e_.z_ * _newEchelle; b.setCenter(center); } } echelle_ = _newEchelle; // init(); // getCurrentCamera().set(t3d); }
public static BLumiereDirectionnelle createLumiere(final BGroupeVolume _gv) { GrBoite boite; boite = _gv.getBoite(); final double dx = Math.abs(boite.getDeltaX()); final double dz = Math.abs(boite.getDeltaZ()); final double dy = Math.abs(boite.getDeltaY()); final BLumiereDirectionnelle l1 = new BLumiereDirectionnelle(new Vector3f(0, 0, -1), Color.white); double dist = (dx * dx + dy * dy) / 4; dist = Math.sqrt(dz * dz + dist); final BoundingSphere sphere = new BoundingSphere(new Point3d(boite.o_.x_ + dx / 2, boite.o_.y_ + dy / 2, boite.e_.z_), dist); l1.setBounds(sphere); l1.setIntensite(0.3); l1.setDirection(new Vector3f(0, 0.1f, -1f)); l1.setRapide(false); l1.setVisible(true); return l1; }
public void start() { trajectoire_ = new RotPosPathInterpolator(new Alpha(nbCycles_, temps_), univers_.getTransformGroup(), axe_, pourcentAtIndex_, directions_, positions_); trajectoire_.setSchedulingBounds(new BoundingSphere()); bg_ = new BranchGroup(); bg_.setCapability(BranchGroup.ALLOW_DETACH); bg_.addChild(trajectoire_); univers_.addBranchGraph(bg_); }
private void doInit() { Graph<V,E> graph = getGraph(); BoundingSphere d = getSize(); if(graph != null) {//&& d != null) { currentIteration = 0; temperature = d.getRadius() / 10; forceConstant = Math .sqrt(d.getRadius() * d.getRadius() * d.getRadius() / graph.getVertexCount()); attraction_constant = attraction_multiplier * forceConstant; repulsion_constant = repulsion_multiplier * forceConstant; } }
public BLumiereDirectionnelle(final Vector3f _vecteur, final Color _couleur) { couleur_ = _couleur; direction_ = _vecteur; l_ = new DirectionalLight(new Color3f(_couleur), _vecteur); l_.setCapability(Light.ALLOW_STATE_WRITE); l_.setCapability(Light.ALLOW_STATE_READ); l_.setCapability(Light.ALLOW_COLOR_WRITE); l_.setCapability(Light.ALLOW_COLOR_READ); l_.setCapability(DirectionalLight.ALLOW_DIRECTION_WRITE); l_.setCapability(DirectionalLight.ALLOW_DIRECTION_READ); l_.setCapability(Node.ALLOW_BOUNDS_READ); l_.setCapability(Node.ALLOW_BOUNDS_WRITE); l_.setCapability(Light.ALLOW_INFLUENCING_BOUNDS_READ); l_.setCapability(Light.ALLOW_INFLUENCING_BOUNDS_WRITE); setCapability(ALLOW_AUTO_COMPUTE_BOUNDS_READ); setCapability(ALLOW_AUTO_COMPUTE_BOUNDS_READ); l_.setInfluencingBounds(new BoundingSphere(new Point3d(), 100)); for (int i = 18; i < 20; i++) { l_.setCapability(i); } addChild(l_); setName("Direction"); }
private void adjustLocations(BoundingSphere oldSize, BoundingSphere size) { float oldWidth = 0; float oldHeight = 0; float oldDepth = 0; float width = 0; float height = 0; float depth = 0; oldWidth = oldHeight = oldDepth = (float) (2*oldSize.getRadius()); width = height = depth = (float) (2*size.getRadius()); float xOffset = (oldWidth - width) / 2; float yOffset = (oldHeight - height) / 2; float zOffset = (oldDepth - depth) / 2; // now, move each vertex to be at the new screen center while(true) { try { for(V v : getGraph().getVertices()) { offsetVertex(v, xOffset, yOffset, zOffset); } break; } catch(ConcurrentModificationException cme) { } } }
elayout.setSize(new BoundingSphere(new Point3d(), 200)); elayout.initialize(); VisRunner runner = new VisRunner((IterativeContext)elayout);
private synchronized void adjust() { //Generate random position in graph space tempISOM = new ISOMVertexData(); tempXYD = new Point3f(); // creates a new XYZ data location tempXYD.set((float)(10 + Math.random() * getSize().getRadius()), (float)(10 + Math.random() * getSize().getRadius()), (float)(10 + Math.random() * getSize().getRadius())); //Get closest vertex to random position V winner = elementAccessor.getVertex(this, tempXYD); while(true) { try { for(V v : getGraph().getVertices()) { ISOMVertexData ivd = getISOMVertexData(v); ivd.distance = 0; ivd.visited = false; } break; } catch(ConcurrentModificationException cme) {} } adjustVertex(winner); }
yellowLook.setMaterial(yellowMaterial); Bounds bounds = new BoundingSphere(new Point3d(), 300);
float radius = (float) d.getRadius();