Codota Logo
Vector2Double
Code IndexAdd Codota to your IDE (free)

How to use
Vector2Double
in
jadex.extension.envsupport.math

Best Java code snippets using jadex.extension.envsupport.math.Vector2Double (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public IVector2 copy()
{
  return new Vector2Double(x_, y_);
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Returns the size of a pixel.
 * @retun size of a pixel
 */
public IVector2 getPixelSize()
{
  Canvas canvas = canvas_;
  if (canvas == null)
    return Vector2Double.ZERO;
  return paddedSize_.copy().divide(new Vector2Double(canvas.getWidth(), canvas.getHeight()));
}

origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Creates a new TiledLayer.
 * 
 * @param tileSize size of an individual tile
 * @param color the modulation color
 * @param texturePath resource path of the texture
 */
public TiledLayer(IVector2 tileSize, Object color, String texturePath)
{
  super(Layer.LAYER_TYPE_TILED, color);
  this.tileSize_ = tileSize.copy();
  //this.modColor_ = color==null? Color.WHITE: color;
  this.invTileSize_ = (new Vector2Double(1.0)).divide(tileSize_);
  this.texturePath_ = texturePath;
  //texture_ = 0;
}

origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public ViewportCanvas()
{
  backBuffer_ = new BufferedImage(1, 1,
      BufferedImage.TYPE_4BYTE_ABGR_PRE);
  clearRectangle_ = new Rectangle.Double();
  clearRectangle_.x = 0.0;
  clearRectangle_.y = 0.0;
  clearRectangle_.width = size_.getXAsDouble();
  clearRectangle_.height = size_.getYAsDouble();
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public void mousePressed(MouseEvent e)
{
  if(e.getButton() == MouseEvent.BUTTON1)
  {
    IVector2 position = getWorldCoordinates(e.getX(), e.getY());
    fireLeftMouseClickEvent(position);
  }
  else if(e.getButton() == MouseEvent.BUTTON3)
  {
    if (e.getClickCount() == 1)
    {
      lastDragPos = (new Vector2Double(e.getX(), e.getY())).multiply(getPixelSize());
    }
    else
    {
      setAreaSize(areaSize_);
    }
  }
}

origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Converts pixel coordinates into world coordinates
 * 
 * @param pixelX pixel x-coordinate
 * @param pixelY pixel y-coordinate
 * @return world coordinates
 */
public IVector2 getWorldCoordinates(int pixelX, int pixelY)
{
  if(getInvertX())
  {
    pixelX = canvas_.getWidth() - pixelX;
  }
  if(getInvertY())
  {
    pixelY = canvas_.getHeight() - pixelY;
  }
  double xFac = (paddedSize_.getXAsDouble()) / canvas_.getWidth();
  double yFac = (paddedSize_.getYAsDouble()) / canvas_.getHeight();
  IVector2 position = new Vector2Double((xFac * pixelX) + position_.getXAsDouble(),
      (yFac * (canvas_.getHeight() - pixelY)) + position_.getYAsDouble());
  return position;
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

final Vector2Double direction = new Vector2Double((i == 1)||(i == 3)? 0.1:0.0, (i == 0)||(i== 2)? 0.1:0.0);
if ((i & 2) != 0)
  direction.negate();
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  public Object createObject(Map args) throws Exception
  {
    IVector2 size = Vector2Double.getVector2((Double)getProperty(args, "width"),
        (Double)getProperty(args, "height"));
    return new GridLayer(size, getProperty(args, "color"));
  }
}, new BeanAccessInfo(AccessInfo.THIS)))
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public Object clone() throws CloneNotSupportedException
{
  return copy();
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport-jmonkey

/**
 * Handle the Height Value. Check if its set or not
 */
public Vector3f handleHeightValue(Object posObj)
{
  Vector3f position = Vector3f.ZERO;
  if(posObj instanceof Vector2Double)
  {
    Vector2Double pos2d = (Vector2Double)posObj;
    Vector2f pos2df = new Vector2f(pos2d.getXAsFloat(), pos2d.getYAsFloat());
    position = new Vector3f(pos2df.x, _app.getHeightAt(pos2df), pos2df.y);
  }
  else if(posObj instanceof Vector3Double)
  {
    Vector3Double pos3d = (Vector3Double)posObj;
    Vector3f pos3f = new Vector3f(pos3d.getXAsFloat(), pos3d.getYAsFloat(), pos3d.getZAsFloat());
    position = pos3f;
  }
  return position;
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public boolean equals(Object obj)
{
  if (obj instanceof IVector2)
  {
    return equals((IVector2) obj);
  }
  return false;
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public double getDirectionAsDouble(IVector2 vector) {
  double qa = Math.sqrt(x_*x_ + y_*y_);
  double qb = Math.sqrt(vector.getXAsDouble()*vector.getXAsDouble() + vector.getYAsDouble()*vector.getYAsDouble());
  
  return Math.cos(getInnerProductAsDouble(vector)/(qa*qb));
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Sets the position of the viewport.
 */
public void setPosition(IVector2 pos)
{
  position_ = pos;
  IVector2 pixSize = getPixelSize();
  pixPosition_ = position_.copy().divide(pixSize);
  pixPosition_ = (new Vector2Double(new Vector2Int(pixPosition_))).multiply(pixSize);
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  public Object createObject(Map args) throws Exception
  {
    IVector2 size = Vector2Double.getVector2((Double)getProperty(args, "width"),
      (Double)getProperty(args, "height"));
    return new TiledLayer(size, getProperty(args, "color"), (String)getProperty(args, "imagepath"));
  }
}, new BeanAccessInfo(AccessInfo.THIS)))
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  private void setupTransform(Graphics2D g)
  {
    g.translate(
        backBuffer_.getWidth() * inversionFlag_.getXAsInteger(),
        backBuffer_.getHeight()
            * (inversionFlag_.getYAsInteger() ^ 1));
    g.scale((backBuffer_.getWidth() / paddedSize_.getXAsDouble())
        * -((inversionFlag_.getXAsInteger() << 1) - 1),
        (backBuffer_.getHeight() / paddedSize_.getYAsDouble())
            * ((inversionFlag_.getYAsInteger() << 1) - 1));
    g.translate(-pixPosition_.getXAsDouble(), -pixPosition_.getYAsDouble());
  }
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  public void actionPerformed(ActionEvent e)
  {
    IPerspective p = observerCenter_.getSelectedPerspective();
    if (p instanceof Perspective2D)
    {
      Perspective2D pers = (Perspective2D) p;
      pers.shiftPosition(direction.copy());
    }
  }
});
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Gets the shift of all objects.
 */
public IVector2 getObjectShift()
{
  return new Vector2Double(objShiftX_, objShiftY_);
}
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

  public void run()
  {
    areaSize_ = new Vector2Double(areaSize);
    setSize(areaSize.copy());
    if (preserveAR_)
    {
      setPosition(paddedSize_.copy().subtract(areaSize_).multiply(0.5).negate());
    }
  }
});
origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

public void mouseDragged(MouseEvent e)
{
  if (lastDragPos != null)
  {
    IVector2 position = (new Vector2Double(e.getX(), e.getY())).multiply(getPixelSize());
    IVector2 diff = position.copy().subtract(lastDragPos);
    if (getInvertX())
      diff.negateX();
    if (!getInvertY())
      diff.negateY();
    lastDragPos = position;
    setPosition(getPosition().copy().subtract(diff));
  }
}

origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

if(position==null)
  position = Vector2Double.getVector2((Double)getProperty(args, "x"),
    (Double)getProperty(args, "y"));
jadex.extension.envsupport.mathVector2Double

Javadoc

Implementation of a cartesian 2-vector using double components.

Most used methods

  • <init>
    Creates a new Vector2 with the same value as the input vector.
  • copy
  • divide
    Performs a division on the vector.
  • equals
  • getInnerProductAsDouble
  • getVector2
    Get a vector for two doubles.
  • getXAsDouble
  • getXAsFloat
  • getYAsDouble
  • getYAsFloat
  • multiply
  • negate
  • multiply,
  • negate,
  • setX,
  • setY

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSupportFragmentManager (FragmentActivity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • requestLocationUpdates (LocationManager)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now