Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D.transform()


    Matrix m0 = MTComponent.getTransformToDestinationLocalSpace(otherComp, this);
    pos.transform(m0);
   
    Vector3D centerpointGlobal = this.getCenterPointGlobal();
    centerpointGlobal.transform(this.getGlobalInverseMatrix()); //to localobj space
    centerpointGlobal.transform(this.getLocalMatrix()); //to parent relative space
   
    Vector3D diff = pos.getSubtracted(centerpointGlobal);
   
    this.translate(diff, TransformSpace.RELATIVE_TO_PARENT);
   
View Full Code Here


   *
   * the center of this shape in global coordinates
   */
  public final Vector3D getCenterPointGlobal(){
    Vector3D center = this.getCenterPointLocal();
    center.transform(this.getGlobalMatrix());
    return center;
  }
 
  /**
   * Gets the center point relative to parent.
View Full Code Here

   * First it gets the local center and then transforms it to the parent frame.
   * @return the center of this shape in coordinates relative to the shapes parent coordiante frame.
   */
  public final Vector3D getCenterPointRelativeToParent(){
    Vector3D center = this.getCenterPointLocal();
    center.transform(this.getLocalMatrix());
    return center;
  }
 
  /**
   * Gets the center point in local object space.
View Full Code Here

  private boolean setWidthRelativeToParent(float width){
    if (width > 0){
      Vector3D centerPoint;
      if (this.hasBounds()){
        centerPoint = this.getBounds().getCenterPointLocal();
        centerPoint.transform(this.getLocalMatrix());
      }else{
        centerPoint = this.getCenterPointGlobal();
        centerPoint.transform(this.getGlobalInverseMatrix());
      }
      this.scale(1/this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1/this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1, centerPoint);
View Full Code Here

      if (this.hasBounds()){
        centerPoint = this.getBounds().getCenterPointLocal();
        centerPoint.transform(this.getLocalMatrix());
      }else{
        centerPoint = this.getCenterPointGlobal();
        centerPoint.transform(this.getGlobalInverseMatrix());
      }
      this.scale(1/this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1/this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1, centerPoint);
      this.scale(width, width, 1, centerPoint);
//      this.scale(1/this.getWidthLocal(), 1/this.getWidthLocal(), 1, centerPoint, TransformSpace.RELATIVE_TO_SELF);
//      this.scale(width, width, 1, centerPoint, TransformSpace.RELATIVE_TO_SELF);
View Full Code Here

  private boolean setSizeXYRelativeToParent(AbstractShape shape, float width, float height){
    if (width > 0 && height > 0){
      Vector3D centerPoint;
      if (shape.hasBounds()){
        centerPoint = shape.getBounds().getCenterPointLocal();
        centerPoint.transform(shape.getLocalMatrix()); //TODO n�tig?
      }else{
        centerPoint = shape.getCenterPointGlobal();
        centerPoint.transform(shape.getGlobalInverseMatrix());
      }
      shape.scale(1/shape.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1/shape.getHeightXY(TransformSpace.RELATIVE_TO_PARENT), 1, centerPoint);
View Full Code Here

      if (shape.hasBounds()){
        centerPoint = shape.getBounds().getCenterPointLocal();
        centerPoint.transform(shape.getLocalMatrix()); //TODO n�tig?
      }else{
        centerPoint = shape.getCenterPointGlobal();
        centerPoint.transform(shape.getGlobalInverseMatrix());
      }
      shape.scale(1/shape.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1/shape.getHeightXY(TransformSpace.RELATIVE_TO_PARENT), 1, centerPoint);
      shape.scale(width, height, 1, centerPoint);
      return true;
    }else
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.