Examples of Vect3


Examples of jray.common.Vect3

   * @param coneAxisLength
   * @param coneCosPhi
   * @return
   */
  public static boolean isCubeEnclosingCone(Vect3 cubeCenter, double cubeWidthHalf, Vect3 conePosition, Vect3 coneAxis, double coneAxisLength, double coneCosPhi){
    Vect3 planeNormal = new Vect3(),
          planePoint = new Vect3(cubeCenter);
   
    if(!PointCube.encloses(cubeCenter, cubeWidthHalf, conePosition))
      return false;
   
    for(int a=0;a<3;a++){
View Full Code Here

Examples of jray.common.Vect3

   * @param coneAxisLength
   * @param coneCosPhi
   * @return
   */
  public static boolean isCubeIntersectingCone(Vect3 cubeCenter, double cubeWidthHalf, Vect3 conePosition, Vect3 coneAxis, double coneAxisLength, double coneCosPhi){
    Vect3 planeNormal = new Vect3(),
          planePoint = new Vect3(cubeCenter);
   
    if(PointCube.encloses(cubeCenter, cubeWidthHalf, conePosition))
      return true;
   
    for(int a=0;a<3;a++){
View Full Code Here

Examples of jray.common.Vect3

public class RayCone {

  public static double getRayConeIntersectionDistance(Vect3 ro, Vect3 rd, Vect3 v, Vect3 a, double cos, double axisLength) {
    double add = Vect.dotProduct(a, rd);
    cos *= cos;
    Vect3 e = new Vect3(ro.data[0] - v.data[0],ro.data[1] - v.data[1],ro.data[2] - v.data[2]);
    double ade = Vect.dotProduct(a, e);
    double dde = Vect.dotProduct(rd, e);
    double ede = Vect.dotProduct(e, e);
   
      double c2 = add*add - cos;
View Full Code Here

Examples of jray.common.Vect3

     * @return the (smaller) scalar to apply to the ray to get a hit point with
     * the sphere or Double.POSITIVE_INFINITY if no hit point is present
     */
    public static double getHitPointRaySphereDistance(Vect3 rayOrigin, Vect3 rayDirection, Vect3 sphereCenter, double sphereRadius) {

        Vect3 tmp = new Vect3();

        /* calculate b, c for the quadratic formula described in
         * http://en.wikipedia.org/wiki/Line–sphere_intersection
         * a is always 1 as the ray-direction is normalized
         *
 
View Full Code Here

Examples of jray.common.Vect3

        }
        return ret;
    }
   
    public static boolean isRayOriginatingInSphere(Vect3 rayOrigin, Vect3 rayDirection, Vect3 sphereCenter, double sphereRadius){
      Vect3 tmp = new Vect3();
      Vect.subtract(sphereCenter, rayOrigin, tmp);
     
      return tmp.quadLength()<sphereRadius*sphereRadius;
    }
View Full Code Here

Examples of jray.common.Vect3

import jray.math.Vect;

public class PlaneCone {
 
  public static boolean isPlaneIntersectingCone(Vect3 planeNormal, Vect3 planePoint, Vect3 conePosition, Vect3 coneAxis, double coneAxisLength, double coneCosPhi){
    Vect3 qx = new Vect3();
    Vect3 p = new Vect3();
    Vect3 q = new Vect3();
    double len=0;
   
    //try "bending" axis towards plane normal
    Vect.addMultiple(conePosition, coneAxis, coneAxisLength, q);
    Vect.project(planeNormal, coneAxis, qx);
    Vect.addMultiple(qx, planeNormal, -1, p);
   
    if(p.quadLength()==0){// axis equals plane normal
      coneAxis.copyDataTo(p);
      len = coneAxisLength;
    }else{//bend axis towards plane normal as far as sinPhi allows
      p.normalize();
      Vect.addMultiple(q, p, coneAxisLength*Math.sin(Math.acos(coneCosPhi)), q);
      Vect.subtract(q, conePosition, q);
      len = q.length();
      Vect.scale(q, 1/len, p);
    }

    double d = RayPlane.getHitPointRayPlaneDistance(conePosition, p, planePoint, planeNormal);
   
View Full Code Here

Examples of jray.common.Vect3

import jray.math.Vect;

public class AreaCone {
 
  public static boolean isAreaIntersectingCone(Vect3 planeNormal, Vect3 planePoint, double planeWidth2, Vect3 conePosition, Vect3 coneAxis, double coneAxisLength, double coneCosPhi){
    Vect3 qx = new Vect3();
    Vect3 p = new Vect3();
    Vect3 q = new Vect3();
    double len=0;
   
    //try "bending" axis towards plane normal
    Vect.addMultiple(conePosition, coneAxis, coneAxisLength, q);
    Vect.project(planeNormal, coneAxis, qx);
    Vect.addMultiple(qx, planeNormal, -1, p);
   
    if(p.quadLength()==0){// axis equals plane normal
      coneAxis.copyDataTo(p);
      len = coneAxisLength;
    }else{//bend axis towards plane normal as far as sinPhi allows
      p.normalize();
      Vect.addMultiple(q, p, coneAxisLength*Math.sin(Math.acos(coneCosPhi)), q);
      Vect.subtract(q, conePosition, q);
      len = q.length();
      Vect.scale(q, 1/len, p);
    }

    double d = RayPlane.getHitPointRayPlaneDistance(conePosition, p, planePoint, planeNormal);
   
View Full Code Here

Examples of jray.common.Vect3

public class RayTriangle {

  public static final double TRI_EPS = 0;
 
    public static double getHitPointRayTriangleDistance(Vect3 rayPosition, Vect3 rayDirection, Vect3 trianglePos, Vect3 triangleVect1, Vect3 triangleVect2) {
        Vect3 tmp = new Vect3();
        Vect.crossProduct(triangleVect1, triangleVect2, tmp);
        double ret = RayPlane.getHitPointRayPlaneDistance(rayPosition, rayDirection, trianglePos, tmp);
        if(ret == Double.POSITIVE_INFINITY || ret < Constants.MIN_DISTANCE) {
            return Double.POSITIVE_INFINITY;
        }
View Full Code Here

Examples of jray.common.Vect3

   
    child = new Node[8];
    double w2 = width/2;
    double w4 = width/4;
   
    child[0] = new Node(new Vect3(center.data[0] + w4, center.data[1] + w4, center.data[2] + w4),this,w2);
    child[1] = new Node(new Vect3(center.data[0] + w4, center.data[1] + w4, center.data[2] - w4),this,w2);
    child[2] = new Node(new Vect3(center.data[0] + w4, center.data[1] - w4, center.data[2] + w4),this,w2);
    child[3] = new Node(new Vect3(center.data[0] + w4, center.data[1] - w4, center.data[2] - w4),this,w2);
    child[4] = new Node(new Vect3(center.data[0] - w4, center.data[1] + w4, center.data[2] + w4),this,w2);
    child[5] = new Node(new Vect3(center.data[0] - w4, center.data[1] + w4, center.data[2] - w4),this,w2);
    child[6] = new Node(new Vect3(center.data[0] - w4, center.data[1] - w4, center.data[2] + w4),this,w2);
    child[7] = new Node(new Vect3(center.data[0] - w4, center.data[1] - w4, center.data[2] - w4),this,w2);
   
    List<Object3D> oldContent = content;
    content = new ArrayList<Object3D>();
   
    for(Object3D o : oldContent){
View Full Code Here

Examples of jray.common.Vect3

   
    double d=0,
           distanceTravelled=0; //distance traveled since the ray's origin
   
    //Algorithm starts at the ray's origin and in the root node.
    Vect3 pos = new Vect3(r.getOrigin());
    Node n = tree.getRoot();
    c.checkCollisionSet(n.content);
   
    if(!n.encloses(pos))
      throw new RuntimeException("Ray's origin is not located in the octree!");
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.