/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tileworld.agent;
import sim.app.woims.Vector2D;

/**
 *
 * @author Jakub
 */
public class O {
      //vector operations
  /*  Random rnd;

    public Ops(int randomSeed) {
        this.rnd = new Random(randomSeed);
    }*/
    
    public static Vector2D vA (Vector2D v1, Vector2D v2){
        return v1.add(v2);
    }
    

    
    public static Vector2D sP (int sc, Vector2D v){
        return v.amplify(sc);
    }
    
    public static Vector2D rot (Vector2D v){
        return new Vector2D(-v.y, v.x);
    }
    
    public static Vector2D sP (double sc, Vector2D v){
        return v.amplify(sc);
    }
    
     public static double dP (Vector2D v1, Vector2D v2){
        return v1.x*v2.x+v1.y*v2.y;
    }
     
     public static Vector2D rV (){
        return new Vector2D((Math.random()-0.5)*2,(Math.random()-0.5)*2);
    }
     
     public static double rS(){
        return Math.random()*5;
    }
     
    /*  public Vector2D randV (){        
        return new Vector2D((rnd.nextDouble()-0.5)*2,(rnd.nextDouble()-0.5)*2);
    }
     
     public double randS(){
        return rnd.nextDouble()*5;
    }*/
    
    public static double n (Vector2D v){
        return v.length();
    }
    
    public static double getVectorAngle (Vector2D v){
        return Math.atan2(v.y, v.x);
        
    }
    
    public static Vector2D bT(double a, double b, Vector2D v1, Vector2D v2) {
        if( a>=b) { 
             return v1; 
         } 
         else {
             return v2;
         }
         
    }
    
    public static Vector2D iZ(Vector2D a, Vector2D v1, Vector2D v2) { //if zero
        if( a.x==0 && a.y==0) { 
             return v1; 
         } 
         else {
             return v2;
         }
         
    }
    
    public static double bTS(double a, double b, double c, double d) {
        if( a>=b) { 
             return c; 
         } 
         else {
             return d;
         }
         
    }
    
    public static double sA(double a, double b){ //scalar add
        return a+b;
    }
    
    public static double t(double a, double b){
        return a*b;
    }
}
