Package jinngine.math

Examples of jinngine.math.Vector3.dot()


        assertEquals(2., a.y);
        assertEquals(3., a.z);
        assertEquals(10., b.x);
        assertEquals(20., b.y);
        assertEquals(30., b.z);
        assertEquals(10. + 40. + 90., b.dot(a));
        assertEquals(1., a.x);
        assertEquals(2., a.y);
        assertEquals(3., a.z);
        assertEquals(10., b.x);
        assertEquals(20., b.y);
View Full Code Here


      if ( v.dot(direction) >= 0) {
        return Double.POSITIVE_INFINITY;
      } else {
        // move forward as much as possible, half way into the envelope
        Vector3 vs = v.sub(v.normalize().multiply(envelope*0.5+sphere));
        lambda = lambda - vs.dot(w) / v.dot(direction);
        x.assign(point.add(direction.multiply(lambda)));
      }     
    }
//    System.out.println("RayCast: Hitpoint lambda=" + lambda);
    return lambda;
View Full Code Here

   
    // do hill climbing if the hull has a considerable number of vertices
//    if (numberOfVertices > 32) {
      //hill climb along v
      int index = cachedVertex;
      double value = v.dot(vertices.get(index));
      boolean better = true;
      while (better) {
        better = false;
        //go through adjacency list and pick first improver (greedy)
        for ( int i: adjacent.get(index)) {
View Full Code Here

      boolean better = true;
      while (better) {
        better = false;
        //go through adjacency list and pick first improver (greedy)
        for ( int i: adjacent.get(index)) {
          double newvalue = v.dot(vertices.get(i));
          if ( newvalue > value) {
            value = newvalue;
            index = i;
            better = true;
            break;
View Full Code Here

    // maps a vertex onto a face in the original convex hull. Therefore, this method will
    // return a face at all times
    Vector3 v = body.state.rotation.multiply(localrotation).scale(localscale).transpose().multiply(direction);
    // hill climb the dual hull to find face
    int index = 0;
    double value = v.dot(dualvertices.get(index));
    boolean better = true;
    while (better) {
      better = false;
      //go through adjacency list and pick first improver (greedy)
      for ( int i: dualadjacent.get(index)) {
View Full Code Here

    boolean better = true;
    while (better) {
      better = false;
      //go through adjacency list and pick first improver (greedy)
      for ( int i: dualadjacent.get(index)) {
        double newvalue = v.dot(dualvertices.get(i));
        if ( newvalue > value) {
          value = newvalue;
          index = i;
          better = true;
          break;
View Full Code Here

        new Vector3(), bi.isFixed()? new Vector3() : bi.state.inverseinertia.multiply(q), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(q.multiply(-1)),
        new Vector3(), q, new Vector3(), q.multiply(-1),
        Double.NEGATIVE_INFINITY,
        Double.POSITIVE_INFINITY,
        null,
        q.dot(bi.state.omega)-q.dot(bj.state.omega) - Kcor*(-n1iw.dot(n2jw))*(1/dt), );   


    // add constraints to return list
    iterator.add(linear1);
    iterator.add(linear2);
View Full Code Here

        new Vector3(), bi.isFixed()? new Vector3() : bi.state.inverseinertia.multiply(q), new Vector3(), bj.isFixed()? new Vector3() : bj.state.inverseinertia.multiply(q.multiply(-1)),
        new Vector3(), q, new Vector3(), q.multiply(-1),
        Double.NEGATIVE_INFINITY,
        Double.POSITIVE_INFINITY,
        null,
        q.dot(bi.state.omega)-q.dot(bj.state.omega) - Kcor*(-n1iw.dot(n2jw))*(1/dt), );   


    // add constraints to return list
    iterator.add(linear1);
    iterator.add(linear2);
View Full Code Here

    // make sure product is excatly in [-1,1]
    product = Math.max( Math.min( product, 1), -1);   
    joint.theta = -Math.acos( product )*sign;
   
    // angular velocity along axis
    joint.velocity = axis.dot(bi.state.omega)-axis.dot(bj.state.omega);
    double bvalue = 0;
   
    // if limits are clamped together
    if ( Math.abs( joint.lowerLimit - joint.upperLimit) < joint.shell && joint.enableLimits) {
      correction = (joint.theta - (joint.upperLimit) )*(1/dt)*Kcor;
 
View Full Code Here

    // make sure product is excatly in [-1,1]
    product = Math.max( Math.min( product, 1), -1);   
    joint.theta = -Math.acos( product )*sign;
   
    // angular velocity along axis
    joint.velocity = axis.dot(bi.state.omega)-axis.dot(bj.state.omega);
    double bvalue = 0;
   
    // if limits are clamped together
    if ( Math.abs( joint.lowerLimit - joint.upperLimit) < joint.shell && joint.enableLimits) {
      correction = (joint.theta - (joint.upperLimit) )*(1/dt)*Kcor;
 
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.