Package org.mt4j.util.math

Examples of org.mt4j.util.math.Vector3D


    if (font == null)
      this.setDrawActionText(false);
    else
      this.setDrawActionText(true);
   
    b =  new Vector3D(this.getWidthXY(TransformSpace.RELATIVE_TO_PARENT)/2, this.getHeightXY(TransformSpace.RELATIVE_TO_PARENT)/2, 0);
   
    outerBar = new MTRectangle(0, 0, 0, 200, 30, pa);
    outerBar.setStrokeWeight(1);
//    outerBar.setNoStroke(true);
    outerBar.setStrokeColor(new MTColor(0, 0, 0, 255));
    outerBar.setFillColor(new MTColor(100, 100, 100, 200));
   
    outerBar.setGestureAllowance(DragProcessor.class, false);
    outerBar.setGestureAllowance(RotateProcessor.class, false);
    outerBar.setGestureAllowance(ScaleProcessor.class, false);
    outerBar.setGestureAllowance(TapProcessor.class, false);
   
    c = new Vector3D(b.x -  outerBar.getWidthXY(TransformSpace.RELATIVE_TO_PARENT)/2, b.y - outerBar.getHeightXY(TransformSpace.RELATIVE_TO_PARENT)/2, 0);
    outerBar.translate(c);
    outerBar.setName("MTProgressbar outer bar");
    this.addChild(outerBar);
   
    innerBar = new MTRectangle(0, 0, 0, 199, 29, pa);
    innerBar.setStrokeWeight(1);
    innerBar.setNoStroke(true);
    innerBar.setStrokeColor(new MTColor(255, 255, 255, 200));
    innerBar.setFillColor(new MTColor(250, 150, 150, 200));
   
    innerBar.setGestureAllowance(DragProcessor.class, false);
    innerBar.setGestureAllowance(RotateProcessor.class, false);
    innerBar.setGestureAllowance(ScaleProcessor.class, false);
   
    //Progress bar colors
    innerBar.getGeometryInfo().getVertices()[0].setRGBA(50, 50, 100, 200);
   
    innerBar.getGeometryInfo().getVertices()[1].setRGBA(50, 50, 250, 200);
    innerBar.getGeometryInfo().getVertices()[2].setRGBA(50, 50, 250, 200);
   
    innerBar.getGeometryInfo().getVertices()[3].setRGBA(50, 50, 100, 200);
    innerBar.getGeometryInfo().getVertices()[4].setRGBA(50, 50, 100, 200);
   
    innerBar.getGeometryInfo().updateVerticesColorBuffer();
    innerBar.translate(new Vector3D(0.5f, 0.5f, 0));
    innerBar.setName("MTProgressbar inner bar");
    outerBar.addChild(innerBar);
   
    targetWidth = innerBar.getWidthXY(TransformSpace.RELATIVE_TO_PARENT);
   
    this.innerBar.scale(1/targetWidth, 1, 1, zero, TransformSpace.LOCAL);
    this.innerBar.scale(1, 1, 1, zero, TransformSpace.LOCAL);
   
    this.translateGlobal(new Vector3D(
        MT4jSettings.getInstance().getWindowWidth()/2 - this.getWidthXY(TransformSpace.GLOBAL)/2,
        MT4jSettings.getInstance().getWindowHeight()/- this.getHeightXY(TransformSpace.GLOBAL)/2 ,
        0) );
   
   
    this.upperLeft = new Vector3D(0,0,0);
    this.lowerRight = new Vector3D(upperLeft.x + this.getWidthXY(TransformSpace.LOCAL), upperLeft.y + this.getHeightXY(TransformSpace.LOCAL), 0);
   
    this.upperLeftProjected    = new Vector3D(0,0,0);
    this.lowerRightProjected   = new Vector3D(0,0,0);
   
    this.setName("MTProgressbar");
   
    //Draw this component and its children above
    //everything previously drawn and avoid z-fighting with its children
View Full Code Here


   *
   * @return true, if successful
   */
  public boolean setSizeXYGlobal(float width, float height){
    if (width > 0 && height > 0){
      Vector3D centerPoint = this.getCenterPointGlobal();
      this.scaleGlobal(1/this.getWidthXYGlobal(), 1/this.getHeightXYGlobal(), 1, centerPoint);
      this.scaleGlobal(width, height, 1, centerPoint);
      return true;
    }else
      return false;
View Full Code Here

   * Gets the center point relative to parent.
   *
   * @return the center point relative to parent
   */
  public Vector3D getCenterPointRelativeToParent(){
    Vector3D c = this.centerPointLocal.getCopy();
    c.transform(this.getLocalMatrix());
    return c;
  }
View Full Code Here

   * Gets the center point global.
   *
   * @return the center point global
   */
  public Vector3D getCenterPointGlobal(){
    Vector3D c = this.centerPointLocal.getCopy();
    c.transform(this.getGlobalMatrix());
    return c;
  }
View Full Code Here

   */
  @Override
  public Vector3D getGeometryIntersectionLocal(Ray ray){
    Vector3D[] vertices;
    vertices = this.getVerticesLocal();
    Vector3D polyNormal   = this.getNormal();
   
    //Possible intersection point in plane of polygon
    Vector3D interSectPoint = ToolsGeometry.getRayPlaneIntersection(ray, polyNormal, vertices[0]);
   
    if (interSectPoint == null)
      return null;
   
    return (ToolsGeometry.isPoint3DInPlanarPolygon(vertices, interSectPoint, polyNormal) ? interSectPoint : null);
View Full Code Here

      }else{
        return this.normal;
      }
    } catch (Exception e) {
      e.printStackTrace();
      return new Vector3D(0,0,1);
    }
  }
View Full Code Here

   *
   * returns false if negative values are put in
   */
  public boolean setSizeXYRelativeToParent(float width, float height){
    if (width > 0 && height > 0){
      Vector3D centerPoint = this.getCenterPointRelativeToParent();
//      this.scale(1/this.getWidthXYRelativeToParent(), 1/this.getHeightXYRelativeToParent(), 1, centerPoint);
//      this.scale(width, height, 1, centerPoint);
      this.scale( (1f/this.getWidthXYRelativeToParent()) * width, (1f/this.getHeightXYRelativeToParent()) * height, 1, centerPoint);
      return true;
    }else
View Full Code Here

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

   * @return true, if the height isnt negative
   */
  public boolean setHeightXYRelativeToParent(float height){
    if (height > 0){
//      Vector3D centerPoint = this.getCenterPointGlobal(); //FIXME why was centerpoint global used here?? BUG?
      Vector3D centerPoint = this.getCenterPointRelativeToParent();
//      this.scale(1/this.getHeightXYRelativeToParent(), 1/this.getHeightXYRelativeToParent(), 1, centerPoint);
//      this.scale(height, height, 1, centerPoint);
      float factor = (1f/this.getHeightXYRelativeToParent()) * height;
      this.scale(factor, factor, 1, centerPoint);
      return true;
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);
      float factor = (1f/this.getHeightXYGlobal())* height;
      this.scaleGlobal(factor, factor, 1, centerPoint);
      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.