Package javax.vecmath

Examples of javax.vecmath.Point3d


        // TODO use light factories

        AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
        alight.setEnable(true);
        rootGroup.addChild(alight);
        BoundingSphere bounds = new BoundingSphere (new Point3d (0, 0.0, 0), 1E100);
        alight.setInfluencingBounds(bounds);

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
View Full Code Here


        // TODO use light factories

        AmbientLight alight = new AmbientLight(true,new Color3f(0.5f,0.5f,0.5f));
        alight.setEnable(true);
        rootGroup.addChild(alight);
        BoundingSphere bounds = new BoundingSphere (new Point3d (0, 0.0, 0), 1E100);
        alight.setInfluencingBounds(bounds);

        lights = new DirectionalLight[1];

        for (int i=0; i<lights.length; ++i) {
View Full Code Here

        TransformGroup objTrans = new TransformGroup();
        Transform3D t3dTrans = new Transform3D();
        objTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
        objTrans.setTransform(t3dTrans);
        objRoot.addChild(objTrans);
        BoundingSphere bounds = new BoundingSphere(new Point3d(0.0, 0.0, 0.0),
                100.0);
        // Set up the ambient light
        Color3f ambientColor = new Color3f(0.3f, 0.3f, 0.3f);
        AmbientLight ambientLightNode = new AmbientLight(ambientColor);
        ambientLightNode.setInfluencingBounds(bounds);
View Full Code Here

   
    // scale the shape to have a reasonable size
    // and translate it to the origin
    Bounds bounds = transformGroup.getBounds();
    if (bounds instanceof BoundingSphere) {
      Point3d center = new Point3d();
      ((BoundingSphere)bounds).getCenter(center);
      Transform3D tr = new Transform3D();
      tr.setScale(10.0/((BoundingSphere)bounds).getRadius());
      Transform3D tr2 = new Transform3D();
      center.negate();
      tr2.setTranslation(new Vector3f(center));
      tr.mul(tr2);
      transformGroup.setTransform(tr);
    }
View Full Code Here

      float normal[] = new float[coord.length];

        Vector3d v1 = new Vector3d();
        Vector3d v2 = new Vector3d();
        Vector3d faceNormal = new Vector3d();
        Point3d a = new Point3d();
        Point3d b = new Point3d();
        Point3d c = new Point3d();


        // step through all the faces
        for (int i=0; i<idx.length; i+=3) {

          int ja = idx[i] * 3;
            a.set(coord[ja],coord[ja+1],coord[ja+2]);
            int jb = idx[i+1] * 3;
            b.set(coord[jb],coord[jb+1],coord[jb+2]);
            int jc = idx[i+2] * 3;
            c.set(coord[jc],coord[jc+1],coord[jc+2]);

            v1.sub(b, a);
            v2.sub(c, a);
            faceNormal.cross(v1, v2);
            if (faceNormal.length()==0) continue;
View Full Code Here

    // Create a universe bound to no canvas 3D
    ViewingPlatform viewingPlatform = new ViewingPlatform();
    // Add an interpolator to view transform to get smooth transition
    TransformGroup viewPlatformTransform = viewingPlatform.getViewPlatformTransform();
    CameraInterpolator cameraInterpolator = new CameraInterpolator(viewPlatformTransform);
    cameraInterpolator.setSchedulingBounds(new BoundingSphere(new Point3d(), 1E7));
    viewPlatformTransform.addChild(cameraInterpolator);
    viewPlatformTransform.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
   
    Viewer viewer = new Viewer(new Canvas3D [0]);
    SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);
View Full Code Here

   
    final Background background = new Background(backgroundBranch);
    updateBackgroundColorAndTexture(backgroundAppearance, this.home, waitForLoading);
    background.setImageScaleMode(Background.SCALE_FIT_ALL);
    background.setApplicationBounds(new BoundingBox(
        new Point3d(-1E6, -1E6, -1E6),
        new Point3d(1E6, 1E6, 1E6)));   
   
    if (listenToHomeUpdates) {
      // Add a listener on sky color and texture properties change
      this.skyColorListener = new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent ev) {
View Full Code Here

      lights [i].setUserData(defaultColor);
      updateLightColor(lights [i]);
    }
   
    for (Light light : lights) {
      light.setInfluencingBounds(new BoundingSphere(new Point3d(), 1E7));
    }
   
    if (listenToHomeUpdates) {
      // Add a listener on light color property change to home
      this.lightColorListener = new PropertyChangeListener() {
View Full Code Here

      if (this.visualScene != null) {
        Transform3D rootTransform = new Transform3D();
        this.visualScene.getTransform(rootTransform);

        BoundingBox bounds = new BoundingBox(
            new Point3d(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY),
            new Point3d(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
        computeBounds(this.visualScene, bounds, new Transform3D());

        // Set orientation to Y_UP
        Transform3D axisTransform = new Transform3D();
        if ("Z_UP".equals(axis)) {
          axisTransform.rotX(-Math.PI / 2);
        } else if ("X_UP".equals(axis)) {
          axisTransform.rotZ(Math.PI / 2);
        }
        rootTransform.mul(axisTransform);
        // Translate model to its center
        Point3d lower = new Point3d();
        bounds.getLower(lower);
        if (lower.x != Double.POSITIVE_INFINITY) {
          Point3d upper = new Point3d();
          bounds.getUpper(upper);
          Transform3D translation = new Transform3D();
          translation.setTranslation(
              new Vector3d(-lower.x - (upper.x - lower.x) / 2,
                  -lower.y - (upper.y - lower.y) / 2,
View Full Code Here

   * Returns the background node. 
   */
  private Node getBackgroundNode() {
    Background background = new Background(new Color3f(0.9f, 0.9f, 0.9f));
    background.setCapability(Background.ALLOW_COLOR_WRITE);
    background.setApplicationBounds(new BoundingSphere(new Point3d(0, 0, 0), 100));
    return background;
  }
View Full Code Here

TOP

Related Classes of javax.vecmath.Point3d

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.