Examples of Matrix33


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

      super.prologue(t);
      findCamera();
      getActualStepLength();
     
      m_orient0 = subject.getOrientationAsAxes(camera);
      m_orient1 = new Matrix33();
     
      if (exitDirection.getDirectionValue().equals(edu.cmu.cs.stage3.alice.core.Direction.LEFT)) {
        m_orient1.setForwardUpGuide(new javax.vecmath.Vector3d(-1,0,0), m_orient0.getRow(1));
      } else {
        m_orient1.setForwardUpGuide(new javax.vecmath.Vector3d(1,0,0), m_orient0.getRow(1));
View Full Code Here

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

        width = .04;
        children = new Vector();
        base_position = new javax.vecmath.Vector3d(0,0,0);
        position = new javax.vecmath.Vector3d(0,0,0);
        direction = new javax.vecmath.Vector3d(0,0,1);
        base_axis = new Matrix33();
        axis = new Matrix33();

        realMod = null;
        lastTime = Double.NEGATIVE_INFINITY;
        hasFrame = false;
        accumulated = false;
View Full Code Here

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

                    mod.turnRightNow(Direction.LEFT,.5);
            }

            base_axis = model.getOrientationAsAxes(mod.vehicle.getReferenceFrameValue());

            Matrix33 toCharacter = mod.getOrientationAsAxes();
            Matrix33 base_axis_inv = new Matrix33(base_axis);
            base_axis_inv.invert();

            model_transform = Matrix33.multiply(toCharacter,base_axis_inv);

            base_position = MathUtilities.subtract(mod.getPosition(),base_position);
        }
View Full Code Here

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

            while (tokenizer.ttype==StreamTokenizer.TT_WORD) {
                bone = (ASFBone)skel.bones_dict.get(tokenizer.sval);
                tokenizer.nextToken();

                bone.position = (Vector3)bone.base_position.clone();
                bone.axis = new Matrix33();

                ListIterator li2;
                li2 = bone.dof.listIterator();
                while (li2.hasNext()) {
                    Integer d = (Integer)li2.next();
View Full Code Here

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

  }
  public Matrix33 getAxes( ReferenceFrame asSeenBy ) {
    return getTransformation( asSeenBy ).getAxes();
  }
  public Vector3[] getOrientation( ReferenceFrame asSeenBy ) {
    Matrix33 axes = getAxes( asSeenBy );
    Vector3[] array = { axes.getRow( 2 ), axes.getRow( 1 ) };
    return array;
  }
View Full Code Here

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

  public Matrix33 getOrientationAsAxes( ReferenceFrame asSeenBy ) {
    return getTransformation( asSeenBy ).getAxes();
  }
  public Vector3[] getOrientationAsForwardAndUpGuide( ReferenceFrame asSeenBy ) {
    Matrix33 axes = getOrientationAsAxes( asSeenBy );
    Vector3[] orientation = { axes.getRow( 2 ), axes.getRow( 1 ) };
    return orientation;
  }
View Full Code Here

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

  }
  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

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

        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"
        s_calculatePointAtHelperB.rotate( MathUtilities.getYAxis(), deltaTheta, s_calculatePointAtHelperA );
 
        // extract result
        result = s_calculatePointAtHelperB.getAxes( asSeenBy );
 
        // clean up
        s_calculatePointAtHelperA.setParent( null );
        s_calculatePointAtHelperB.setParent( null );
      } else {
        javax.vecmath.Vector3d targetPosition = actualTarget.getPosition( asSeenBy );
        javax.vecmath.Vector3d zAxis = MathUtilities.normalizeV( MathUtilities.subtract( targetPosition, position ) );
        javax.vecmath.Vector3d xAxis = MathUtilities.normalizeV( MathUtilities.crossProduct( upGuide, zAxis ) );
        if( Double.isNaN( xAxis.lengthSquared() ) ) {
          throw new RuntimeException( "cannot calculate point at: zAxis=" + zAxis + " upGuide=" + upGuide );
        }
        javax.vecmath.Vector3d yAxis = MathUtilities.crossProduct( zAxis, xAxis );
        result = new Matrix33( xAxis, yAxis, zAxis );
      }
 
      if( offset==null ) {
        s_calculatePointAtHelperOffset.setParent( null );
      }
View Full Code Here

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

    javax.vecmath.Vector3d xAxis = MathUtilities.normalizeV( MathUtilities.crossProduct( upGuide, zAxis ) );
    if( Double.isNaN( xAxis.lengthSquared() ) ) {
      throw new RuntimeException( "cannot calculate orientation: forward=" + forward + " upGuide=" + upGuide );
    }
    javax.vecmath.Vector3d yAxis = MathUtilities.crossProduct( zAxis, xAxis );
    return new Matrix33( xAxis, yAxis, zAxis );
  }
View Full Code Here

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

  public void setOrientation( javax.vecmath.Vector3d forward, javax.vecmath.Vector3d upGuide, ReferenceFrame asSeenBy ) {
    setAxes( calculateOrientation( forward, upGuide ), asSeenBy );
  }

  public Matrix33 calculateStandUp( ReferenceFrame asSeenBy ) {
    Matrix33 axes = getAxes( asSeenBy );
    javax.vecmath.Vector3d yAxis = MathUtilities.getYAxis();
    javax.vecmath.Vector3d zAxis = MathUtilities.normalizeV( MathUtilities.crossProduct( axes.getRow( 0 ), yAxis ) );
    javax.vecmath.Vector3d xAxis = MathUtilities.crossProduct( yAxis, zAxis );
    return new Matrix33( xAxis, yAxis, zAxis );
  }
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.