Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D.transform()


    //svgbutton inverse parent relative machen
    svgButtonAbsInv.multLocal(this.getCompToResize().getLocalMatrix());
    //Remove translation for direction vectors(width/height)
    svgButtonAbsInv.removeTranslationFromMatrix();
    //Width vect in svgbutton parent relative space
    v.transform(svgButtonAbsInv);
    float width = v.length();
    return width;
  }
 
 
View Full Code Here


  public void resize(float newWidth, float newHeight){
    Matrix refCompLocalToWorld = new Matrix(this.getReferenceComp().getGlobalMatrix());
   
    //Center into world space
    Vector3D refCompCenter = this.centerObjSpace.getCopy();
    refCompCenter.transform(refCompLocalToWorld);
   
    //Remove translation for direction vectors(width/height)
    refCompLocalToWorld.removeTranslationFromMatrix();
   
    //Width vect into world space
View Full Code Here

      if (clip == null || (clip != null && clip.getClipShapeIntersectionLocal(invertedRay) != null)){
        interSP = this.getIntersectionLocal(invertedRay);
        if (interSP != null){
          //FIXME TRIAL - muss f�r die distance messung der world ray genommen
          //werden oder geht der invertierte ray?
          interSP.transform(this.getGlobalMatrix());
          //Get distance from raystart to the intersecting point
          objDistance = interSP.getSubtracted(ray.getRayStartPoint()).length();

          //If the distance is the smalles yet = closest to the raystart replace the returnObject and current distanceFrom
          if ((objDistance - PickResult.HIT_TOLERANCE) < currentDistance ){
View Full Code Here

    //Remove translation for direction vectors(width/height)
    refCompLocalToWorld.removeTranslationFromMatrix();
   
    //Width vect into world space
    Vector3D objSpaceWidth = this.widthObjSpace.getCopy();
    objSpaceWidth.transform(refCompLocalToWorld);
//    System.out.println(" world Width vect of reference component: " + objSpaceWidth);
   
    /////Transform width/height/center to svgbutton relative
    Matrix svgButtonAbsInv = new Matrix(this.getCompToResize().getGlobalInverseMatrix());
   
View Full Code Here

   
    //Remove translation for direction vectors(width/height)
    svgButtonAbsInv.removeTranslationFromMatrix();
   
    //Width vect in svgbutton parent relative
    objSpaceWidth.transform(svgButtonAbsInv);
//    System.out.println(" svgbutton space Width vect of reference component: " + objSpaceWidth);
   
    float width = objSpaceWidth.length();
//    System.out.println("WIDTH: " + width);
//    System.out.println("new width to set: " + newWidth);
View Full Code Here

      if (clip == null || (clip != null && clip.getClipShapeIntersectionLocal(invertedRay) != null)){
        interSP = this.getIntersectionLocal(invertedRay);
        if (interSP != null){
          //FIXME TRIAL - muss f�r die distance messung der world ray genommen
          //werden oder geht der invertierte ray? -> musss wohl der world ray sein
          interSP.transform(this.getGlobalMatrix());
          // Get distance from raystart to the intersecting point
          objDistance = interSP.getSubtracted(currentRay.getRayStartPoint()).length();
          //System.out.println("Pick found: " + this.getName() + " InterSP: " + interSP +  " ObjDist: " + objDistance +  " Mouse Pos: " + pickInfo.getScreenXCoordinate() + "," + pickInfo.getScreenYCoordinate() + " InvRay RS:" + invertedRay.getRayStartPoint() + ",RE: " + invertedRay.getPointInRayDirection());

//          //If the distance is the smallest yet = closest to the raystart: replace the returnObject and current distanceFrom
View Full Code Here

     
      Vector3D newInterSection = getSphereIntersectionObjSpace();
       
        if (newInterSection != null){
          if (doInWorldCoords)
          newInterSection.transform(shape.getGlobalMatrix());
         
          logger.debug("Sphere hit, hitpoint: " + newInterSection);
         
          Vector3D center = bSphere.getCenterPointLocal();
         
View Full Code Here

          logger.debug("Sphere hit, hitpoint: " + newInterSection);
         
          Vector3D center = bSphere.getCenterPointLocal();
         
          if (doInWorldCoords) //TODO center world cachen?
          center.transform(shape.getGlobalMatrix());
         
          Vector3D a = lastPoint.getSubtracted(center);
          Vector3D b = newInterSection.getSubtracted(center);
         
          //float dot = a.dot(b);
View Full Code Here

      Vector3D is = bSphere.getIntersectionLocal(invertedRay);
     
      //Test to detect whether were inside the sphere
//      Vector3D camPos = cam.getPosition();
      Vector3D camPos = shape.getViewingCamera().getPosition();
      camPos.transform(shape.getGlobalInverseMatrix());
     
      if (is != null){
        camDistToInterSection = Vector3D.distance(camPos, is);
        //bSphere.distanceToEdge(camPos);
      }
View Full Code Here

  public void setPositionRelativeToOther(MTComponent otherComp, Vector3D pos){
    Matrix m0 = MTComponent.getTransformToDestinationLocalSpace(otherComp, this);
    pos.transform(m0);
   
    Vector3D centerpointGlobal = this.getCenterPointGlobal();
    centerpointGlobal.transform(this.getGlobalInverseMatrix()); //to localobj space
    centerpointGlobal.transform(this.getLocalMatrix()); //to parent relative space
   
    Vector3D diff = pos.getSubtracted(centerpointGlobal);
   
    this.translate(diff, TransformSpace.RELATIVE_TO_PARENT);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.