//Вычитание двумерных векторов
 public override Vector2d subVec(AbstractVector <Vector2d> vec)
 {
     return(new Vector2d(
                this.getX() - vec.getX(),
                this.getY() - vec.getY()
                ));
 }
Exemple #2
0
 //Скалярное произведение трёхмерных векторов
 public override double scalarMultip(AbstractVector <Vector3d> vec)
 {
     return
         (this.getX() * vec.getX() +
          this.getY() * vec.getY() +
          this.getZ() * vec.getZ());
 }
Exemple #3
0
        //Векторное произведение трёхмерных векторов
        public override Vector3d vectorMultip(AbstractVector <Vector3d> vec)
        {
            double newX = this.getY() * vec.getZ() - this.getZ() * vec.getY();
            double newY = -(this.getX() * vec.getZ() - this.getZ() * vec.getX());
            double newZ = this.getX() * vec.getY() - this.getY() * vec.getX();

            return(new Vector3d(newX, newY, newZ));
        }
Exemple #4
0
 //Сложение трёхмерных векторов
 public override Vector3d addVec(AbstractVector <Vector3d> vec)
 {
     return(new Vector3d(
                this.getX() + vec.getX(),
                this.getY() + vec.getY(),
                this.getZ() + vec.getZ()
                ));
 }
 //Исключение нереализованного vectorMultip()
 public override Vector2d vectorMultip(AbstractVector <Vector2d> vec)
 {
     throw new NotImplementedException();
 }
 //Скалярное произведение двумерных векторов
 public override double scalarMultip(AbstractVector <Vector2d> vec)
 {
     return(x * vec.getX() + y * vec.getY());
 }