All pastes #13141 Raw Edit

Anonymous

public java v1 · immutable
#13141 ·published 2005-06-01 21:58 UTC
rendered paste body
/* Vektoren.java*/public class Vektoren{		public double x;	public double y;	public double z;		Vektoren()	{		x = 0.0;		y = 0.0;		z = 0.0;	}		public Vektoren(double x, double y, double z)	{		this.x = x;		this.y = y;		this.z = z;	}		public Vektoren addition(Vektoren a, Vektoren b)	{		this.x = a.x+b.x;		this.y = a.y+b.y;		this.z = a.z+b.z;				return this;	}		public Vektoren subtraktion(Vektoren a, Vektoren b)	{			this.x = a.x-b.x;		this.y = a.y-b.y;		this.z = a.z-b.z;				return this;	}		public double laenge(Vektoren a)	{		double laenge = 0;			laenge = Math.sqrt(Math.pow(a.x, 2) + Math.pow(a.y, 2) + Math.pow(a.z, 2));			return laenge;		}		public double skalar(Vektoren a, Vektoren b)	{		double skalarprodukt = 0;				skalarprodukt = skalarprodukt + a.x * b.x;		skalarprodukt = skalarprodukt + a.y * b.y;		skalarprodukt = skalarprodukt + a.z * b.z;		return skalarprodukt;	}		public Vektoren kreuz(Vektoren a, Vektoren b)	{		this.x = a.y * b.z - a.z * b.y;			this.y = a.z * b.x - a.x * b.z;		this.z = a.x * b.y - a.y * b.x;		return this; 	}		public Vektoren norm(Vektoren a, double b)	{		this.x = a.x/b;				this.y = a.y/b;		this.z = a.z/b;		return this;		}