Package edu.cmu.cs.stage3.math

Examples of edu.cmu.cs.stage3.math.Matrix44


    public void addFrames(Matrix44 accum) {
        addFrames(true,accum);
    }

    public void addFrames(boolean hasAccum, Matrix44 accum) {
        Matrix44 newAccum = Matrix44.IDENTITY;
        if (hasAccum)
            accumulated = true;
        if (hasFrame || hasAccum) {
            newAccum = Matrix44.multiply(new Matrix44(axis,position),accum);
            if (realMod!=null) {
                if (dof.contains(DOF_TX) || dof.contains(DOF_TY) || dof.contains(DOF_TZ))
                    //positionSpline.addKey(new Vector3SimpleKey(lastTime,newAccum.getPosition()));
                    positionSpline.addKey(new Vector3SimpleKey(lastTime,Matrix44.multiply(new Matrix44(model_transform,new javax.vecmath.Vector3d()),Matrix44.multiply(newAccum,new Matrix44(base_axis,new javax.vecmath.Vector3d()))).getPosition()));

                if (dof.contains(DOF_RX) || dof.contains(DOF_RY) || dof.contains(DOF_RZ) || hasAccum)
                    quaternionSpline.addKey(new QuaternionKey(lastTime,Matrix33.multiply(model_transform,Matrix33.multiply(newAccum.getAxes(),base_axis)).getQuaternion()));
            }
        }

        ASFBone child;
        ListIterator li;
        li = children.listIterator();

        while(li.hasNext()) {
            child = (ASFBone)li.next();

            if (realMod==null && (hasFrame || hasAccum)) {
                Matrix44 newInvBase = child.model.getPointOfView(model);
                newInvBase.invert();
                child.addFrames(Matrix44.multiply(Matrix44.multiply(child.model.getPointOfView(model),newAccum),newInvBase));
            } else {
                child.addFrames();
            }
View Full Code Here


            orientation = realMod.getOrientationAsQuaternion();
            if (dof.contains(ASFBone.DOF_RX) || dof.contains(ASFBone.DOF_RY) || dof.contains(ASFBone.DOF_RZ) || accumulated) {
                quaternionKey = quaternionSpline.getFirstKey();
                orientation = (Quaternion)quaternionKey.createSample(quaternionKey.getValueComponents());
            }
            ((java.util.Hashtable)startPose.poseMap.getDictionaryValue()).put(realMod.getKey(rootMod),new Matrix44(orientation,position));


            if (dof.contains(ASFBone.DOF_TX) || dof.contains(ASFBone.DOF_TY) || dof.contains(ASFBone.DOF_TZ)) {
                positionKey = positionSpline.getLastKey();
        position = (Vector3)positionKey.createSample( positionKey.getValueComponents() );
      }
            if (dof.contains(ASFBone.DOF_RX) || dof.contains(ASFBone.DOF_RY) || dof.contains(ASFBone.DOF_RZ) || accumulated) {
                quaternionKey = quaternionSpline.getLastKey();
                orientation = (Quaternion)quaternionKey.createSample(quaternionKey.getValueComponents());
            }
            ((java.util.Hashtable)endPose.poseMap.getDictionaryValue()).put(realMod.getKey(rootMod),new Matrix44(orientation,position));
        }

        ASFBone child;
        ListIterator li;
        li = children.listIterator();
View Full Code Here

  public Matrix44 getTransformation( javax.vecmath.Vector3d offset, ReferenceFrame asSeenBy ) {
    synchronized( s_getTransformationHelperOffset ) {
      ReferenceFrame actual;
      if( offset != null ) {
        s_getTransformationHelperOffset.setParent( this );
        Matrix44 m = new Matrix44();
        m.m30 = offset.x;
        m.m31 = offset.y;
        m.m32 = offset.z;
        s_getTransformationHelperOffset.setLocalTransformation( m );
        actual = s_getTransformationHelperOffset;
      } else {
        actual = this;
      }
      Matrix44 m;
      if( asSeenBy != null ) {
        m = Matrix44.multiply( actual.getAbsoluteTransformation(), asSeenBy.getInverseAbsoluteTransformation() );
      } else {
        m = new Matrix44( actual.getAbsoluteTransformation() );
      }
      if( offset != null ) {
        s_getTransformationHelperOffset.setParent( null );
      }
      return m;
View Full Code Here

      super.propertyChanged( property, value );
    }
  }
  /** @deprecated */
  public Matrix44 getAbsoluteTransformation() {
    return new Matrix44( getSceneGraphReferenceFrame().getAbsoluteTransformation() );
  }
View Full Code Here

  public Matrix44 getAbsoluteTransformation() {
    return new Matrix44( getSceneGraphReferenceFrame().getAbsoluteTransformation() );
  }
  public Matrix44 getTransformation( javax.vecmath.Vector3d offset, ReferenceFrame asSeenBy ) {
    if( asSeenBy==this && offset==null ) {
      return new Matrix44();
    } else {
      edu.cmu.cs.stage3.alice.scenegraph.ReferenceFrame sgAsSeenBy;
      if( asSeenBy != null ) {
        sgAsSeenBy = asSeenBy.getSceneGraphReferenceFrame();
      } else {
View Full Code Here

    ReferenceFrame vehicle = (ReferenceFrame)getParent();
    if( asSeenBy==null ) {
      asSeenBy = vehicle;
    }
    if( asSeenBy==vehicle ) {
      return new Matrix44( getLocalTransformation() );
    }
    if( asSeenBy instanceof Scene ) {
      return new Matrix44( getAbsoluteTransformation() );
    }
    return super.getTransformation( asSeenBy );
  }
View Full Code Here

    ReferenceFrame vehicle = (ReferenceFrame)getParent();
    if( asSeenBy==null ) {
      asSeenBy = vehicle;
    }
    if( asSeenBy==vehicle ) {
      return new Matrix44( m );
    } else {
      javax.vecmath.Matrix4d vehicleInverse;
      if( vehicle != null ) {
        vehicleInverse = vehicle.getInverseAbsoluteTransformation();
      } else {
View Full Code Here

  public void setTransformation( javax.vecmath.Matrix4d m, ReferenceFrame asSeenBy ) {
    setLocalTransformation( calculateTransformation( m, asSeenBy ) );
  }
  public void setPosition( javax.vecmath.Vector3d position, ReferenceFrame asSeenBy ) {
    Matrix33 axes = getAxes( null );
    Matrix44 m = new Matrix44();
    m.setPosition( position );
    m = calculateTransformation( m, asSeenBy );
    m.setAxes( axes );
    setLocalTransformation( m );
  }
View Full Code Here

    m.setAxes( axes );
    setLocalTransformation( m );
  }
  public void setAxes( javax.vecmath.Matrix3d axes, ReferenceFrame asSeenBy ) {
    Vector3 translation = getPosition( null );
    Matrix44 m = new Matrix44();
    m.setAxes( axes );
    m = calculateTransformation( m, asSeenBy );
    m.setPosition( translation );
    setLocalTransformation( m );
  }
View Full Code Here

        upGuide = MathUtilities.getYAxis();
      }
      if( asSeenBy==null ) {
        asSeenBy = (ReferenceFrame)getParent();
      }
      Matrix44 transform = getTransformation( asSeenBy );
      Vector3 position = transform.getPosition();
      //Vector3 position = new Vector3( transform.m30, transform.m31, transform.m32 );
 
      ReferenceFrame actualTarget;
      if( offset==null ) {
        actualTarget = target;
      } else {
        s_calculatePointAtHelperOffset.setParent( target );
        Matrix44 m = new Matrix44();
        m.m30 = offset.x;
        m.m31 = offset.y;
        m.m32 = offset.z;
        s_calculatePointAtHelperOffset.setLocalTransformation( m );
        actualTarget = s_calculatePointAtHelperOffset;
      }
 
      Matrix33 result;
      if( onlyAffectYaw ) {
        // setup "helperA" with the orientation of "asSeenBy" and the position of "this"
        s_calculatePointAtHelperA.setParent( asSeenBy );
        s_calculatePointAtHelperA.setLocalTransformation( new Matrix44() );
        s_calculatePointAtHelperA.setPosition( Vector3.ZERO, this );
 
        // calculate the angle of rotation around y of "actualTarget" as seen by "helperA"
        Vector3 targetPosition = actualTarget.getPosition( s_calculatePointAtHelperA );
        double targetTheta = Math.atan2( targetPosition.x, targetPosition.z );
 
        // place "helperB" out in front of "this"
        s_calculatePointAtHelperB.setParent( this );
        s_calculatePointAtHelperB.setPosition( MathUtilities.getZAxis(), this );
 
        // calculate the angle of rotation around Y of "helperB" as seen by "helperA"
        Vector3 forwardPosition = s_calculatePointAtHelperB.getPosition( s_calculatePointAtHelperA );
        double forwardTheta = Math.atan2( forwardPosition.x, forwardPosition.z );
 
        // setup "helperB" to have position and orientation of "this"
        s_calculatePointAtHelperB.setLocalTransformation( new Matrix44() );
 
        // calculate how much to rotate
        double deltaTheta = targetTheta - forwardTheta;
 
        // rotate "helperB" around Y as seen by "helperA"
View Full Code Here

TOP

Related Classes of edu.cmu.cs.stage3.math.Matrix44

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.