Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D


//    System.out.println("SVG Bounds -> minX: " + bounds[0] + " minY: " + bounds[2] + " maxX: " + bounds[1] + " maxY: " + bounds[3]);
    float minX = bounds[0];
    float minY = bounds[2];
    float maxX = bounds[1];
    float maxY = bounds[3];
    Vector3D upperLeft   = new Vector3D(minX, minY, 0);
    Vector3D upperRight = new Vector3D(maxX, minY, 0);
    Vector3D lowerRight  = new Vector3D(maxX, maxY, 0);
   
    this.widthVect    = upperRight.getSubtracted(upperLeft);
    this.heightVect   = lowerRight.getSubtracted(upperRight);
    this.width   = maxX-minX;
    this.height = maxY-minY;
   
    this.centerPointLocal = new Vector3D(
        upperLeft.x + ((upperRight.x - upperLeft.x)/2f),
        upperRight.y + ((lowerRight.y - upperRight.y)/2f),
        0);
   
    //System.out.println("Center local " + centerPointLocal);
View Full Code Here


* @return the width xy relative to parent
*
* the width
*/
  public float getWidthXYRelativeToParent() {
    Vector3D p = this.widthVect.getCopy();
    Matrix m = new Matrix(this.getLocalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
  }
View Full Code Here

   * @return the width xy global
   *
   * the Width relative to the world space
   */
  public float getWidthXYGlobal() {
    Vector3D p = this.widthVect.getCopy();
    Matrix m = new Matrix(this.getGlobalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
  }
View Full Code Here

* @return the height xy relative to parent
*
* the height relative to its parent space frame
*/
  public float getHeightXYRelativeToParent() {
    Vector3D p = this.heightVect.getCopy();
    Matrix m = new Matrix(this.getLocalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
  }
View Full Code Here

   * @return the height xy global
   *
   * the height relative to the world space
   */
  public float getHeightXYGlobal() {
    Vector3D p = this.heightVect.getCopy();
    Matrix m = new Matrix(this.getGlobalMatrix());
    m.removeTranslationFromMatrix();
    p.transform(m);
    return p.length();
  }
View Full Code Here

   *
   * @return true, if the height isnt negative
   */
  public boolean setHeightXYRelativeToParent(float height){
    if (height > 0){
      Vector3D centerPoint = this.getCenterPointGlobal();
      this.scale(1/this.getHeightXYRelativeToParent(), 1/this.getHeightXYRelativeToParent(), 1, centerPoint);
      this.scale(height, height, 1, centerPoint);
      return true;
    }else
      return false;
View Full Code Here

   *
   * @return true, if sets the height xy global
   */
  public boolean setHeightXYGlobal(float height){
    if (height > 0){
      Vector3D centerPoint = this.getCenterPointGlobal();
      this.scaleGlobal(1/this.getHeightXYGlobal(), 1/this.getHeightXYGlobal(), 1, centerPoint);
      this.scaleGlobal(height, height, 1, centerPoint);
      return true;
    }else
      return false;
View Full Code Here

   *
   * @return true, if the width isnt negative
   */
  public boolean setWidthXYRelativeToParent(float width){
    if (width > 0){
      Vector3D centerPoint = this.getCenterPointGlobal();
      this.scale(1/this.getWidthXYRelativeToParent(), 1/this.getWidthXYRelativeToParent(), 1, centerPoint);
      this.scale(width, width, 1, centerPoint);
      return true;
    }else
      return false;
View Full Code Here

   *
   * @return true, if sets the width xy global
   */
  public boolean setWidthXYGlobal(float width){
    if (width > 0){
      Vector3D centerPoint = this.getCenterPointGlobal();
      this.scaleGlobal(1/this.getWidthXYGlobal(), 1/this.getWidthXYGlobal(), 1, centerPoint);
      this.scaleGlobal(width, width, 1, centerPoint);
      return true;
    }else
      return false;
View Full Code Here

   *
   * @return true, if successful
   */
  public boolean setSizeXYRelativeToParent(float width, float height){
    if (width > 0 && height > 0){
      Vector3D centerPoint = this.getCenterPointGlobal(); //FIXME use centerRelToParent?
      this.scale(1/this.getWidthXYRelativeToParent(), 1/this.getHeightXYRelativeToParent(), 1, centerPoint);
      this.scale(width, height, 1, centerPoint);
      return true;
    }else
      return false;
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.