Package javax.vecmath

Examples of javax.vecmath.Point3d


* objects.
* @param boundsObjects an array of bounds objects
*/
public BoundingSphere(Bounds[] boundsObjects) {
  boundId = BOUNDING_SPHERE;
  center = new Point3d();

  if (boundsObjects == null || boundsObjects.length <= 0) {
    setEmptyBounds();
    return;
  }

  // find first non empty bounds object
  int i = 0;
  while( boundsObjects[i] == null && i < boundsObjects.length) {
      i++;
  }

  if (i >= boundsObjects.length) { // all bounds objects were empty
    setEmptyBounds();
    return;
  }

  this.set(boundsObjects[i++]);
  if(boundsIsInfinite)
      return;

  Point3d[] boxVerts = null;
  for(;i<boundsObjects.length;i++) {
      if( boundsObjects[i] == null ); // do nothing
      else if( boundsObjects[i].boundsIsEmpty); // do nothing
      else if( boundsObjects[i].boundsIsInfinite ) {
      setInfiniteBounds();
      return; // We're done.
      }
      else if( boundsObjects[i].boundId == BOUNDING_BOX){
    BoundingBox b = (BoundingBox)boundsObjects[i];
      if (boxVerts == null) {
        boxVerts = new Point3d[8];
        for (int j = 0; j < 8; j++)
          boxVerts[j] = new Point3d();

      }
    boxVerts[0].set(b.lower.x, b.lower.y, b.lower.z );
    boxVerts[1].set(b.lower.x, b.upper.y, b.lower.z );
    boxVerts[2].set(b.upper.x, b.lower.y, b.lower.z );
View Full Code Here


      return true;
  }

  double l2oc,rad2,tca,t2hc,t,invMag;
  Vector3d dir = new Vector3d()// normalized direction of ray
  Point3d oc  = new Point3d()// vector from sphere center to ray origin

  oc.x = center.x - origin.x;
  oc.y = center.y - origin.y;
  oc.z = center.z - origin.z;
View Full Code Here

      return true;
  }

  double l2oc,rad2,tca,t2hc,invMag,t;
  Vector3d dir = new Vector3d()// normalized direction of ray
  Point3d oc  = new Point3d()// vector from sphere center to ray origin
  Vector3d direction = new Vector3d();

  oc.x = center.x - start.x;
  oc.y = center.y - start.y;
  oc.z = center.z - start.z;
View Full Code Here

      return true;
  }

  double l2oc,rad2,tca,t2hc,mag;
  Vector3d dir = new Vector3d()// normalized direction of ray
  Point3d oc  = new Point3d()// vector from sphere center to ray origin

  oc.x = center.x - origin.x;
  oc.y = center.y - origin.y;
  oc.z = center.z - origin.z;
View Full Code Here

    intersectPoint.z = origin.z;
    return true;
  }

  double l2oc,rad2,tca,t2hc,mag,t;
  Point3d dir = new Point3d()// normalized direction of ray
  Point3d oc  = new Point3d()// vector from sphere center to ray origin

  oc.x = center.x - origin.x;   // XXXX: check if this method is still needed
  oc.y = center.y - origin.y;
  oc.z = center.z - origin.z;
View Full Code Here

    return false;
  }

  boolean status = false;
  double newRadius;
  Point3d newCenter = new Point3d();
  BoundingBox tbox = new BoundingBox();

  for(i=0;i<boundsObjects.length;i++) {
      if( boundsObjects[i] == null || boundsObjects[i].boundsIsEmpty) ;
      else if( boundsObjects[i].boundId == BOUNDING_BOX) {
View Full Code Here

        if (source == null) {
            source = BoardModel.getHexLocation(sc, selev);
            source.z += BoardModel.HEX_HEIGHT/2;
        }

        Point3d destination = BoardModel.getHexLocation(dc, delev);
        destination.z += BoardModel.HEX_HEIGHT/2;

        Appearance base = new Appearance();
        base.setMaterial(new Material(color, C.black, color, C.white, 64.0f));
        base.setPolygonAttributes(C.noCull);
        TransparencyAttributes ta = new TransparencyAttributes(TransparencyAttributes.BLENDED, alpha);
        ta.setCapability(TransparencyAttributes.ALLOW_VALUE_WRITE);
        base.setTransparencyAttributes(ta);
        TransparencyInterpolator ti = new TransparencyInterpolator(C.halfAlpha, ta, alpha, .97f);
        ti.setSchedulingBounds(BoardModel.bounds);
        addChild(ti);

        Cylinder link = new Cylinder(1.5f, (float)source.distance(destination));
        link.setAppearance(base);

        Vector3d destination0 = new Vector3d(destination);
        destination0.negate();
        destination0.add(source);
        Vector3d diff = new Vector3d(destination0);
        destination0.y = -destination0.y;
        double angle = destination0.angle(new Vector3d(0.0, -1.0, 0.0));
        destination0.cross(destination0, new Vector3d(0.0, -1.0, 0.0));
        Quat4d rot = new Quat4d();
        rot.set(new AxisAngle4d(destination0, angle));
        diff.scale(.5);
        destination.add(diff);

        TransformGroup tg = new TransformGroup(new Transform3D(rot, new Vector3d(destination), 1.0));
        tg.addChild(link);
        addChild(tg);
        setCapability(ALLOW_DETACH);
View Full Code Here

        TransformGroup zoomTrans = mtg.getTransformGroup(4);
        zoomTrans.setTransform(new Transform3D(new Quat4d(), new Vector3d(0.0, 0.0, 20*BoardModel.HEX_DIAMETER), 1.0));

        Transform3D etrans = new Transform3D();
        etrans.lookAt(new Point3d(0, 0, 0), new Point3d(0, 0, -1), new Vector3d(0, 1, 0));
        etrans.invert();
        mtg.getTransformGroup(5).setTransform(etrans);

        MouseWheelZoom behavior0 = new MouseWheelZoom(zoomTrans);
        behavior0.setFactor(-BoardModel.HEX_DIAMETER/3);
View Full Code Here

        mtg.getTransformGroup(0).getTransform(old);
        Transform3D rot = new Transform3D();
        mtg.getTransformGroup(1).getTransform(rot);
        Vector3d transv = new Vector3d();
        trans.get(transv);
        Point3d transp = new Point3d(transv);
        rot.transform(transp);
        old.transform(transp);
        old.setTranslation(new Vector3d(transp));
        mtg.getTransformGroup(0).setTransform(old);
        mtg.getTransformGroup(2).setTransform(new Transform3D());
View Full Code Here

        } catch (Exception e) {
        }

        Transform3D v2i = new Transform3D();
        getVworldToImagePlate(v2i);
        Point3d p = BoardModel.getHexLocation(c, level);
        v2i.transform(p);
        Point2d pixel = new Point2d();
        getPixelLocationFromImagePlate(p, pixel);
        ((PopupMenu)popup).show(this, (int) pixel.x, (int) pixel.y);
    }
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.