Newer
Older
CactusServer / src / main / java / org / ntlab / radishforandroidstudio / framework / physics / Force3D.java
r-isitani on 14 Jun 2018 621 bytes android版のradishのframeWorkを入れた.
package org.ntlab.radishforandroidstudio.framework.physics;
import org.ntlab.radishforandroidstudio.java3d.Vector3d;


public class Force3D {
	double x;
	double y;
	double z;
	public static final Force3D ZERO = new Force3D( 0.0, 0.0, 0.0);
	
	public Force3D(double x,double y,double z){
		this.x = x;
		this.y = y;
		this.z = z;
	}
	
	public Force3D(Vector3d v) {
		this.x = v.x;
		this.y = v.y;
		this.z = v.z;
	}
	public Vector3d getVector3d(){
		return new Vector3d(x,y,z);
	}

	public void add(Force3D f) {
		x += f.x;
		y += f.y;
		z += f.z;
	}
	
	public double getSeverity() {
		return getVector3d().length();
	}
}