Documentation ¶
Index ¶
- Constants
- func Curvature(mot Motion, t float64) float64
- func Frenet(mot Motion, t float64) maf.Basis
- func NumericalAccel(mot Velocityer, t float64) maf.Vec
- func NumericalAcceleration(mot Displacementer, t float64) maf.Vec
- func NumericalVelocity(mot Displacementer, t float64) maf.Vec
- type Archimedean
- type Circular
- type Components
- type Displacementer
- type Helical
- type Motion
- type Particle
- type Projectile
- type ProjectileTargeter
- type RollingWheel
- type RollingWheelParticle
- func (mot RollingWheelParticle) Acceleration(t float64) maf.Vec
- func (mot RollingWheelParticle) Accelerations(t float64) Components
- func (mot RollingWheelParticle) Displacement(t float64) maf.Vec
- func (mot RollingWheelParticle) Velocities(t float64) Components
- func (mot RollingWheelParticle) Velocity(t float64) maf.Vec
- type Velocityer
Constants ¶
const G = -9.80665
G is an approximation of the acceleration due to gravity on the Earth's surface, measured in m/s².
Variables ¶
This section is empty.
Functions ¶
func Curvature ¶
Curvature is the magnitude of the curvature for the trace of the motion at the given parameter value.
func Frenet ¶
Frenet frame at the given parameter value on the trace of the given motion.
The returned orthonormal basis has the X-axis as the velocity, the Y-axis as the normal, and the Z-axis as the binormal, at t.
func NumericalAccel ¶
func NumericalAccel(mot Velocityer, t float64) maf.Vec
NumericalAccel is a rough approximation of the given motion's acceleration at the given parameter value.
func NumericalAcceleration ¶
func NumericalAcceleration(mot Displacementer, t float64) maf.Vec
NumericalAcceleration is a very rough approximation of the given motion's acceleration at the given parameter value.
func NumericalVelocity ¶
func NumericalVelocity(mot Displacementer, t float64) maf.Vec
NumericalVelocity is a rough approximation of the given motion's velocity at the given parameter value.
Types ¶
type Archimedean ¶
type Archimedean struct { // Initial displacement from the origin along the positive X-axis. D float64 // The magnitude of the constant radial speed component of the particle's // motion. V float64 // The magnitude of the constant angular velocity component of the // particle's motion (measured in radians per time unit). W float64 }
Archimedean is the spiral motion of a particle moving along a radial path on a rotating turntable.
The particle moves outwards from the centre and the turntable rotates anticlockwise around the Z-axis with the radial line starting at the positive X-axis.
func (Archimedean) Acceleration ¶
func (mot Archimedean) Acceleration(t float64) maf.Vec
Acceleration of the motion at the given motion parameter.
func (Archimedean) Displacement ¶
func (mot Archimedean) Displacement(t float64) maf.Vec
Displacement of the motion from the origin at the given motion parameter.
type Circular ¶
type Circular struct { // The radius of the circular motion. R float64 // The constant angular velocity of the circular motion measured in radians // per unit time. W float64 }
Circular is a uniform circular motion.
The particle starts on the positive X-axis and is constrained to the XY-plane.
func (Circular) Acceleration ¶
Acceleration of the motion at the given motion parameter.
func (Circular) Displacement ¶
Displacement of the motion from the origin at the given motion parameter.
type Components ¶
Components of a vector property of a rigid bodies motion.
type Displacementer ¶
A Displacementer is a motion with a known displacement at a given parameter value.
type Helical ¶
type Helical struct { // The pitch of the helix, that is, the distance travelled along the Z-axis // in one complete helix turn. P float64 // The radius of the circular motion in the XY plane. R float64 // The constant angular velocity of the circular motion in the XY plane // measured in radians per unit time. W float64 }
Helical is the helical motion of a particle moving along a circular path on a rising platform.
func (Helical) Acceleration ¶
Acceleration of the motion at the given motion parameter.
func (Helical) Displacement ¶
Displacement of the motion from the origin at the given motion parameter.
type Motion ¶
type Motion interface { Displacement(t float64) maf.Vec Velocity(t float64) maf.Vec Acceleration(t float64) maf.Vec }
A Motion of a particle.
type Particle ¶
type Particle struct { // The fixed angular displacement of the particle measured from some // reference position. Angle float64 // The fixed perpendicular distance of the particle from the rotation axis. Distance float64 }
A Particle of a rigid body.
type Projectile ¶
type Projectile struct { // The acceleration. A positive acceleration is in the direction of the // positive Y-axis. A float64 // The initial velocity. U maf.Vec }
Projectile motion constrained to the XY-plane and starting at the origin and subject to a constant acceleration parallel to the Y-axis.
func (Projectile) Acceleration ¶
func (mot Projectile) Acceleration(t float64) maf.Vec
Acceleration of the motion at the given motion parameter.
func (Projectile) Displacement ¶
func (mot Projectile) Displacement(t float64) maf.Vec
Displacement of the motion from the origin at the given motion parameter.
func (Projectile) LaunchAngle ¶
func (mot Projectile) LaunchAngle() float64
LaunchAngle of the projectile.
func (Projectile) TurningPoint ¶
func (mot Projectile) TurningPoint() maf.Vec
TurningPoint is the position in the trace of the motion at which the projectile changes direction.
The motion's acceleration shall be non zero.
type ProjectileTargeter ¶
type ProjectileTargeter struct { // The acceleration. A positive acceleration is in the direction of the // positive Y-axis. A float64 // The target to hit with a projectile launched from the origin. Shall not // coincide with the origin. Target maf.Vec }
ProjectileTargeter finds projectile motions which are launched from the origin and that will hit a target in the XY-plane.
func (ProjectileTargeter) FromLaunchAngle ¶
func (pt ProjectileTargeter) FromLaunchAngle(la float64) (Projectile, bool)
FromLaunchAngle fixes the projectile's launch angle, measured in radians, and attempts to find a solution.
The launch angle shall be confined to the range -Pi/2...Pi/2 which is relative to the positive or negative X-axis as appropriate.
If the returned bool value is false then there is no solution.
Special cases
In the special case where all of the following three conditions apply
- the target is vertically above or below the origin
- the launch angle is +Pi/2 or -Pi/2 respectively
- the acceleration direction is down or up respectively
then, of the infinite number of projectile solutions, the one chosen is that where the peak of the projectile's motion coincides with the target.
In the special case where all of the following three conditions apply
- the target is vertically above or below the origin
- the launch angle is -Pi/2 or +Pi/2 respectively
- the acceleration direction is up or down respectively
then, it suffices to simply let the projectile fall under the motion's acceleration and the initial velocity of the returned projectile is zero.
func (ProjectileTargeter) FromSpeed ¶
func (pt ProjectileTargeter) FromSpeed(u float64) ( Projectile, Projectile, int, )
FromSpeed fixes the projectile's initial positive speed and attempts to find a solution.
The int return value is the number of found projectiles, either 0, 1, or 2, that coincide with the target and have the argument initial speed.
In the case of two found projectiles with the target's X !~= 0 then the first of the returned projectiles launches closer to the +/- X-axis.
In the case of two found projectiles, with the target's X ~= 0 and the acceleration and target displacement vectors in the same direction, the first of the returned projectiles will have the shortest time of flight to the target.
type RollingWheel ¶
type RollingWheel struct { // Wheel radius. R float64 // Wheel angular velocity. Clockwise (as in moving right) is positive. W float64 }
RollingWheel is the rolling motion of a non-slipping wheel rolling at constant velocity along the positive X-axis.
func (RollingWheel) Motion ¶
func (rw RollingWheel) Motion(p Particle) RollingWheelParticle
Motion of the given particle on the receiver rolling wheel.
The particle's angle is the initial clockwise angular displacement from the wheel radius which emits from the centre in the positive Y-axis direction.
type RollingWheelParticle ¶
type RollingWheelParticle struct {
// contains filtered or unexported fields
}
RollingWheelParticle is the motion of a particle on a rolling wheel.
func (RollingWheelParticle) Acceleration ¶
func (mot RollingWheelParticle) Acceleration(t float64) maf.Vec
Acceleration of the motion at the given motion parameter.
func (RollingWheelParticle) Accelerations ¶
func (mot RollingWheelParticle) Accelerations(t float64) Components
Accelerations of the motion at the given motion parameter.
func (RollingWheelParticle) Displacement ¶
func (mot RollingWheelParticle) Displacement(t float64) maf.Vec
Displacement of the motion from the origin at the given motion parameter.
func (RollingWheelParticle) Velocities ¶
func (mot RollingWheelParticle) Velocities(t float64) Components
Velocities of the motion at the given motion parameter.
type Velocityer ¶
A Velocityer is a motion with a known velocity at a given parameter value.