Examples of Vector3


Examples of net.sourceforge.fo3d.util.Vector3

    /** {@inheritDoc} */
    public void handleElement(RendererContext context, Element el,
            PDF3DAnnotation annot) throws Exception {

        Vector3 pos = DOMUtil.get3DVectorAttribute(el, "at", true);
        String text = el.getTextContent().trim();
        if (text.length() == 0) {
            return;
        }

        String intDest = DOMUtil.getAttribute(el, "internal-destination");

        String resName = RESOURCE_NAME_PREFIX + textSpriteCount++;

        // Generate text image
        BufferedImage bi = getTextImage(text);

        // Debugging generated images
        // ImageIO.write(bi, "gif", new File("D:\\" + resName + ".gif"));

        // Add generated image to PDF document (as 3D stream resource)
        FO3DPDFDocument pdfDoc = (FO3DPDFDocument) context
            .getProperty(PDFRendererContextConstants.PDF_DOCUMENT);
        PDFResourceContext resContext = (PDFResourceContext) context
            .getProperty(PDFRendererContextConstants.PDF_CONTEXT);

        ImageInfo imgInfo = new ImageInfo(null, null);
        ImageSize imgSize = new ImageSize();
        imgSize.setSizeInPixels(bi.getWidth(), bi.getHeight());
        imgSize.setResolution(72);
        imgInfo.setSize(imgSize);

        ImageBuffered img = new ImageBuffered(imgInfo, bi, null);
        PDFImage pdfimage = new ImageRenderedAdapter(img, resName);
        PDFXObject xobj = pdfDoc.addImage(resContext, pdfimage);

        PDF3DStream stream = annot.getStreamSafely();
        stream.addResource(resName, xobj);

        // load JavaScript library code once (per 3D stream)
        // this is because the DOM element could exist multiple times within
        // the extension section.
        if (!libLoadedList.contains(stream.referencePDF())) {
            stream.addJSCode(getLibJSCode());
            libLoadedList.add(stream.referencePDF());
        }

        // Add JavaScript code for initializing a new textsprite
        stream.addJSCode("\naddTextSprite('"
            + JavaScriptUtil.escapeString(resName)
            + "',"
            + pos.toPDF3DJSString()
            + (intDest.length() > 0 ? ",'"
                    + JavaScriptUtil.escapeString(intDest) + "'" : "")
            + ");");
    }
View Full Code Here

Examples of nexus.model.structs.Vector3

  public static final int TEST_ITERATIONS = 2; // default is 5, but this can be annoying for dev
  public static Model world;
 
  @BeforeClass
  public static void testSetup() {
    world = new Model(new Camera(new Vector3(0f, 0f, 0f), 0f, 0f, 0f, false));
  }
View Full Code Here

Examples of org.geoserver.w3ds.types.Vector3

