Examples of Vec3D


Examples of astroLib.APC_Vect3D.Vec3D

Horizontal Equ2Hor ( double Dec, double tau, double lat)
{
  //
  // Variables
  //
  Vec3D e_equ;
  Polar  e_hor;
  Horizontal result;
  Polar polar=new Polar(tau,Dec);

  e_equ = new Vec3D(polar);          // unit vector in horizontal system
  // e_equ = {m_Vec = {0.58881464761003832, -0.38575765187682981, 0.71027342958774764}, m_phi = -0.57998202437182178, m_theta = 0.78988656845716043, m_r = 1, m_bPolarValid = true}
  // R_y(pi/2.0-lat)={m_Mat = {{0.74431154623115414, 0, -0.66783255547104659}, {0, 1, 0}, {0.66783255547104659, 0, 0.74431154623115414}}}     
  e_hor=APC_Vect3D.calcPolarAngles (APC_Vect3D.AbProduct(APC_Vect3D.R_y(Math.PI/2.0-lat), e_equ)); // unit vector in equatorial system
  //  e_hor = {m_Vec = {-0.036082178758590183, -0.38575765187682981, 0.92189430543555695}, m_phi = 0, m_theta = 0, m_r = 0, m_bPolarValid = false}
View Full Code Here

Examples of com.mojang.minecraft.model.Vec3D

  }

  public final MovingObjectPosition clip(int var1, int var2, int var3, Vec3D var4, Vec3D var5) {
    var4 = var4.add((float)(-var1), (float)(-var2), (float)(-var3));
    var5 = var5.add((float)(-var1), (float)(-var2), (float)(-var3));
    Vec3D var6 = var4.getXIntersection(var5, this.x1);
    Vec3D var7 = var4.getXIntersection(var5, this.x2);
    Vec3D var8 = var4.getYIntersection(var5, this.y1);
    Vec3D var9 = var4.getYIntersection(var5, this.y2);
    Vec3D var10 = var4.getZIntersection(var5, this.z1);
    var5 = var4.getZIntersection(var5, this.z2);
    if(!this.xIntersects(var6)) {
      var6 = null;
    }

    if(!this.xIntersects(var7)) {
      var7 = null;
    }

    if(!this.yIntersects(var8)) {
      var8 = null;
    }

    if(!this.yIntersects(var9)) {
      var9 = null;
    }

    if(!this.zIntersects(var10)) {
      var10 = null;
    }

    if(!this.zIntersects(var5)) {
      var5 = null;
    }

    Vec3D var11 = null;
    if(var6 != null) {
      var11 = var6;
    }

    if(var7 != null && (var11 == null || var4.distance(var7) < var4.distance(var11))) {
      var11 = var7;
    }

    if(var8 != null && (var11 == null || var4.distance(var8) < var4.distance(var11))) {
      var11 = var8;
    }

    if(var9 != null && (var11 == null || var4.distance(var9) < var4.distance(var11))) {
      var11 = var9;
    }

    if(var10 != null && (var11 == null || var4.distance(var10) < var4.distance(var11))) {
      var11 = var10;
    }

    if(var5 != null && (var11 == null || var4.distance(var5) < var4.distance(var11))) {
      var11 = var5;
    }

    if(var11 == null) {
      return null;
    } else {
      byte var12 = -1;
      if(var11 == var6) {
        var12 = 4;
      }

      if(var11 == var7) {
        var12 = 5;
      }

      if(var11 == var8) {
        var12 = 0;
      }

      if(var11 == var9) {
        var12 = 1;
      }

      if(var11 == var10) {
        var12 = 2;
      }

      if(var11 == var5) {
        var12 = 3;
      }

      return new MovingObjectPosition(var1, var2, var3, var12, var11.add((float)var1, (float)var2, (float)var3));
    }
  }
View Full Code Here

Examples of net.minecraft.server.Vec3D

   * @param explosionPosition of the explosion
   * @param entity that was damaged
   * @return damage factor
   */
  public static float getExplosionDamageFactor(Location explosionPosition, org.bukkit.entity.Entity entity) {
    final Vec3D vec = (Vec3D) Conversion.toVec3DHandle.convert(explosionPosition);
    return CommonNMS.getNative(explosionPosition.getWorld()).a(vec, CommonNMS.getNative(entity).boundingBox);
  }
View Full Code Here

