-
Notifications
You must be signed in to change notification settings - Fork 4
Physics Object Base
Stuart Aitken edited this page Jun 15, 2020
·
5 revisions
Source: PhysicsObjectBase.cs
namespace: UniversityPhysics.PhysicsObjects
double Mass { get; set; }
double Charge { get; set; }
double TotalEnergy { get; }
Vector Position { get; set; }
Vector Velocity { get; set; }
Vector Acceleration { get; set; }
Vector Rotation { get; set; }
Vector RotationalAceleration { get; set; }
Vector Momentum { get; }
Vector KineticEnergy { get; }PhysicsBaseObject is an abstract class.
void Accelerate(Vector acceleration, double timeDelta)Updates velocity via suvat equation v = u + at
returns: void
Particle p = new Particle(mass: 1)
{
Velocity = new Vector(1, 1, 1)
};
Vector acceleration = new Vector(1, 0, 0);
//Accelerate for 5 seconds
p.Accelerate(acceleration, timeDelta: 5);
// ===> p.Velocity = Vector(6, 1, 1)void Move(double timeDelta)Updates Position via suvat equation s = ut + 1/2 at^2
If the Acceleration property of the object is non-zero, this will be taken into account
returns: void
Particle p = new Particle(mass: 1)
{
Position = new Vector(0, 0, 0),
Velocity = new Vector(1, 1, 1),
Acceleration = new Vector(1, 0, 0)
};
//Move for 5 seconds
p.Move(timeDelta: 5);
// ===> p.Position = Vector(17.5, 5, 5)void AddForce_Translational(Vector force)Applies a constant external force to the object.
This results in an update of the Acceleration property, via F=ma.
returns: void
Particle p = new Particle(mass: 10)
{
Acceleration = new Vector(1,1,1)
};
Vector externalForce = new Vector(5, 5, 5);
//Apply constant force
p.AddForce_Translational(externalForce);
// ===> p.Acceleration = Vector(1.5, 1.5, 1.5)void RotationPeriod(Axis_Cartesian axis, TimeMeasure timeMeasure = TimeMeasure.Second)Gives the time to complete one full rotation about the given axis.
Returns a time value in the desired format, as specified by the timeMeasure parameter
returns: double
GravitationalBody Earth = BasicAstrophysics.Earth;
//get period in hours
double period = Earth.RotationPeriod(Axis_Cartesian.Z, TimeMeasure.Hour);
// ===> period = 24Returns a string representation of the object
returns: string
Particle p = new Particle(mass: 12)
{
Acceleration = new Vector(1, 2, 3),
Velocity = new Vector(0, 0, 4),
Charge = -3,
};
string s = p.ToString();
// s =
// Mass ---------- 12 ( kg )
// Position ---------- X: 0, Y: 0, Z: 0
// Velocity ---------- X: 0, Y: 0, Z: 4 ( m/s )
// Momentum ---------- X: 0, Y: 0, Z: 48 ( kg m/s )
// Acceleration ---------- X: 1, Y: 2, Z: 3 ( m/s^2 )
// Charge ---------- -3 ( As )
// Kinetic Energy ---------- X: 0, Y: 0, Z: 96 ( J )
// Total Kinetic Energy ---------- 96 ( J )