<!DOCTYPE html>Software Requirements Specification for Chipmunk2D

Software Requirements Specification for Chipmunk2D

Alex Halliwushka and Luthfi Mawarid

Reference Material

This section records information for easy reference.

Table of Units

The unit system used throughout is SI (Système International d'Unités). In addition to the basic units, several derived units are also used. For each unit, Tab: ToU lists the symbol, a description and the SI name.

SymbolDescriptionSI Name
Jenergyjoule
kgmasskilogram
mlengthmetre
Nforcenewton
radangleradian
stimesecond

Table of Symbols

The symbols used in this document are summarized in Tab: ToS along with their units. Throughout the document, symbols in bold will represent vectors, and scalars otherwise. The symbols are listed in alphabetical order. For vector quantities, the units shown are for each component of the vector.

SymbolDescriptionUnits
aAccelerationm/s2
a(t)Linear Accelerationm/s2
aiThe I-Th Body's Accelerationm/s2
CRCoefficient of restitution--
FForceN
F1Force exerted by the first body (on another body)N
F2Force exerted by the second body (on another body)N
FiForce Applied to the I-Th Body at Time TN
GGravitational constantm3/(kg⋅s2)
gGravitational accelerationm/s2
hHeightm
IMoment of inertiakg⋅m2
IAMoment of Inertia Of Rigid Body Akg⋅m2
IBMoment of Inertia Of Rigid Body Bkg⋅m2
JImpulse (vector)N⋅s
jImpulse (scalar)N⋅s
KEKinetic energyJ
LLengthm
MTotal Mass of the Rigid Bodykg
mMasskg
m1Mass of the first bodykg
m2Mass of the second bodykg
mAMass Of Rigid Body Akg
mBMass Of Rigid Body Bkg
mjMass Of the J-Th Particlekg
nCollision Normal Vectorm
PEPotential energyJ
pPositionm
pCMCenter of Massm
pjPosition Vector of the J-Th Particlem
rjDistance Between the J-Th Particle and the Axis of Rotationm
rDisplacementm
r(t)Linear Displacementm
rOBDisplacement vector between the origin and point Bm
Displacement unit vectorm
tTimes
tcDenotes the time at collisions
vVelocitym/s
ΔvChange in velocitym/s
v(t)Linear Velocitym/s
vAPVelocity Of the Point of Collision P in Body Am/s
vBPVelocity Of the Point of Collision P in Body Bm/s
v1Velocity Of the First Bodym/s
v2Velocity Of the Second Bodym/s
vAVelocity At Point Am/s
vBVelocity At Point Bm/s
vfABFinal Relative Velocity Between Rigid Bodies of A and Bm/s
viVelocity Of the I-Th Body's Velocitym/s
viABInitial Relative Velocity Between Rigid Bodies of A and Bm/s
vOVelocity At Point Originm/s
||n||Length of the Normal Vectorm
||r||Euclidean norm of the displacementm
||rAP*n||Length of the Perpendicular Vector To the Contact Displacement Vector of Rigid Body Am
||rBP*n||Length of the Perpendicular Vector To the Contact Displacement Vector of Rigid Body Bm
||r||2Squared distancem2
αAngular Accelerationrad/s2
θAngular Displacementrad
τTorqueN⋅m
τiTorque applied to the i-th bodyN⋅m
ωAngular Velocityrad/s
ϕOrientationrad

Abbreviations and Acronyms

AbbreviationFull Form
2DTwo-Dimensional
3DThree-Dimensional
AAssumption
CMCentre of Mass
Chipmunk2DChipmunk2D game physics library
DDData Definition
GDGeneral Definition
GSGoal Statement
IMInstance Model
LCLikely Change
ODEOrdinary Differential Equation
RRequirement
SRSSoftware Requirements Specification
TMTheoretical Model
UCUnlikely Change
Uncert.Typical Uncertainty

Introduction

Due to the rising cost of developing video games, developers are looking for ways to save time and money for their projects. Using an open source physics library that is reliable and free will cut down development costs and lead to better quality products.

The following section provides an overview of the Software Requirements Specification (SRS) for Chipmunk2D. This section explains the purpose of this document, the scope of the system, the characteristics of the intended reader, and the organization of the document.

Purpose of Document

This document describes the modeling of an open source 2D rigid body physics library used for games. The theoretical models and goal statements used in Chipmunk2D are provided. This document is intended to be used as a reference to provide all necessary information to understand and verify the model.

This document will be used as a starting point for subsequent development phases, including writing the design specification and the software verification and validation plan. The design document will show how the requirements are to be realized, including decisions on the numerical algorithms and programming environment. The verification and validation plan will show the steps that will be used to increase confidence in the software documentation and the implementation. Although the SRS fits in a series of documents that follow the so-called waterfall model, the actual development process is not constrained in any way. Even when the waterfall model is not followed, as Parnas and Clements point out parnasClements1986, the most logical way to present the documentation is still to "fake" a rational design process.

Scope of Requirements

The scope of the requirements includes the physical simulation of 2D rigid bodies acted on by forces.

Characteristics of Intended Reader

Reviewers of this documentation should have an understanding of rigid body dynamics and high school calculus. The users of Chipmunk2D can have a lower level of expertise, as explained in Section: User Characteristics.

Organization of Document

The organization of this document follows the template for an SRS for scientific computing software proposed by dParnas1972 and parnasClements1984. The presentation follows the standard pattern of presenting goals, theories, definitions, and assumptions. For readers that would like a more bottom up approach, they can start reading the instance models in Section: Instance Models and trace back to find any additional information they require.

The goal statements (Section: Goal Statements) are refined to the theoretical models and the theoretical models (Section: Theoretical Models) to the instance models (Section: Instance Models).

General System Description

This section provides general information about the system. It identifies the interfaces between the system and its environment, describes the user characteristics, and lists the system constraints.

System Context

Fig:sysCtxDiag shows the system context. A circle represents an external entity outside the software, the user in this case. A rectangle represents the software system itself (Chipmunk2D). Arrows are used to show the data flow between the system and its environment.

System Context

The interaction between the product and the user is through an application programming interface. The responsibilities of the user and the system are as follows:

  • User Responsibilities
    • Provide initial conditions of the physical state of the simulation, rigid bodies present, and forces applied to them.
    • Ensure application programming interface use complies with the user guide.
    • Ensure required software assumptions (FIXME REF) are appropriate for any particular problem the software addresses.
  • Chipmunk2D Responsibilities
    • Determine if the inputs and simulation state satisfy the required physical and system constraints (FIXME REF).
    • Calculate the new state of all rigid bodies within the simulation at each simulation step.
    • Provide updated physical state of all rigid bodies at the end of a simulation step.

User Characteristics

The end user of Chipmunk2D should have an understanding of first year programming concepts and an understanding of high school physics.

System Constraints

There are no system constraints.

Specific System Description

This section first presents the problem description, which gives a high-level view of the problem to be solved. This is followed by the solution characteristics specification, which presents the assumptions, theories, and definitions that are used.

Problem Description

A system is needed to create a simple, lightweight, fast, and portable 2D rigid body physics library, which will allow for more accessible game development and the production of higher quality products. Creating a gaming physics library is a difficult task. Games need physics libraries that simulate objects acting under various physical conditions, while simultaneously being fast and efficient enough to work in soft real-time during the game. Developing a physics library from scratch takes a long period of time and is very costly, presenting barriers of entry which make it difficult for game developers to include physics in their products. There are a few free, open source and high quality physics libraries available to be used for consumer products (Section: Off-The-Shelf Solutions).

Terminology and Definitions

This subsection provides a list of terms that are used in the subsequent sections and their meaning, with the purpose of reducing ambiguity and making it easier to correctly understand the requirements.

  • Rigid body: A solid body in which deformation is neglected.
  • Elasticity: Ratio of the relative velocities of two colliding objects after and before a collision.
  • Centre of mass: The mean location of the distribution of mass of the object.
  • Cartesian coordinate system: A coordinate system that specifies each point uniquely in a plane by a set of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured in the same unit of length (from cartesianWiki).
  • Right-handed coordinate system: A coordinate system where the positive z-axis comes out of the screen.

Goal Statements

Given the kinematic properties, and forces including any (collision forces) applied on a set of rigid bodies, the goal statements are:

Determine-Linear-Properties: Determine their new positions and velocities over a period of time.

Determine-Angular-Properties: Determine their new orientations and angular velocities over a period of time.

Solution Characteristics Specification

The instance models that govern Chipmunk2D are presented in Section: Instance Models. The information to understand the meaning of the instance models and their derivation is also presented, so that the instance models can be verified.

Assumptions

This section simplifies the original problem and helps in developing the theoretical models by filling in the missing information for the physical system. The assumptions refine the scope by providing more detail.

coordinateSystemTy: The library uses a Cartesian coordinate system.

axesDefined: The axes are defined using right-handed coordinate system. (RefBy: IM: rotMot, DD: impulse, and IM: col2D.)

collisionType: All rigid bodies collisions are vertex-to-edge collisions. (RefBy: LC: Expanded-Collisions, DD: impulse, and IM: col2D.)

dampingInvolvement: There is no damping involved throughout the simulation and this implies that there are no friction forces. (RefBy: DD: chalses, IM: transMot, IM: rotMot, DD: potEnergy, DD: linVel, DD: linDisp, DD: linAcc, LC: Include-Dampening, DD: kEnergy, IM: col2D, DD: angVel, DD: angDisp, and DD: angAccel.)

constraintsAndJointsInvolvement: There are no constraints and joints involved throughout the simulation. (RefBy: IM: transMot, IM: rotMot, LC: Include-Joints-Constraints, and IM: col2D.)

Theoretical Models

This section focuses on the general equations and laws that Chipmunk2D is based on.

RefnameTM:NewtonSecLawMot
Label

Newton's second law of motion

Equation
F = m a
Description
  • F is the force (N)
  • m is the mass (kg)
  • a is the acceleration (m/s2)
Notes

The net force F (N) on a body is proportional to the acceleration a (m/s2) of the body, where m (kg) denotes the mass of the body as the constant of proportionality.

Source

--

RefBy

RefnameTM:NewtonThirdLawMot
Label

Newton's third law of motion

Equation
F1 = −F2
Description
  • F1 is the force exerted by the first body (on another body) (N)
  • F2 is the force exerted by the second body (on another body) (N)
Notes

Every action has an equal and opposite reaction. In other words, the force F1 (N) exerted on the second rigid body by the first is equal in magnitude and in the opposite direction to the force F2 (N) exerted on the first rigid body by the second.

Source

--

RefBy

RefnameTM:UniversalGravLaw
Label

Newton's law of universal gravitation

Equation
F = G 
m1 m2||r||2
= G 
m1 m2||r||2
r||r||
Description
  • F is the force (N)
  • G is the gravitational constant (m3/(kg⋅s2))
  • m1 is the mass of the first body (kg)
  • m2 is the mass of the second body (kg)
  • ||r|| is the Euclidean norm of the displacement (m)
  • is the displacement unit vector (m)
  • r is the displacement (m)
Notes

Two rigid bodies in the universe attract each other with a force F (N) that is directly proportional to the product of their masses, m1 and m2 (kg), and inversely proportional to the squared distance ||r||2 (m2) between them. The vector r (m) is the displacement between the centres of the rigid bodies and ||r|| (m) represents the Euclidean norm of the displacement, or absolute distance between the two. denotes the displacement unit vector, equivalent to the displacement divided by the Euclidean norm of the displacement, as shown above. Finally, G is the gravitational constant (6.673 * 10E-11) (m3/(kg⋅s2)).

Source

--

RefBy

RefnameTM:ChaslesThm
Label

Chasles' theorem

Equation
vB = vO&plusω⨯rOB
Description
  • vB is the velocity at point B (m/s)
  • vO is the velocity at point origin (m/s)
  • ω is the angular velocity (rad/s)
  • rOB is the displacement vector between the origin and point B (m)
Notes

The linear velocity vB (m/s) of any point B in a rigid body A: objectTy is the sum of the linear velocity vO (m/s) of the rigid body at the origin (axis of rotation) and the resultant vector from the cross product of the rigid body's angular velocity ω (rad/s) and the displacement vector between the origin and point B, rOB (m).

Source

--

RefBy

RefnameTM:NewtonSecLawRotMot
Label

Newton's second law for rotational motion

Equation
τ = I α
Description
  • τ is the torque (N⋅m)
  • I is the moment of inertia (kg⋅m2)
  • α is the angular acceleration (rad/s2)
Notes

The net torque τ (N⋅m) on a rigid body is proportional to its angular acceleration α (rad/s2). Here, I (kg⋅m2) denotes the moment of inertia of the rigid body. We also assume that all rigid bodies involved are two-dimensional A: objectDimension.

Source

--

RefBy

General Definitions

There are no general definitions.

Data Definitions

This section collects and defines all the data needed to build the instance models.

RefnameDD:ctrOfMass
Label

Center of Mass

Symbol

pCM

Units

m

Equation
pCM =
∑mjpjM
Description
  • pCM is the Center of Mass (m)
  • mj is the mass of the j-th particle (kg)
  • pj is the position vector of the j-th particle (m)
  • M is the total mass of the rigid body (kg)
Notes

A: objectTy

A: objectDimension

Source

--

RefBy

IM: transMot and IM: col2D

RefnameDD:linDisp
Label

Linear Displacement

Symbol

r(t)

Units

m

Equation
r(t) =
 dp(t) dt
Description
  • r(t) is the linear displacement (m)
  • t is the time (s)
  • p is the position (m)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: transMot

RefnameDD:linVel
Label

Linear Velocity

Symbol

v(t)

Units

m/s

Equation
v(t) =
 dr(t) dt
Description
  • v(t) is the linear velocity (m/s)
  • t is the time (s)
  • r is the displacement (m)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: transMot

RefnameDD:linAcc
Label

Linear Acceleration

Symbol

a(t)

Units

m/s2

Equation
a(t) =
 dv(t) dt
Description
  • a(t) is the linear acceleration (m/s2)
  • t is the time (s)
  • v is the velocity (m/s)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: transMot

RefnameDD:angDisp
Label

Angular Displacement

Symbol

θ

Units

rad

Equation
θ =
 dϕ(t) dt
Description
  • θ is the angular displacement (rad)
  • t is the time (s)
  • ϕ is the orientation (rad)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: rotMot

RefnameDD:angVel
Label

Angular Velocity

Symbol

ω

Units

rad/s

Equation
ω =
 dθ(t) dt
Description
  • ω is the angular velocity (rad/s)
  • t is the time (s)
  • θ is the angular displacement (rad)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: rotMot

RefnameDD:angAccel
Label

Angular Acceleration

Symbol

α

Units

rad/s2

Equation
α =
 dω(t) dt
Description
  • α is the angular acceleration (rad/s2)
  • t is the time (s)
  • ω is the angular velocity (rad/s)
Notes

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

IM: rotMot

RefnameDD:impulse
Label

Impulse (scalar)

Symbol

j

Units

N⋅s

Equation
j =
−(1&plusCR) viABn(
1mA
&plus
1mB
) ||n||2&plus
||rAP*n||2IA
&plus
||rBP*n||2IB
Description
  • j is the impulse (scalar) (N⋅s)
  • CR is the coefficient of restitution (Unitless)
  • viAB is the initial relative velocity between rigid bodies of A and B (m/s)
  • n is the collision normal vector (m)
  • mA is the mass of rigid body A (kg)
  • mB is the mass of rigid body B (kg)
  • ||n|| is the length of the normal vector (m)
  • ||rAP*n|| is the length of the perpendicular vector to the contact displacement vector of rigid body A (m)
  • IA is the moment of inertia of rigid body A (kg⋅m2)
  • ||rBP*n|| is the length of the perpendicular vector to the contact displacement vector of rigid body B (m)
  • IB is the moment of inertia of rigid body B (kg⋅m2)
Notes

A: objectTy

A: objectDimension

A: axesDefined

A: collisionType

Source

--

RefBy

IM: col2D

RefnameDD:chalses
Label

Velocity At Point B

Symbol

vB

Units

m/s

Equation
vB = vO&plusω⨯rOB
Description
  • vB is the velocity at point B (m/s)
  • vO is the velocity at point origin (m/s)
  • ω is the angular velocity (rad/s)
  • rOB is the displacement vector between the origin and point B (m)
Notes

The linear velocity vB (m/s) of any point B in a rigid body A: objectTy is the sum of the linear velocity vO (m/s) of the rigid body at the origin (axis of rotation) and the resultant vector from the cross product of the rigid body's angular velocity ω (rad/s) and the displacement vector between the origin and point B, rOB (m).

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

RefnameDD:torque
Label

Torque

Symbol

τ

Units

N⋅m

Equation
τ = rF
Description
  • τ is the torque (N⋅m)
  • r is the displacement (m)
  • F is the force (N)
Notes

The torque on a body measures the the tendency of a force to rotate the body around an axis or pivot.

Source

--

RefBy

RefnameDD:kEnergy
Label

Kinetic energy

Symbol

KE

Units

J

Equation
KE =
m v22
Description
  • KE is the kinetic energy (J)
  • m is the mass (kg)
  • v is the velocity (m/s)
Notes

The kinetic energy of an object is the energy it possess due to its motion.

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

RefnameDD:coeffRestitution
Label

Coefficient of restitution

Symbol

CR

Units

Unitless

Equation
CR = −(
vfABnviABn
)
Description
  • CR is the coefficient of restitution (Unitless)
  • vfAB is the final relative velocity between rigid bodies of A and B (m/s)
  • n is the collision normal vector (m)
  • viAB is the initial relative velocity between rigid bodies of A and B (m/s)
Notes

The coefficient of restitution CR is a unitless, dimensionless quantity that determines the elasticity of a collision between two rigid bodies. CR = 1 results in an elastic collision, while CR < 1 results in an inelastic collision, and CR = 0 results in a totally inelastic collision.

Source

--

RefBy

RefnameDD:reVeInColl
Label

Initial Relative Velocity Between Rigid Bodies of A and B

Symbol

viAB

Units

m/s

Equation
viAB = vAPvBP
Description
  • viAB is the initial relative velocity between rigid bodies of A and B (m/s)
  • vAP is the velocity of the point of collision P in body A (m/s)
  • vBP is the velocity of the point of collision P in body B (m/s)
Notes

In a collision, the velocity of a rigid body A: objectTy A colliding with another rigid body B relative to that body viAB is the difference between the velocities of A and B at point P.

Source

--

RefBy

RefnameDD:impulseV
Label

Impulse (vector)

Symbol

J

Units

N⋅s

Equation
J = m Δv
Description
  • J is the impulse (vector) (N⋅s)
  • m is the mass (kg)
  • Δv is the change in velocity (m/s)
Notes

An impulse (vector) J occurs when a force F acts over a body over an interval of time.

A: objectTy

Source

--

RefBy

Detailed derivation of impulse (vector):

Newton's second law of motion states:

F = m a = m 
 dv dt

Rearranging :

t1t2F dt = m (∫v1v21 dv)

Integrating the right hand side :

t1t2F dt = m v2−m v1 = m Δv
RefnameDD:potEnergy
Label

Potential energy

Symbol

PE

Units

J

Equation
PE = m g h
Description
  • PE is the potential energy (J)
  • m is the mass (kg)
  • g is the gravitational acceleration (m/s2)
  • h is the height (m)
Notes

The potential energy of an object is the energy held by an object because of its position to other objects.

A: objectTy

A: objectDimension

A: dampingInvolvement

Source

--

RefBy

RefnameDD:momentOfInertia
Label

Moment of inertia

Symbol

I

Units

kg⋅m2

Equation
I = ∑mj rj2
Description
  • I is the moment of inertia (kg⋅m2)
  • mj is the mass of the j-th particle (kg)
  • rj is the distance between the j-th particle and the axis of rotation (m)
Notes

The moment of inertia I of a body measures how much torque is needed for the body to achieve angular acceleration about the axis of rotation.

A: objectTy

Source

--

RefBy

Instance Models

This section transforms the problem defined in Section: Problem Description into one which is expressed in mathematical terms. It uses concrete symbols defined in Section: Data Definitions to replace the abstract symbols in the models identified in Section: Theoretical Models and Section: General Definitions.

The goal GS: Determine-Linear-Properties is met by IM: transMot and IM: col2D. The goal GS: Determine-Angular-Properties is met by IM: rotMot and IM: col2D.

RefnameIM:transMot
Label

Force on the translational motion of a set of 2d rigid bodies

Input

vi, t, g, Fi, mj

Output

ai

Input Constraints
vi > 0
t > 0
g > 0
Fi > 0
mj > 0
Output Constraints
Equation
ai =
 dvi(t) dt
= g&plus
Fi(t)mj
Description
  • ai is the the i-th body's acceleration (m/s2)
  • t is the time (s)
  • vi is the velocity of the i-th body's velocity (m/s)
  • g is the gravitational acceleration (m/s2)
  • Fi is the force applied to the i-th body at time t (N)
  • mj is the mass of the j-th particle (kg)
Notes

The above equation expresses the total acceleration of the rigid body A: objectTy A: objectDimension i as the sum of gravitational acceleration (GD3) and acceleration due to applied force Fi(t) (T1). The resultant outputs are then obtained from this equation using DD: linDisp DD: linVel DD: linAcc. It is currently assumed that there is no damping A: dampingInvolvement or constraints A: constraintsAndJointsInvolvement involved. DD: ctrOfMass.

Source

--

RefBy

RefnameIM:rotMot
Label

Force on the rotational motion of a set of 2D rigid body

Input

ω, t, τi, I

Output

α

Input Constraints
ω > 0
t > 0
τi > 0
I > 0
Output Constraints
α > 0
Equation
α =
 dω(t) dt
=
τi(t)I
Description
  • α is the angular acceleration (rad/s2)
  • t is the time (s)
  • ω is the angular velocity (rad/s)
  • τi is the torque applied to the i-th body (N⋅m)
  • I is the moment of inertia (kg⋅m2)
Notes

The above equation for the total angular acceleration of the rigid body A: objectTy A: objectDimension i is derived from T5, and the resultant outputs are then obtained from this equation using DD: angDisp DD: angVel DD: angAccel. It is currently assumed that there is no damping A: dampingInvolvement or constraints A: constraintsAndJointsInvolvement involved. A: axesDefined

Source

--

RefBy

RefnameIM:col2D
Label

Collisions on 2D rigid bodies

Input

t, j, mA, n

Output

tc

Input Constraints
t > 0
j > 0
mA > 0
n > 0
Output Constraints
vA > 0
tc > 0
Equation
vA(tc) = vA(t)&plus
jmA
n
Description
  • vA is the velocity at point A (m/s)
  • tc is the denotes the time at collision (s)
  • t is the time (s)
  • j is the impulse (scalar) (N⋅s)
  • mA is the mass of rigid body A (kg)
  • n is the collision normal vector (m)
Notes

This instance model is based on our assumptions regarding rigid body A: objectTy A: objectDimension collisions A: collisionType Again, this does not take damping A: dampingInvolvement or constraints A: constraintsAndJointsInvolvement into account. A: axesDefined. DD: ctrOfMass DD: impulse

Source

--

RefBy

Data Constraints

Table:InDataConstraints shows the data constraints on the input variables. The column for physical constraints gives the physical limitations on the range of values that can be taken by the variable. The uncertainty column provides an estimate of the confidence with which the physical quantities can be measured. This information would be part of the input if one were performing an uncertainty quantification exercise. The constraints are conservative, to give the user of the model the flexibility to experiment with unusual situations. The column of typical values is intended to provide a feel for a common scenario. FIXME

VarPhysical ConstraintsTypical ValueUncert.
CR0 ≤ CR ≤ 10.810%
F--98.1 N10%
G--9.8 m3/(kg⋅s2)10%
II ≥ 074.5 kg⋅m210%
LL ≥ 044.2 m10%
mm ≥ 056.2 kg10%
p--0.412 m10%
v--2.51 m/s10%
τ--200.0 N⋅m10%
ω--2.1 rad/s10%
ϕ--
π2
rad
10%

Input Data Constraints

Properties of a Correct Solution

Table:OutDataConstraints shows the data constraints on the output variables. The column for physical constraints gives the physical limitations on the range of values that can be taken by the variable.

Var
p
v
ϕ
ω

Output Data Constraints

Requirements

This section provides the functional requirements, the tasks and behaviours that the software is expected to complete, and the non-functional requirements, the qualities that the software is expected to exhibit.

Functional Requirements

This section provides the functional requirements, the tasks and behaviours that the software is expected to complete.

Simulation-Space: Create a space for all of the rigid bodies in the physical simulation to interact in.

Input-Initial-Conditions: Input the initial masses, velocities, orientations, angular velocities of, and forces applied on rigid bodies.

Input-Surface-Properties: Input the surface properties of the bodies such as friction or elasticity.

Verify-Physical_Constraints: Verify that the inputs satisfy the required physical constraints from Section: Solution Characteristics Specification.

Calculate-Translation-Over-Time: Determine the positions and velocities over a period of time of the 2D rigid bodies acted upon by a force.

Calculate-Rotation-Over-Time: Determine the orientations and angular velocities over a period of time of the 2D rigid bodies.

Determine-Collisions: Determine if any of the rigid bodies in the space have collided.

Determine-Collision-Response-Over-Time: Determine the positions and velocities over a period of time of the 2D rigid bodies that have undergone a collision.

Non-Functional Requirements

This section provides the non-functional requirements, the qualities that the software is expected to exhibit.

High-Performance: The code has a short reponse time when performing computation.

Correct: The outputs of the code have the properties described in Section: Properties of a Correct Solution.

Understandable: The code is modularized with complete module guide and module interface specification.

Portable: The code is able to be run in different environments.

Reliable: The code gives consistent outputs.

Reusable: The code is modularized.

Maintainable: The traceability between requirements, assumptions, theoretical models, general definitions, data definitions, instance models, likely changes, unlikely changes, and modules is completely recorded in traceability matrices in the SRS and module guide.

Likely Changes

This section lists the likely changes to be made to the software.

Variable-ODE-Solver: The internal ODE-solving algorithm used by the library may be changed in the future.

Expanded-Collisions: A: collisionType - The library may be expanded to deal with edge-to-edge and vertex-to-vertex collisions.

Include-Dampening: A: dampingInvolvement - The library may be expanded to include motion with damping.

Include-Joints-Constraints: A: constraintsAndJointsInvolvement - The library may be expanded to include joints and constraints.

Unlikely Changes

This section lists the unlikely changes to be made to the software.

Simulate-Rigid-Bodies: The goal of the system is to simulate the interactions of rigid bodies.

External-Input: There will always be a source of input data external to the software.

Cartesian-Coordinate-System: A Cartesian Coordinate system is used.

Objects-Rigid-Bodies: All objects are rigid bodies.

Off-The-Shelf Solutions

As mentioned in Section: Problem Description, there already exist free open source game physics libraries. Similar 2D physics libraries are:

  • Box2D: http://box2d.org/
  • Nape Physics Engine: http://napephys.com/

Free open source 3D game physics libraries include:

  • Bullet: http://bulletphysics.org/
  • Open Dynamics Engine: http://www.ode.org/
  • Newton Game Dynamics: http://newtondynamics.com/

Traceability Matrices and Graphs

The purpose of the traceability matrices is to provide easy references on what has to be additionally modified if a certain component is changed. Every time a component is changed, the items in the column of that component that are marked with an "X" should be modified as well. Table:TraceMatAvsAll shows the dependencies of data definitions, theoretical models, general definitions, instance models, requirements, likely changes, and unlikely changes on the assumptions. Table:TraceMatRefvsRef shows the dependencies of data definitions, theoretical models, general definitions, and instance models with each other. Table:TraceMatAllvsR shows the dependencies of requirements, goal statements on the data definitions, theoretical models, general definitions, and instance models.

Values of Auxiliary Constants

There are no auxiliary constants.

References

  • [1]: Bueche, J. Frederick. Introduction to Physics for Scientists, Fourth Edition. Mcgraw-Hill College, 1986.
  • [2]: Koothoor, Nirmitha. A document drive approach to certifying scientific computing software. McMaster University, Hamilton, ON, Canada: 2013. Print.
  • [3]: Parnas, David L. "On the Criteria To Be Used in Decomposing Systems into Modules." Communications of the ACM, 1972. pp. 1053–1058. Print.
  • [4]: Parnas, David L. "Designing Software for Ease of Extension and Contraction.." ICSE '78: Proceedings of the 3rd international conference on Software engineering. 1978. pp. 264–277.
  • [5]: Parnas, David L. and Clements, P. C. "A rational design process: How and why to fake it." IEEE Transactions on Software Engineering, vol. 12, no. 2, Washington, USA: February, 1986. pp. 251–257. Print.
  • [6]: Parnas, David L., Clements, P. C., and Wiess. "The Modular Structure of Complex Systems." ICSE '84: Proceedings of the 7th international conference on Software engineering. 1984. pp. 408–417.
  • [7]: Smith, W. Spencer and Lai, Lei. "A new requirements template for scientific computing." Proceedings of the First International Workshop on Situational Requirements Engineering Processes - Methods, Techniques and Tools to Support Situation-Specific Requirements Engineering Processes, SREP'05. Edited by PJ Agerfalk, N. Kraiem, and J. Ralyte, Paris, France: 2005. pp. 107–121. In conjunction with 13th IEEE International Requirements Engineering Conference,
  • [8]: Wikipedia Contributors. Cartesian coordinate system. June, 2019. https://en.wikipedia.org/wiki/Cartesian_coordinate_system.
  • [9]: Wilson, Greg, Aruliah, D. A., Titus, C., Chue Hong, Neil P., Davis, Matt, Guy, Richard T., Haddock, Steven H. D., Huff, Kathryn D., Mitchell, Ian M., Plumblet, Mark D., Waugh, Ben, White, Ethan P., and Wilson, Paul. "Best Practices for Scientific Computing, 2013." PLoS Biol, vol. 12, no. 1, 2013. Print.


In [ ]: