Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D


   * @return true, if the width isnt negative
   */
  public boolean setWidthXYRelativeToParent(float width){
    if (width > 0){
//      Vector3D centerPoint = this.getCenterPointGlobal(); //FIXME why was centerpoint global used here?? BUG?
      Vector3D centerPoint = this.getCenterPointRelativeToParent();
//      this.scale(1/this.getWidthXYRelativeToParent(), 1/this.getWidthXYRelativeToParent(), 1, centerPoint);
//      this.scale(width, width, 1, centerPoint);
      float factor = (1f/this.getWidthXYRelativeToParent()) * width;
      this.scale(factor, factor, 1, centerPoint);
      return true;
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);
      float factor = (1f/this.getWidthXYGlobal())* width;
      this.scaleGlobal(factor, factor, 1, centerPoint);
      return true;
View Full Code Here

        windowBackGround.scaleGlobal(se.getScaleFactorX(), se.getScaleFactorY(), se.getScaleFactorZ(), se.getScalingPoint());
       
        //Scale vertices of the window
        AbstractShape target = (AbstractShape)ge.getTargetComponent();
        Vertex[] verts = target.getGeometryInfo().getVertices();
        Vector3D newScalingPoint = target.globalToLocal(se.getScalingPoint());
        Matrix m = Matrix.getScalingMatrix(newScalingPoint, se.getScaleFactorX(), se.getScaleFactorY(), se.getScaleFactorZ());
        Vertex.transFormArray(m, verts);
        target.setVertices(verts);

        //Scale vertices of the clip shape
View Full Code Here

  public void setDisplayCloseButton(boolean dispClose){
    if (dispClose){
      MTSvgButton keybCloseSvg = new MTSvgButton(MT4jSettings.getInstance().getDefaultSVGPath()
          + "keybClose.svg", this.getRenderer());
      //Transform
      keybCloseSvg.scale(0.5f, 0.5f, 1, new Vector3D(0,0,0));
      keybCloseSvg.translate(new Vector3D(this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT) - 45, 2,0));
      keybCloseSvg.setBoundsPickingBehaviour(AbstractShape.BOUNDS_ONLY_CHECK);
      keybCloseSvg.addActionListener(new CloseActionListener(new MTComponent[]{this, keybCloseSvg}) );
//      pic.addChild(keybCloseSvg);
      keybCloseSvg.setName("closeButton");
      this.addChild(keybCloseSvg);
View Full Code Here

       * @param compToResize the comp to resize
       * @param width the width
       * @param height the height
       */
      protected void resize(MTPolygon referenceComp, MTComponent compToResize, float width, float height){
        Vector3D centerPoint = getRefCompCenterRelParent(referenceComp);
        compToResize.scale(1/referenceComp.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), (float)1/referenceComp.getWidthXY(TransformSpace.RELATIVE_TO_PARENT), 1, centerPoint, TransformSpace.RELATIVE_TO_PARENT);
        compToResize.scale(width, width, 1, centerPoint, TransformSpace.RELATIVE_TO_PARENT);
      }
View Full Code Here

       * @param shape the shape
       *
       * @return the ref comp center local
       */
      protected Vector3D getRefCompCenterRelParent(AbstractShape shape){
        Vector3D centerPoint;
        if (shape.hasBounds()){
          centerPoint = shape.getBounds().getCenterPointLocal();
          centerPoint.transform(shape.getLocalMatrix()); //macht den punkt in self space
        }else{
          Vector3D localObjCenter = shape.getCenterPointGlobal();
          localObjCenter.transform(shape.getGlobalInverseMatrix()); //to localobj space
          localObjCenter.transform(shape.getLocalMatrix()); //to parent relative space
          centerPoint = localObjCenter;
        }
        return centerPoint;
      }
View Full Code Here

  /* (non-Javadoc)
* @see com.jMT.components.visibleComponents.shapes.MTPolygon#getCenterPointObjectSpace()
*/
@Override
  public Vector3D getCenterPointLocal() {
    Vector3D center = new Vector3D(this.centerPoint);
    return center;
  }
View Full Code Here

 
 
  private Vector3D getListUpperLeftLocal(){
    PositionAnchor savedAnchor = this.getAnchor();
    this.setAnchor(PositionAnchor.UPPER_LEFT);
    Vector3D pos = this.getPosition(TransformSpace.LOCAL);
    this.setAnchor(savedAnchor);
    return pos;
  }
View Full Code Here

  }
 
  private Vector3D getListLowerLeftLocal(){
    PositionAnchor savedAnchor = this.getAnchor();
    this.setAnchor(PositionAnchor.LOWER_LEFT);
    Vector3D pos = this.getPosition(TransformSpace.LOCAL);
    this.setAnchor(savedAnchor);
    return pos;
  }
View Full Code Here

 
 
  private Vector3D getContainerUpperLeftRelParent(){
    PositionAnchor saved = listCellContainer.getAnchor();
    listCellContainer.setAnchor(PositionAnchor.UPPER_LEFT);
    Vector3D returnPos = listCellContainer.getPosition(TransformSpace.RELATIVE_TO_PARENT);
    listCellContainer.setAnchor(saved);
    return returnPos;
  }
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.