Package org.mt4j.util.math

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


      private void setSphere(Vector3D O, Vector3D A, Vector3D B) {
          Vector3D a = A.getSubtracted(O);
          Vector3D b = B.getSubtracted(O);
          Vector3D acrossB = a.getCross(b);

          float Denominator = 2.0f * acrossB.dot(acrossB);

          if (Denominator == 0) {
              center.setXYZ(0, 0, 0);
              radius = 0;
          } else {
View Full Code Here


//          Vector3D diff = _compVect1.set(ray.getOrigin()).subtractLocal(getCenter());
         
          Vector3D diff = _compVect1.setValues(ray.getRayStartPoint()).subtractLocal(getCenter());
         
          float radiusSquared = getRadius() * getRadius();
          float a = diff.dot(diff) - radiusSquared;
          if (a <= 0.0) {
              // in sphere
              return true;
          }

View Full Code Here

    
      public Vector3D getIntersectionLocal(Ray ray){
        Vector3D rayDir = ray.getRayDirectionNormalized();
       
          Vector3D diff = _compVect1.setValues(ray.getRayStartPoint()).subtractLocal(this.getCenter());
          float a = diff.dot(diff) - (getRadius()*getRadius());
          float a1, discr, root;
         
          if (a <= 0.0) {
              // inside sphere
            a1 = rayDir.dot(diff);
View Full Code Here

    Vector3D c = p.getSubtracted(v2);
    c.normalizeLocal();

    double total_angles = Math.acos(a.dot(b));
    total_angles += Math.acos(b.dot(c));
    total_angles += Math.acos(c.dot(a));

    return (ToolsMath.abs((float) total_angles - ToolsMath.TWO_PI) <= 0.005f);
  }

View Full Code Here

    if (tdenom <= 0.0f && udenom <= 0.0f)
      return v2; // Vertex region early out

    // P is outside (or on) AB if the triple scalar product [N PA PB] <= 0
    Vector3D n = ab.getCross(ac);
    float vc = n.dot(ap.crossLocal(bp));

    // If P outside AB and within feature region of AB,
    // return projection of P onto AB
    if (vc <= 0.0f && snom >= 0.0f && sdenom >= 0.0f) {
      // return a + snom / (snom + sdenom) * ab;
 
View Full Code Here

      // return a + snom / (snom + sdenom) * ab;
      return v0.getAdded(ab.scaleLocal(snom / (snom + sdenom)));
    }

    // P is outside (or on) BC if the triple scalar product [N PB PC] <= 0
    float va = n.dot(bp.crossLocal(cp));
    // If P outside BC and within feature region of BC,
    // return projection of P onto BC
    if (va <= 0.0f && unom >= 0.0f && udenom >= 0.0f) {
      // return b + unom / (unom + udenom) * bc;
      return v1.getAdded(bc.scaleLocal(unom / (unom + udenom)));
View Full Code Here

      // return b + unom / (unom + udenom) * bc;
      return v1.getAdded(bc.scaleLocal(unom / (unom + udenom)));
    }

    // P is outside (or on) CA if the triple scalar product [N PC PA] <= 0
    float vb = n.dot(cp.crossLocal(ap));
    // If P outside CA and within feature region of CA,
    // return projection of P onto CA
    if (vb <= 0.0f && tnom >= 0.0f && tdenom >= 0.0f) {
      // return a + tnom / (tnom + tdenom) * ac;
      return v0.getAdded(ac.scaleLocal(tnom / (tnom + tdenom)));
View Full Code Here

          Vector3D v = segmentEnd.getSubtracted(segmentStart);
 
          float d = v.length();
          v.normalizeLocal();
 
          float t = v.dot(c);
 
          // Check to see if t is beyond the extents of the line segment
          if (t < 0.0f) {
                  return segmentStart;
          }
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.