Package javax.vecmath

Examples of javax.vecmath.Vector3f.normalize()


      Vector3f vTemp2 = new Vector3f();
      if (v[1].angle(v[2]) < almost180)
        vTemp2.cross(v[1], v[2]);
      else
        vTemp2.cross(x, v[2]);
      vTemp2.normalize();
      isPlanar = (Math.abs(vTemp2.dot(vTemp)) >= 0.95f);
    }

    boolean isSp3 = (lcaoType.indexOf("sp3") == 0);
    boolean isSp2 = (!isSp3 && lcaoType.indexOf("sp2") == 0);
View Full Code Here


          n[10] = vb.y;
          n[11] = vb.z;
        }
        if (c < 0) {
          vc.cross(va, vb);
          vc.normalize();
          n[12] = vc.x;
          n[13] = vc.y;
          n[14] = vc.z;
        }
        parameters = n;
View Full Code Here

      if (i == centerAtomIndex)
        continue;
      if (v1 == null) {
        v1 = new Vector3f();
        v1.sub(atoms[i], center);
        v1.normalize();
        vTemp.set(v1);
        continue;
      }
      vTemp.sub(atoms[i], center);
      vTemp.normalize();
View Full Code Here

        pt.scale(0.5f);
        v1.sub(a1, center);
        v2.sub(a2, center);
        if (!isParallel(v1, v2)) {
          v3.cross(v1, v2);
          v3.normalize();
          nPlanes = getPlane(v3);
        }

        // second, look for planes perpendicular to the A -- B line
View Full Code Here

        // second, look for planes perpendicular to the A -- B line

        v3.set(a2);
        v3.sub(a1);
        v3.normalize();
        nPlanes = getPlane(v3);
        if (nPlanes == axesMaxN[0])
          return nPlanes;
      }
    }
View Full Code Here

      pt1f.set(imesh.vertices[0]);
      viewer.transformPoint(pt1f, pt1f);
      v1.sub(pt2f, pt1f);
      v2.set(v1.x, v1.y, v1.z + 1);
      v2.cross(v2,v1);
      v2.normalize();
      float f = viewer.scaleToScreen((int)pt1f.z, 100);
      v2.scale(f);
      pt1f.set(pt2f);
      pt1f.add(v2);
      pt2f.sub(v2);
View Full Code Here

      return iv.shortValue();
    Vector3f newVertexVector = new Vector3f(vertexVectors[v1]);
    vertexVectors[vertexNext] = newVertexVector;
    newVertexVector.add(vertexVectors[v2]);
    newVertexVector.scale(0.5f);
    newVertexVector.normalize();
    htVertex.put(hashKey, new Short(vertexNext));
    return vertexNext++;
  }
}
View Full Code Here

        Vector3f explosionCenter = new Vector3f(0,-10,0);
        explosionCenter.negate();
        Vector3f direction = new Vector3f ();
        VectorUtil.add(direction, position, explosionCenter);
        float distanceFromExplosion = direction.length();
        direction.normalize();
        direction.scale(1/distanceFromExplosion * 1000f);
        agent.getRigidBody().applyCentralImpulse(direction);
      }
    }
  }
 
View Full Code Here

  @Override
  public LinkedList<Vector3f> sense(EvolvableBoxAgent3DEnvironment env,
      EvolvableBoxAgent3D agent) {
    Vector3f currentPosition = new Vector3f();
    currentPosition = agent.getAveragedPosition();
    currentPosition.normalize();
    Vector3f currentLinearVelocity = new Vector3f();
    agent.getRigidBody().getLinearVelocity(currentLinearVelocity);
    currentLinearVelocity.y = 0;
    currentLinearVelocity.normalize();
    LinkedList<Vector3f> list = new LinkedList<Vector3f>();
View Full Code Here

    currentPosition = agent.getAveragedPosition();
    currentPosition.normalize();
    Vector3f currentLinearVelocity = new Vector3f();
    agent.getRigidBody().getLinearVelocity(currentLinearVelocity);
    currentLinearVelocity.y = 0;
    currentLinearVelocity.normalize();
    LinkedList<Vector3f> list = new LinkedList<Vector3f>();
    list.add(currentPosition);
    list.add(currentLinearVelocity);
    return list;
  }
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.