Examples of net.minecraft.server.v1_6_R3.Vec3D

        EntityHuman entityhuman = this.world.findNearbyPlayer(this, range);
        return entityhuman != null && isInSight(entityhuman) ? entityhuman : null;
    }

    private Vec3D getPathVector() {
        Vec3D vec3d = path.a(this);
        double length = (this.width * 2.0F);
        while (vec3d != null && vec3d.d(this.locX, vec3d.d, this.locZ) < length * length) {
            this.path.a(); // Increment path index.
            // Is path finished?
            if (this.path.b()) {
                Vec3D.a.release(vec3d);
                vec3d = null;
View Full Code Here

Examples of net.minecraft.server.v1_7_R1.Vec3D

        }
      }

      if(this.m_friend == null)
      {
        Vec3D vec = RandomPositionGenerator.a(this.m_villager, 16, 3);

        if(vec == null)
          return false;

        Vec3D.a.release(vec);
View Full Code Here

Examples of net.minecraft.src.Vec3D

    int l1 = MathHelper.floor_double(explosionY + (double) explosionSize + 1.0D);
    int i2 = MathHelper.floor_double(explosionZ - (double) explosionSize - 1.0D);
    int j2 = MathHelper.floor_double(explosionZ + (double) explosionSize + 1.0D);
    List list = worldObj.getEntitiesWithinAABBExcludingEntity(exploder,
        AxisAlignedBB.getBoundingBoxFromPool(k, k1, i2, i1, l1, j2));
    Vec3D vec3d = Vec3D.createVector(explosionX, explosionY, explosionZ);

    for (int k2 = 0; k2 < list.size(); k2++) {
      Entity entity = (Entity) list.get(k2);
      double d4 = entity.getDistance(explosionX, explosionY, explosionZ)
          / (double) explosionSize;
View Full Code Here

Examples of toxi.geom.Vec3D

  public Vec2D getPointOnPlane(Vec2D mousePoint, Plane planeIn) {

    Plane plane = new Plane(planeIn.copy(), planeIn.normal.copy());

    Vec3D mouseRayPos = new Vec3D(mousePoint.x, mousePoint.y, planeIn.z); // this only works for planes perpendicular to the screen
    Vec3D mouseRayDir = new Vec3D(0, 0, -1);

    Vec3D focusCentre = new Vec3D(
        ((GLOBAL.windowWidth / 2) - (float)GLOBAL.CAM_OFFSET_X),
        ((GLOBAL.windowHeight / 2) - (float)GLOBAL.CAM_OFFSET_Y), 0);

    //now mouse pos is refereced from the centre of the screen
    mouseRayPos.x -= (GLOBAL.windowWidth / 2);
    mouseRayPos.y -= (GLOBAL.windowHeight / 2);
    mouseRayPos.scaleSelf((float) (1 / GLOBAL.getZOOM()));

    mouseRayPos.addSelf(focusCentre);

    Ray3D ray;

    Vec3D mousePos = null;
    Vec3D intersect;
    mouseRayDir = new Vec3D(0, 0, -1);

    plane.z = 0;
    //we need to rotate the plane so that it matches the one on the draw view
    plane.normal.rotateY(GLOBAL.rotateModelsY);
    plane.normal.rotateX(GLOBAL.rotateModelsX);

    plane.addSelf(plane.normal.scale(planeIn.z));
    //mouseRayDir.rotateY(GLOBAL.rotateModelsY);
    //mouseRayDir.rotateX(GLOBAL.rotateModelsX);

    mouseRayPos.subSelf(focusCentre);
    ray = new Ray3D(mouseRayPos, mouseRayDir); // this should be the world position of the mouse poiner on the 0,0,-1 plane

    intersect = plane.getIntersectionWithRay(ray);

    if (intersect == null) {
      ray = new Ray3D(mouseRayPos, mouseRayDir.invert());
      intersect = plane.getIntersectionWithRay(ray);
    }

    ray = new Ray3D(mouseRayPos, mouseRayDir);
    ray.addSelf(focusCentre);

    //if(this.mouseDown)
    //  GLOBAL.debugRay = ray;

    if (intersect != null) {

      //  System.out.println(plane.getProjectedPoint(intersect));
      //  intersect.z -= plane.z*2;
      //intersect.x += 70; 
      //  System.out.println("before rotate " +intersect);
      //  intersect.subSelf(focusCentre.scale(GLOBAL.getZOOM()));

      //   intersect.
      intersect.rotateX(-GLOBAL.rotateModelsX);
      intersect.rotateY(-GLOBAL.rotateModelsY);

      intersect.addSelf(focusCentre);

      //intersect.x += (GLOBAL.CAM_OFFSET_X*GLOBAL.getZOOM());
      //intersect.y += GLOBAL.CAM_OFFSET_Y;

      //intersect.rotateAroundAxis(axis, theta)
      mousePos = intersect;
      //mousePos.x += intersect.z;
      //System.out.println("after rotate " +intersect);
    }

    //get the chair matrix
    Matrix4f chairMatrix = new Matrix4f();
    Vec3D chairCentreOfMass = new Vec3D();
    if (GLOBAL.sketchChairs.getCurChair() != null
        && GLOBAL.sketchChairs.getCurChair().rigidBody != null) {
      Transform transform = new Transform();
      GLOBAL.sketchChairs.getCurChair().rigidBody
          .getWorldTransform(transform);
View Full Code Here

Examples of toxi.geom.Vec3D

  }

  public Vec2D getPointOnPlaneOld(Vec2D mousePoint, Plane planeIn) {
    //get the chair matrix
    Matrix4f chairMatrix = new Matrix4f();
    Vec3D chairCentreOfMass = new Vec3D();
    if (GLOBAL.sketchChairs.getCurChair() != null
        && GLOBAL.sketchChairs.getCurChair().rigidBody != null) {
      Transform transform = new Transform();
      GLOBAL.sketchChairs.getCurChair().rigidBody
          .getWorldTransform(transform);
      transform.getMatrix(chairMatrix);
      chairCentreOfMass = GLOBAL.sketchChairs.getCurChair().centreOfMass;
    }

    Plane plane = new Plane(planeIn.copy(), planeIn.normal.copy());

    Vec3D mouseRayPos = new Vec3D(mousePoint.x, mousePoint.y, plane.z); // this only works for planes perpendicular to the screen
    Vec3D mouseRayDir = new Vec3D(0, 0, -1);

    Vec3D focusCentre = new Vec3D(
        ((GLOBAL.windowWidth / 2) - (float)GLOBAL.CAM_OFFSET_X),
        ((GLOBAL.windowHeight / 2) - (float)GLOBAL.CAM_OFFSET_Y), 0);

    //now mouse pos is refereced from the centre of the screen
    mouseRayPos.x -= (GLOBAL.windowWidth / 2);
    mouseRayPos.y -= (GLOBAL.windowHeight / 2);
    mouseRayPos.scaleSelf((float) (1 / GLOBAL.getZOOM()));

    //mouseRayPos.addSelf(-screenCentre.x,-screenCentre.y, 0);
    mouseRayPos.rotateX((GLOBAL.rotateModelsX));
    mouseRayPos.rotateY((GLOBAL.rotateModelsY));

    mouseRayPos.addSelf(focusCentre);

    mouseRayDir.x = mouseRayDir.x - mouseRayPos.x;
    mouseRayDir.y = mouseRayDir.y - mouseRayPos.y;
    mouseRayDir.z = mouseRayDir.z - mouseRayPos.z;

    mouseRayDir.rotateX((GLOBAL.rotateModelsX));
    mouseRayDir.rotateY((GLOBAL.rotateModelsY));

    Ray3D ray = new Ray3D(mouseRayPos, mouseRayDir);

    Vec3D mousePos = null;

    if (GLOBAL.rotateModelsX == 0 && GLOBAL.rotateModelsY == 0
        && plane.normal.x == 0 && plane.normal.y == 0)
      mousePos = new Vec3D(ray.x, ray.y, ray.z);

    //put these back in for 3d
    //  if(mousePos == null) 
    //    mousePos = plane.getIntersectionWithRay(ray);

    if (mousePos == null) {

      mouseRayDir = new Vec3D(0, 0, 1);
      mouseRayDir.x = mouseRayDir.x - mouseRayPos.x;
      mouseRayDir.y = mouseRayDir.y - mouseRayPos.y;
      mouseRayDir.z = mouseRayDir.z - mouseRayPos.z;

      mouseRayDir.rotateX((GLOBAL.rotateModelsX));
View Full Code Here

Examples of toxi.geom.Vec3D

    }
    return area;
  }

  public Vec3D getCentre() {
    Vec3D centre = new Vec3D();

    for (SlicePlane plane : this.getList()) {
      centre.addSelf(plane.getPlane());
    }
    centre.scaleSelf(1 / this.getList().size());

    return centre;
  }
View Full Code Here

Examples of toxi.geom.Vec3D

   * Build design from SketchShape element
   * @param shape
   */
  public SketchChair(SketchShape shape) {

    SlicePlane plane = new SlicePlane(new Plane(new Vec3D(0, 0, 0),
        new Vec3D(0, 0, -1)));
    plane.setSelected(true);
    plane.getSketch().getSketchShapes().add(shape);
    this.selectedPlanes.add(plane);
    this.mouseReleased(0, 0);
   
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.