Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D


  private Vector3D getNormalLocal() {
    return ToolsGeometry.getNormal(this.boundingPointsLocal[0], this.boundingPointsLocal[1], this.boundingPointsLocal[2], true);
  }
 
  private Vector3D calcCenterPointLocal(){
    Vector3D tmp0 = this.boundingPointsLocal[0].getCopy();
    Vector3D tmp1 = this.boundingPointsLocal[1].getSubtracted(this.boundingPointsLocal[0]);
    tmp1.scaleLocal(0.5f);
   
    Vector3D tmp2 = this.boundingPointsLocal[3].getSubtracted(this.boundingPointsLocal[0]);
    tmp2.scaleLocal(0.5f);
   
    tmp0.addLocal(tmp1);
    tmp0.addLocal(tmp2);
    return tmp0;
  }
View Full Code Here


  }
 
 
  public Vector3D getCenterPointGlobal() {
    if (centerWorldDirty){
      Vector3D tmp = this.getCenterPointLocal();
      tmp.transform(this.peerComponent.getGlobalMatrix());
//      tmp = peerComponent.localToGlobal(tmp);
      this.centerPointWorld = tmp;
      this.centerWorldDirty = false;
      return this.centerPointWorld;
    }
View Full Code Here

   * Gets the height xy relative to parent.
   *
   * @return the height xy relative to parent
   */
  private float getHeightXYRelativeToParent() {
    Vector3D p = this.getHeightXYVectLocal();
    Matrix m = new Matrix(this.peerComponent.getLocalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
   
//    Vector3D[] v = this.getVectorsRelativeToParent();
//    float[] minMax = ToolsGeometry.getMinXYMaxXY(v);
//    return minMax[3] - minMax[1];
  }
View Full Code Here

   * Gets the position.
   *
   * @return the position
   */
  public Vector3D getPosition(){
    return new Vector3D(positionX, positionY, 0);
  }
View Full Code Here

   * Gets the height xy global.
   *
   * @return the height xy global
   */
  private float getHeightXYGlobal() {
    Vector3D p = this.getHeightXYVectLocal();
    Matrix m = new Matrix(this.peerComponent.getGlobalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
   
//    Vector3D[] v = this.getVectorsGlobal();
//    float[] minMax = ToolsGeometry.getMinXYMaxXY(v);
//    return minMax[3] - minMax[1];
  }
View Full Code Here

   *
   * vector representing the height of the boundingshape of the shape
   */
  public Vector3D getHeightXYVectLocal() {
    Vector3D[] boundRectVertsLocal = this.getVectorsLocal();
    Vector3D height = boundRectVertsLocal[2].getSubtracted(boundRectVertsLocal[1]);
    return height;
  }
View Full Code Here

   *
   * @return the width xy realtive to parent
   */
  private float getWidthXYRealtiveToParent() {
    //This calculates the width aligned/relative to the object
    Vector3D p = this.getWidthXYVectLocal();
    Matrix m = new Matrix(this.peerComponent.getLocalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
   
    //This calculates the dimension relative to the screen axis (here X-axis)
//    Vector3D[] v = this.getVectorsRelativeToParent();
//    float[] minMax = ToolsGeometry.getMinXYMaxXY(v);
//    return minMax[2] - minMax[0];
View Full Code Here

   * Gets the width xy global.
   *
   * @return the width xy global
   */
  private float getWidthXYGlobal() {
    Vector3D p = this.getWidthXYVectLocal();
    Matrix m = new Matrix(this.peerComponent.getGlobalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
   
//    Vector3D[] v = this.getVectorsGlobal();
//    float[] minMax = ToolsGeometry.getMinXYMaxXY(v);
//    return minMax[2] - minMax[0];
  }
View Full Code Here

   * vector representing the Width of the boundingshape of the shape
   */
  //@Override
  public Vector3D getWidthXYVectLocal() {
    Vector3D[] boundRectVertsLocal = this.getVectorsLocal();
    Vector3D width = boundRectVertsLocal[1].getSubtracted(boundRectVertsLocal[0]);
//    System.out.println("Width of " + this.getName()+ " :" + width);
    return width;
  }
View Full Code Here


  public boolean isContainedInFrustum(IFrustum frustum) {
    Vector3D[] points = this.getVectorsGlobal();
    for (int i = 0; i < points.length; i++) {
      Vector3D vector3D = points[i];
      int test = frustum.isPointInFrustum(vector3D);
      if (   test == IFrustum.INSIDE
        || test == IFrustum.INTERSECT
      ){
        return true;
      }
    }
    //Also check if center point is in frustum
    Vector3D center = this.getCenterPointGlobal();
    int test = frustum.isPointInFrustum(center);
    if (   test == IFrustum.INSIDE
      || test == IFrustum.INTERSECT
    ){
      return true;
View Full Code Here

TOP

Related Classes of org.mt4j.util.math.Vector3D

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.