Package org.mt4j.util.math

Examples of org.mt4j.util.math.Ray


    // Point to local space - already done!
//    testPoint.transform(this.getGlobalInverseMatrix());
   
    //Send ray from the test point in x, y, and z direction
    //and count the intersections (this is not really sufficient!)
    Ray ray0 = new Ray(new Vector3D(testPoint), new Vector3D(1,0,0));
    Ray ray1 = new Ray(new Vector3D(testPoint), new Vector3D(0,1,0));
    Ray ray2 = new Ray(new Vector3D(testPoint), new Vector3D(0,0,1));
   
    int i0 = this.getNumIntersections(ray0);
    int i1 = this.getNumIntersections(ray1);
    int i2 = this.getNumIntersections(ray2);
   
View Full Code Here


      if (this.getAttachedCamera() != null){
        ray  = getChangedCameraPickRay(this.getRenderer(), this, ray);
      }
     
      //Transforms the ray into local object space
      Ray invertedRay = this.globalToLocal(ray);
     
      //Check if component is clipped and only proceed if the ray intersects the clip shape
      Clip clip = this.getClip();
      if (clip == null || (clip != null && clip.getClipShapeIntersectionLocal(invertedRay) != null)){
        interSP = this.getIntersectionLocal(invertedRay);
View Full Code Here

      //-> changes rayStartPoint and point in ray direction
      if (this.getAttachedCamera() != null){
        currentRay  = getChangedCameraPickRay(this.getRenderer(), this, pickInfo);
      }
     
      Ray invertedRay;
      if (this.getGlobalInverseMatrix().isIdentity()){
        invertedRay = currentRay;
      }else{
        invertedRay = this.globalToLocal(currentRay);
      }
View Full Code Here

//        pa.popMatrix();

        this.newPosition = Tools3D.unprojectScreenCoords(pa, camera, cursor.getCurrentEvent().getPosX(), cursor.getCurrentEvent().getPosY());

        Vector3D rayStartPoint = camera.getPosition(); //default cam
        Vector3D newPos = ToolsGeometry.getRayPlaneIntersection(new Ray(rayStartPoint, newPosition), planeNormal, pointInPlane);
        newPosition = newPos;

        if (newPosition != null && !lastPosition.equalsVector(newPosition)){
          Vertex[] newArr = new Vertex[this.getPolygon().getVertexCount()+1];
View Full Code Here

//        Vector3D rayStartPoint = cam.getPosition();
//        Vector3D pointInRayDir = Tools3D.unprojectScreenCoords(applet, m.getLastEvent().getPositionX(), m.getLastEvent().getPositionY());
//       
//        Ray orgRay = new Ray(rayStartPoint, pointInRayDir);
       
        Ray realRayForThisObj = Tools3D.getCameraPickRay(applet, shape, m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY());
         
//        Ray realRayForThisObj = Tools3D.toComponentCameraPickRay(applet, shape, orgRay);
     
      //TRIAL
      Ray invertedRay = Ray.getTransformedRay(realRayForThisObj, shape.getGlobalInverseMatrix());
       
      Vector3D is = bSphere.getIntersectionLocal(invertedRay);
     
      //Test to detect whether were inside the sphere
//      Vector3D camPos = cam.getPosition();
View Full Code Here

//          Vector3D rayStartPoint = cam.getPosition();
//          Vector3D pointInRayDir = Tools3D.unprojectScreenCoords(applet, m.getLastEvent().getPositionX(), m.getLastEvent().getPositionY());
//          Ray orgRay = new Ray(rayStartPoint, pointInRayDir);
//          Ray realRayForThisObj = Tools3D.toComponentCameraPickRay(applet, shape, orgRay);
       
          Ray realRayForThisObj = Tools3D.getCameraPickRay(applet, shape, m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY());
         
        //TRIAL
        Ray invertedRay = Ray.getTransformedRay(realRayForThisObj, shape.getGlobalInverseMatrix());
         
          Vector3D NewPt = bSphere.getIntersectionLocal(invertedRay);
         
         
          if (NewPt != null){
View Full Code Here

//          Vector3D rayStartPoint = cam.getPosition();
//          Vector3D pointInRayDir = Tools3D.unprojectScreenCoords(applet, m.getLastEvent().getPositionX(), m.getLastEvent().getPositionY());
//          Ray orgRay = new Ray(rayStartPoint, pointInRayDir);
//          Ray realRayForThisObj = Tools3D.toComponentCameraPickRay(applet, shape, orgRay);
       
          Ray realRayForThisObj = Tools3D.getCameraPickRay(applet, shape, m.getCurrentEvent().getPosX(), m.getCurrentEvent().getPosY());
         
        //TRIAL
        Ray invertedRay = Ray.getTransformedRay(realRayForThisObj, shape.getGlobalInverseMatrix());
         
          Vector3D NewPt = bSphere.getIntersectionLocal(invertedRay);
         
          if (NewPt != null){
            PGraphicsOpenGL pgl = ((PGraphicsOpenGL)applet.g);
View Full Code Here

TOP

Related Classes of org.mt4j.util.math.Ray

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.