summaryrefslogtreecommitdiff
path: root/src/tesseract/forces/Force.java
blob: 23a11952afef1cbd64da919a592c570ed1f640b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package tesseract.forces;

import javax.vecmath.Vector3f;

import tesseract.objects.PhysicalObject;

/**
 * Abstract Force class.
 * 
 * @author Jesse Morgan
 */
public abstract class Force {

	/**
	 * Calculate the force to apply to the give object.
	 * @param obj The given object.
	 * @return A vector describing the force.
	 */
	protected abstract Vector3f calculateForce(final PhysicalObject obj);
	
	/**
	 * Apply this force to the given object.
	 * 
	 * @param obj The given object.
	 */
	public void applyForceTo(final PhysicalObject obj) {
		obj.addForce(calculateForce(obj));
	}
}