KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > JSci > physics > ConstantTorque3D


1 package JSci.physics;
2
3 /**
4 * The ConstantTorque3D class provides an object for encapsulating constant torques in 3D.
5 * @version 1.0
6 * @author Mark Hale
7 */

8 public class ConstantTorque3D extends Torque3D {
9         protected final double Tx, Ty, Tz;
10         /**
11         * Constructs a torque.
12         */

13         public ConstantTorque3D(double wx, double wy, double wz) {
14                 Tx = wx;
15                 Ty = wy;
16                 Tz = wz;
17         }
18         /**
19         * Returns the addition of this torque and another.
20         */

21         public Torque3D add(ConstantTorque3D T) {
22                 return new ConstantTorque3D(Tx+T.Tx, Ty+T.Ty, Tz+T.Tz);
23         }
24         /**
25         * Returns the subtraction of this torque by another.
26         */

27         public Torque3D subtract(ConstantTorque3D T) {
28                 return new ConstantTorque3D(Tx-T.Tx, Ty-T.Ty, Tz-T.Tz);
29         }
30         public double getXComponent(double t) {
31                 return Tx;
32         }
33         public double getYComponent(double t) {
34                 return Ty;
35         }
36         public double getZComponent(double t) {
37                 return Tz;
38         }
39 }
40
41
Popular Tags