Package com.ngt.jopenmetaverse.shared.types

Examples of com.ngt.jopenmetaverse.shared.types.Vector3


         
          Utils.tryParseFloat((String)list[0], xyz[0]);
          Utils.tryParseFloat((String)list[1], xyz[1]);
          Utils.tryParseFloat((String)list[2], xyz[2]);

          return new Vector3(xyz[0][0], xyz[1][0], xyz[2][0]);
        }
      }
      else if (value instanceof String)
      {
        OSDArray array = (OSDArray)NotationalLLSDOSDParser.DeserializeLLSDNotation((String)value);
View Full Code Here


    // Since version 1.40.4 of the Linden simulator, sending this update
    // causes corruption of the agent position in the simulator
    if (simulator != null && (!simulator.AgentMovementComplete))
      return;

    Vector3 origin = Camera.getPosition();
    Vector3 xAxis = Camera.getLeftAxis();
    Vector3 yAxis = Camera.getAtAxis();
    Vector3 zAxis = Camera.getUpAxis();

    // Attempted to sort these in a rough order of how often they might change
    if (agentControls == 0 &&
        yAxis == LastCameraYAxis &&
        origin == LastCameraCenter &&
View Full Code Here

    /// <summary>
    /// Default constructor
    /// </summary>
    public AgentCamera()
    {
      Frame = new CoordinateFrame(new Vector3(128f, 128f, 20f));
      Far = 128f;
    }
View Full Code Here

       /// <param name="at">Looking direction, must be a normalized vector</param>
       /// <param name="upDirection">Up direction, must be a normalized vector</param>
       public void LookDirection(Vector3 at, Vector3 upDirection)
       {
           // The two parameters cannot be parallel
           Vector3 left = Vector3.cross(upDirection, at);
           if (left == Vector3.Zero)
           {
               // Prevent left from being zero
               at.X += 0.01f;
               at.normalize();
               left = Vector3.cross(upDirection, at);
           }
           left.normalize();

           xAxis = at;
           yAxis = left;
           zAxis = Vector3.cross(at, left);
       }
View Full Code Here

           xAxis.Y = (float)Math.cos(heading);
       }

       public void LookAt(Vector3 origin, Vector3 target)
       {
           LookAt(origin, target, new Vector3(0f, 0f, 1f));
       }
View Full Code Here

       }

       public void LookAt(Vector3 origin, Vector3 target, Vector3 upDirection)
       {
           this.origin = origin;
           Vector3 at = Vector3.subtract(target, origin);
           at.normalize();

           LookDirection(at, upDirection);
       }
View Full Code Here

            WriteElementString(doc, writer, "Name", prim.Name);
            WriteElementString(doc, writer, "Material", Integer.toString((int)prim.Material));
            WriteElementString(doc, writer, "RegionHandle", prim.RegionHandle.toString());
            WriteElementString(doc, writer, "ScriptAccessPin", Integer.toString(prim.RemoteScriptAccessPIN));

            Vector3 groupPosition;
            if (parent == null)
                groupPosition = prim.Position;
            else
                groupPosition = parent.Position;
View Full Code Here

                RegionID = new UUID(text.substring(text.indexOf("region_id") + 10, 36));
                String vecDelim = " ";
                String[] vecStrings = text.substring(text.indexOf("local_pos") + 10).split(vecDelim);
                if (vecStrings.length == 3)
                {
                    Position = new Vector3(Float.parseFloat(vecStrings[0]), Float.parseFloat(vecStrings[1]),Float.parseFloat(vecStrings[2]));
                    return true;
                }
            }
            return false;
        }
View Full Code Here

      for (int i = 0; i < dataArray.count(); i++)
      {
        OSDMap blockMap = (OSDMap)dataArray.get(i);
        OSDMap extMap = (OSDMap)dataExtendedArray.get(i);
        ReportDataBlock block = new ReportDataBlock();
        block.Location = new Vector3(
            (float)blockMap.get("LocationX").asReal(),
            (float)blockMap.get("LocationY").asReal(),
            (float)blockMap.get("LocationZ").asReal());
        block.OwnerName = blockMap.get("OwnerName").asString();
        block.Score = (float)blockMap.get("Score").asReal();
View Full Code Here

  }

  @Test
  public void Vector3ApproxEquals()
  {
    Vector3 a = new Vector3(1f, 0f, 0f);
    Vector3 b = new Vector3(0f, 0f, 0f);

    Assert.assertFalse("ApproxEquals failed (1)", a.approxEquals(b, 0.9f));
    Assert.assertTrue("ApproxEquals failed (2)", a.approxEquals(b, 1.0f));

    a = new Vector3(-1f, 0f, 0f);
    b = new Vector3(1f, 0f, 0f);

    Assert.assertFalse("ApproxEquals failed (3)", a.approxEquals(b, 1.9f));
    Assert.assertTrue("ApproxEquals failed (4)", a.approxEquals(b, 2.0f));

    a = new Vector3(0f, -1f, 0f);
    b = new Vector3(0f, -1.1f, 0f);

    Assert.assertFalse("ApproxEquals failed (5)", a.approxEquals(b, 0.09f));
    Assert.assertTrue("ApproxEquals failed (6)", a.approxEquals(b, 0.11f));

    a = new Vector3(0f, 0f, 0.00001f);
    b = new Vector3(0f, 0f, 0f);

    Assert.assertFalse("ApproxEquals failed (6)", b.approxEquals(a, Float.MIN_VALUE));
    Assert.assertTrue("ApproxEquals failed (7)", b.approxEquals(a, 0.0001f));
  }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.Vector3

Copyright © 2018 www.massapicom. 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.