constraint(s)


    
    function ConstraintY(pointMass, y, shortConst, longConst)
    {
      this.pointMass = pointMass; 
      this.y = y; 
      this.delta = new Vector(0.0, 0.0);
      this.shortConst = shortConst; 
      this.longConst = longConst;  
      
      this.sc = function()
      {      
        var dist; 
        
        dist = Math.abs(this.pointMass.getYPos() - this.y);
        this.delta.setY(-dist); 
         
        if(this.shortConst != 0.0 && dist < this.shortConst)
        {
          var scaleFactor; 
          
          scaleFactor = this.shortConst / dist; 
          this.delta.scale(scaleFactor); 
          pointMass.getPos().sub(this.delta); 
        } 
        else if(this.longConst != 0.0 && dist > this.longConst)
        {
          var scaleFactor; 
          
          scaleFactor = this.longConst / dist; 
          this.delta.scale(scaleFactor); 
          pointMass.getPos().sub(this.delta); 
        }
      } 
    }