public void addGeometry(Geometry geometry) {
    if (requestFormat == Format.OCTET_STREAM) {
        List<Vector3> vertexList = filterCoordinates(geometry.getCoordinates());
        for (int i = 0; i < vertexList.size(); i++) {
            Vector3 vertex = vertexList.get(i);
            if (!vertices.contains(vertex)) {
                vertices.add(vertex);
            }
        }
    } else {
View Full Code Here

Examples of org.graphstream.ui.geom.Vector3

      Point3 oo = (Point3) o;
      xyz[0] = oo.x;
      xyz[1] = oo.y;
      xyz[2] = oo.z;
    } else if(o instanceof Vector3) {
      Vector3 oo = (Vector3) o;
      xyz[0] = oo.data[0];
      xyz[1] = oo.data[1];
      xyz[2] = oo.data[2];
    } else if(o instanceof Point2) {
      Point2 oo = (Point2) o;
View Full Code Here

Examples of org.sunflow.math.Vector3

    }
    float [] sunDirection = getSunDirection(this.compass, Camera.convertTimeToTimeZone(camera.getTime(), this.compass.getTimeZone()));
    // Update Sun direction during daytime
    if (sunDirection [1] > -0.075f) {
      if (this.useSunSky) {
        this.sunflow.parameter("up", new Vector3(0, 1, 0));
        this.sunflow.parameter("east",
            new Vector3((float)Math.sin(compass.getNorthDirection()), 0, (float)Math.cos(compass.getNorthDirection())));
        this.sunflow.parameter("sundir", new Vector3(sunDirection [0], sunDirection [1], sunDirection [2]));
        this.sunflow.parameter("turbidity", 6f);
        this.sunflow.parameter("samples", this.useAmbientOcclusion ? 0 : 12);
        this.sunSkyLightName = UUID.randomUUID().toString();
        this.sunflow.light(this.sunSkyLightName, "sunsky");
      }

      // Retrieve sun color
      SunSkyLight sunSkyLight = new SunSkyLight();
      ParameterList parameterList = new ParameterList();
      parameterList.addVectors("up", InterpolationType.NONE, new float [] {0, 1, 0});
      parameterList.addVectors("east", InterpolationType.NONE,
          new float [] {(float)Math.sin(compass.getNorthDirection()), 0, (float)Math.cos(compass.getNorthDirection())});
      parameterList.addVectors("sundir", InterpolationType.NONE,
          new float [] {sunDirection [0], sunDirection [1], sunDirection [2]});
      sunSkyLight.update(parameterList, this.sunflow);
      float [] sunColor = sunSkyLight.getSunColor().getRGB();
     
      // Simulate additional Sun with a faraway sphere light of a color depending of the hour of the day
      int sunPower = this.useAmbientOcclusion ? 40 : 10;
      this.sunflow.parameter("radiance", null,
          (this.homeLightColor >> 16) * sunPower * (float)Math.sqrt(sunColor [0]),
          ((this.homeLightColor >> 8) & 0xFF) * sunPower * (float)Math.sqrt(sunColor [1]),
          (this.homeLightColor & 0xFF) * sunPower * (float)Math.sqrt(sunColor [2]));
      this.sunflow.parameter("center", new Point3(1000000 * sunDirection [0], 1000000 * sunDirection [1], 1000000 * sunDirection [2]));
      this.sunflow.parameter("radius", 10000f)
      this.sunflow.parameter("samples", 4);
      this.sunLightName = UUID.randomUUID().toString();
      this.sunflow.light(this.sunLightName, "sphere");

      if (this.useAmbientOcclusion) {
        this.sunflow.parameter("gi.engine", "ambocc");
        this.sunflow.parameter("gi.ambocc.bright", null, new float [] {1, 1, 1});
        // Use complementary color
        this.sunflow.parameter("gi.ambocc.dark", null,
            new float [] {(sunColor [1] + sunColor [2]) / 200,
                          (sunColor [0] + sunColor [2]) / 200,
                          (sunColor [0] + sunColor [1]) / 200});
        this.sunflow.parameter("gi.ambocc.samples", 1);
        this.sunflow.options(SunflowAPI.DEFAULT_OPTIONS);
      }
    }

    // Update camera lens
    final String CAMERA_NAME = "camera";   
    switch (camera.getLens()) {
      case SPHERICAL:
        this.sunflow.camera(CAMERA_NAME, "spherical");
        break;
      case FISHEYE:
        this.sunflow.camera(CAMERA_NAME, "fisheye");
        break;
      case NORMAL:
        this.sunflow.parameter("focus.distance", 250f);
        this.sunflow.parameter("lens.radius", 1f);
        this.sunflow.camera(CAMERA_NAME, "thinlens");
        break;
      case PINHOLE:
      default:
        this.sunflow.camera(CAMERA_NAME, "pinhole");
        break;
    }
   
    // Update camera location
    Point3 eye = new Point3(camera.getX(), camera.getZ(), camera.getY());
    Matrix4 transform;
    float yaw = camera.getYaw();
    float pitch;
    if (camera.getLens() == Camera.Lens.SPHERICAL) {
      pitch = 0;
    } else {
      pitch = camera.getPitch();
    }
    double pitchCos = Math.cos(pitch);
    if (Math.abs(pitchCos) > 1E-6) {
      // Set the point the camera is pointed to
      Point3 target = new Point3(
          camera.getX() - (float)(Math.sin(yaw) * pitchCos),
          camera.getZ() - (float)Math.sin(pitch),
          camera.getY() + (float)(Math.cos(yaw) * pitchCos));
      Vector3 up = new Vector3(0, 1, 0);             
      transform = Matrix4.lookAt(eye, target, up);
    } else {
      // Compute matrix directly when the camera points is at top
      transform = new Matrix4((float)-Math.cos(yaw), (float)-Math.sin(yaw), 0, camera.getX(),
          0, 0, 1, camera.getZ(),
View Full Code Here

Examples of org.sunflow.math.Vector3

      g2D.dispose();
      File imageFile = OperatingSystem.createTemporaryFile("ibl", ".png");
      ImageIO.write(imageBaseLightImage, "png", imageFile);
     
      this.sunflow.parameter("texture", imageFile.getAbsolutePath());
      this.sunflow.parameter("center", new Vector3(-1, 0, 0));
      this.sunflow.parameter("up", new Vector3(0, 1, 0));
      this.sunflow.parameter("fixed", true);
      this.sunflow.parameter("samples", 0);
      this.sunflow.light(UUID.randomUUID().toString(), "ibl");
    }
   
View Full Code Here

Examples of thaumcraft.codechicken.lib.vec.Vector3

  @Override
  public void onUsingFocusTick(ItemStack stack, EntityPlayer player, int ticks) {
    ItemWandCasting wand = (ItemWandCasting) stack.getItem();

    Vector3 target = Vector3.fromEntityCenter(player);

    final int range = 6 + EnchantmentHelper.getEnchantmentLevel(Config.enchPotency.effectId, wand.getFocusItem(stack));
    final double distance = range - 1;
    if (!player.isSneaking())
      target.add(new Vector3(player.getLookVec()).multiply(distance));

    target.y += 0.5;

    List<EntityItem> entities = player.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(target.x - range, target.y - range, target.z - range, target.x + range, target.y + range, target.z + range));
View Full Code Here

Examples of thaumcraft.codechicken.lib.vec.Vector3

  public static MinecraftServer server() {
    return MinecraftServer.getServer();
  }

  public static void setEntityMotionFromVector(Entity entity, Vector3 originalPosVector, float modifier) {
    Vector3 entityVector = Vector3.fromEntityCenter(entity);
    Vector3 finalVector = originalPosVector.copy().subtract(entityVector);

    if (finalVector.mag() > 1)
      finalVector.normalize();

    entity.motionX = finalVector.x * modifier;
    entity.motionY = finalVector.y * modifier;
    entity.motionZ = finalVector.z * modifier;
  }
 
View Full Code Here

Examples of thaumcraft.codechicken.lib.vec.Vector3

    List<Entity> projectiles = p.worldObj.getEntitiesWithinAABB(IProjectile.class, AxisAlignedBB.getBoundingBox(p.posX - 4, p.posY - 4, p.posZ - 4, p.posX + 3, p.posY + 3, p.posZ + 3));

    for (Entity e : projectiles) {
      if (DeflectBlacklist.contains(e.getClass()) || ProjectileHelper.getOwner(e) == p)
        continue;
      Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply(Math.sqrt((e.posX - p.posX) * (e.posX - p.posX) + (e.posY - p.posY) * (e.posY - p.posY) + (e.posZ - p.posZ) * (e.posZ - p.posZ)) * 2);

      for (int i = 0; i < 6; i++)
        ThaumicTinkerer.tcProxy.sparkle((float) e.posX, (float) e.posY, (float) e.posZ, 6);

      e.posX += motionVec.x;
View Full Code Here

Examples of thaumcraft.codechicken.lib.vec.Vector3

    int x = (int) Math.floor(player.posX);
    int y = (int) player.posY + 1;
    int z = (int) Math.floor(player.posZ);

    float yaw = MathHelper.wrapAngleTo180_float(player.rotationYaw + 90F) * (float) Math.PI / 180F;
    Vector3 lookVector = new Vector3(Math.cos(yaw), Math.sin(yaw), 0).normalize();
    Vector3 newVector = new Vector3(lookVector.x, lookVector.y, 0);

    for (int i = 0; i < 5; i++) {
      newVector = newVector.add(lookVector);

      int x1 = x + (int) newVector.x;
      int z1 = z + (int) newVector.y;
      ItemBrightNitor.setBlock(x1, y, z1, player.worldObj);
    }
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.