Skip to content

Commit 8d3ee08

Browse files
author
Patrick Rye
committed
Update to v1.0.0-RC
## [1.0.0-RC] - 2015-11-21 ### Added * Movement Equation Image * Collision method set in config ### Notes * Moved to RC as I've done almost everything I can think of to do. All that really needs to be figured out is why the balls sometimes stick together. Which I believe is because of the Tick system and cannot be easily fixed.
1 parent 59efe83 commit 8d3ee08

File tree

10 files changed

+97
-24
lines changed

10 files changed

+97
-24
lines changed

ChangesLog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
All notable changes to this project will be documented here.
44
This project adheres to [Semantic Versioning](http://semver.org/)
55

6+
## [1.0.0-RC] - 2015-11-21
7+
### Added
8+
* Movement Equation Image
9+
* Collision method set in config
10+
11+
### Notes
12+
* Moved to RC as I've done almost everything I can think of to do. All that really needs to be figured out is why the balls sometimes stick together.
13+
Which I believe is because of the Tick system and cannot be easily fixed.
14+
615
## [1.2.7-Beta] - 2015-11-18
716
### Fixed
817
* Copy Paste Error that caused the pixel texture to remain in memory

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Screen Height: 480
5252
Log Ball's path: 0
5353
Enable Drag Mode (experimental): 0
5454
Draw Ball path on screen: 0
55+
Collision Method: 1
5556
```
5657

5758
You can use this to change things like the screen height and width, and other stuff.
@@ -63,6 +64,16 @@ online and I cannot verify how accurate it is.
6364

6465
"Draw Ball path on Screen" (if enabled with a 1 instead of 0), will cause small pixels to trail after each ball.
6566

67+
"Collision Method" you can change how the balls will interact with each other when they collide based on the number in the table below.
68+
69+
| Name | Number | Explanation |
70+
|-------------------------|--------|------------------------------------------------------------------------------------------------------------|
71+
| CollideElastic | 0 | This is normal collision in a perfect world without friction, they hit and bounce off, no energy is lost. |
72+
| CollideInelastic | 1 | This is the real life situation. Balls collide and, bounce off of each other losing some energy. |
73+
| CollidePerfectInelastic | 2 | In this method the balls collide and then stick together. |
74+
| CollideNone | 3 | The balls do not collide and pass through each other. |
75+
76+
6677
Once you start the program you will be greeted with a beautiful black screen. To create a new cannonball you click (and hold down the button)
6778
you can now move your move around to change the angle that the new cannonball will be fired at; as well as the longer the line the faster it will go.
6879
When you are happy with the angle and speed simply release the mouse button and it will be created at the point where you clicked the mouse button down.

project/Equations.PNG

47.6 KB
Loading

project/doxygen/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = Cannon-Simulation
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = v1.2.7-Beta
41+
PROJECT_NUMBER = v1.0.0-RC
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
@@ -861,7 +861,7 @@ EXAMPLE_RECURSIVE = NO
861861
# that contain images that are to be included in the documentation (see the
862862
# \image command).
863863

864-
IMAGE_PATH =
864+
IMAGE_PATH = ../Equations.PNG
865865

866866
# The INPUT_FILTER tag can be used to specify a program that doxygen should
867867
# invoke to filter for each input file. Doxygen will invoke the filter program

project/doxygen/document.tex

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
\documentclass[10pt,a4paper,landscape]{article}
2+
\usepackage[latin1]{inputenc}
3+
\usepackage{amsmath}
4+
\usepackage{amsfonts}
5+
\usepackage{amssymb}
6+
\usepackage{graphicx}
7+
\author{Patrick Rye}
8+
\begin{document}
9+
\begin{equation*}
10+
\begin{matrix}\mathit{Defs}\hfill\null &\left\{\begin{matrix}\hfill
11+
v_{1x}&=\hfill\null &v_{1}\times \cos (\theta _{1})\\\hfill
12+
v_{2x}&=\hfill\null &v_{2}\times \cos (\theta _{2})\\\hfill \phi
13+
&=\hfill\null &|\theta _{1}-\theta _{2}|\\\hfill v_{1}&=\hfill\null
14+
&\sqrt{v_{1x}^{2}+v_{1y}^{2}}\\\hfill v_{2}&=\hfill\null
15+
&\sqrt{v_{2x}^{2}+v_{2y}^{2}}\end{matrix}\right\}\hfill\null
16+
\\\mathit{Givens}\hfill\null &\left\{\begin{matrix}v_{1x}\hfill\null
17+
&v_{1y}\hfill\null \\v_{2x}\hfill\null &v_{2y}\hfill\null \\\theta
18+
_{1}\hfill\null &\theta _{2}\hfill\null \end{matrix}\right\}\hfill\null
19+
\\\mathit{Object}1\hfill\null &\left\{\begin{matrix}\hfill
20+
v_{1x}^{'}&=\hfill\null &\frac{v_{1}\times \cos (\theta _{1}-\phi
21+
)\times (m_{1}-m_{2})+2\ast m_{2}\times v_{2}\times \cos (\theta
22+
_{2}-\phi )}{m_{1}+m_{2}}\times \cos (\phi )+v_{1}\times \sin (\theta
23+
_{1}-\phi )\times \cos (\phi +\frac{\pi }{2})\\\hfill
24+
v_{1y}^{'}&=\hfill\null &\frac{v_{1}\times \cos (\theta _{1}-\phi
25+
)\times (m_{1}-m_{2})+2\ast m_{2}\times v_{2}\times \cos (\theta
26+
_{2}-\phi )}{m_{1}+m_{2}}\times \sin (\phi )+v_{1}\times \sin (\theta
27+
_{1}-\phi )\times \sin (\phi +\frac{\pi
28+
}{2})\end{matrix}\right\}\hfill\null \\\mathit{Object}2\hfill\null
29+
&\left\{\begin{matrix}\hfill v_{2x}^{'}&=\hfill\null &\frac{v_{2}\times
30+
\cos (\theta _{2}-\phi )\times (m_{2}-m_{1})+2\ast m_{1}\times
31+
v_{1}\times \cos (\theta _{1}-\phi )}{m_{1}+m_{2}}\times \cos (\phi
32+
)+v_{2}\times \sin (\theta _{2}-\phi )\times \cos (\phi +\frac{\pi
33+
}{2})\\\hfill v_{2y}^{'}&=\hfill\null &\frac{v_{2}\times \cos (\theta
34+
_{2}-\phi )\times (m_{2}-m_{1})+2\ast m_{1}\times v_{1}\times \cos
35+
(\theta _{1}-\phi )}{m_{1}+m_{2}}\times \sin (\phi )+v_{2}\times \sin
36+
(\theta _{2}-\phi )\times \sin (\phi +\frac{\pi
37+
}{2})\end{matrix}\right\}\hfill\null
38+
\\\mathit{Coefficient}\mathit{of}\mathit{restitution}\hfill\null
39+
&\left\{\begin{matrix}C_{R}\hfill\null &=\hfill\null
40+
&\frac{v_{1}^{'}-v_{2}^{'}}{v_{2}-v_{1}}\hfill\null
41+
\end{matrix}\right\}\hfill\null \end{matrix}\hfill
42+
\end{equation*}
43+
\end{document}

src/config.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ clsConfig::clsConfig() {
1515
/// * values.blnDrawPathOnScreen = false;
1616
/// * values.uintScreenWidth = 640;
1717
/// * values.uintScreenHeight = 480;
18+
/// * values.uchrCollisionMethod = CollideInelastic;
1819
/// It will also set the OS based on values that are defined
1920
///
2021
/////////////////////////////////////////////////
@@ -25,6 +26,7 @@ clsConfig::clsConfig() {
2526
values.blnDrawPathOnScreen = false;
2627
values.uintScreenWidth = 640;
2728
values.uintScreenHeight = 480;
29+
values.uchrCollisionMethod = CollideInelastic;
2830
#if defined(_AIX)
2931
values.OperatingSystem = "AIX";
3032
#elif defined(__unix__)
@@ -82,6 +84,7 @@ void clsConfig::make(void) {
8284
(values.blnDragMode ? 1 : 0) );
8385
fprintf(configFile,"Draw Ball path on screen: %u\n",
8486
(values.blnDrawPathOnScreen ? 1 : 0) );
87+
fprintf(configFile,"Collision Method: %u\n", values.uchrCollisionMethod);
8588
fclose(configFile);
8689
}
8790
/*****************************************************************************/
@@ -126,6 +129,12 @@ void clsConfig::load(void) {
126129
if(Global::blnDebugMode) {printf("Enable Screen Path \t %d\n",intTempBool);}
127130
values.blnDrawPathOnScreen = (intTempBool == 1);
128131

132+
fgets(chrTempString,50,configFile);
133+
intValuesScanned = sscanf(chrTempString, "%*s %*s %d", &values.uchrCollisionMethod);
134+
if (intValuesScanned < 1) {printf("ERROR!"); values.uchrCollisionMethod = CollideInelastic;}
135+
if (values.uchrCollisionMethod > CollideNone) {printf("ERROR!"); values.uchrCollisionMethod = CollideNone;}
136+
if(Global::blnDebugMode) {printf("Collision Method: \t %d\n",values.uchrCollisionMethod);}
137+
129138
fclose(configFile);
130139
printf("\n\n");
131140
}

src/config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct ConfigValues {
2020
bool blnLogging; /**< If logging of balls' path to a file is enabled */
2121
bool blnDragMode; /**< Whether Drag is enabled or not */
2222
bool blnDrawPathOnScreen; /**< Whether to draw the balls' past path on the screen */
23+
uchar uchrCollisionMethod; /**< The Method of Collision see Collisions */
2324
char* OperatingSystem; /**< The OS that the program is running on, doesn't do anything */
2425
};
2526

src/global.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace Global {
2929
extern const float fRecoil;
3030
extern const float fMinVelocity;
3131
extern const float fCoefficientRestitution;
32-
extern const uchar CollisionMethod;
32+
extern uchar CollisionMethod;
3333
}
3434

3535
namespace Equations {
@@ -41,4 +41,15 @@ namespace Global {
4141
}
4242
}
4343
/*****************************************************************************/
44+
/** The method of the collision (I just wanted to play around with some options.) */
45+
enum Collisions {
46+
CollideElastic = 0, /**< This is normal collision in a perfect world without
47+
friction, they hit and bounce off, no energy is lost. */
48+
CollideInelastic, /**< This is the normal way things collide, Balls collide and
49+
bounce off of each other losing some energy. */
50+
CollidePerfectInelastic, /**< In this method the balls collide and then
51+
stick together. */
52+
CollideNone /**< No collisions, balls pass through each other. */
53+
};
54+
/*****************************************************************************/
4455
#endif // __GLOBAL_H_INCLUDED__

src/main.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/*****************************************************************************/
22
//General Todos
33
/* FIXME (GamerMan7799#1#): The balls will become stuck together for seemingly random reasons */
4-
/* TODO (GamerMan7799#5#): Collision Method can be set in Config */
54
/* TODO (GamerMan7799#9#): Allow setting of some Physics Values in Config */
65
/*****************************************************************************/
76
#include "version.h"
@@ -29,17 +28,6 @@ namespace Cannonballs {
2928
clsCannonball Balls[DEFINED_CANNONBALL_LIMIT]; /**< The is the array that holds all of the cannonballs. */
3029
}
3130
/*****************************************************************************/
32-
/** The method of the collision (I just wanted to play around with some options.) */
33-
enum Collisions {
34-
CollideElastic = 0, /**< This is normal collision in a perfect world without
35-
friction, they hit and bounce off, no energy is lost. */
36-
CollideInelastic, /**< This is the normal way things collide, Balls collide and
37-
bounce off of each other losing some energy. */
38-
CollidePerfectInelastic, /**< In this method the balls collide and then
39-
stick together. */
40-
CollideNone /**< No collisions, balls pass through each other. */
41-
};
42-
/*****************************************************************************/
4331
namespace Global {
4432
/** Holds if build is in debug mode, this can happen if
4533
DEFINED_BUILD_MODE_PRIVATE is defined in the complier */
@@ -67,7 +55,7 @@ namespace Global {
6755
const float fMinVelocity = 0.0; /**< If a ball has less velocity than the it will "die" */
6856
const float fCoefficientRestitution = 0.76; /**< How much total energy remains after a collision,
6957
(see https://en.wikipedia.org/wiki/Coefficient_of_restitution for more info) */
70-
const uchar CollisionMethod = CollideInelastic; /**< The collision method to use (see Collisions Enum) */
58+
uchar CollisionMethod = CollideInelastic; /**< The collision method to use (see Collisions Enum) */
7159
} //end Namespace Physics
7260

7361
/** Holds Values for different equations that are not physics related */
@@ -275,6 +263,7 @@ void Cannonballs::doCollide(uint numA, uint numB) {
275263
/////////////////////////////////////////////////
276264
/// @brief Will calculate the new velocities of two balls that are colliding
277265
///
266+
/// @image html Equations.PNG "The equations used to get the resulting velocities."
278267
/// @param numA = the number in the array ball A is
279268
/// @param numB = the number in the array ball B is
280269
/// @return void (everything is handled inside the function)

src/version.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define __VERSION_HEADER__
33
/*****************************************************************************/
44
//Date Version Types
5-
#define DEFINED_VER_DATE "18"
5+
#define DEFINED_VER_DATE "21"
66
/**< Day of the last build */
77

88
#define DEFINED_VER_MONTH "11"
@@ -16,7 +16,7 @@
1616

1717

1818
//Software Status
19-
#define DEFINED_VER_STATUS "Beta"
19+
#define DEFINED_VER_STATUS "Release Candidate"
2020
/**<
2121
Software Status can be the following:
2222
| Status | Short | Description |
@@ -27,27 +27,27 @@
2727
| Alpha | a | This version does not work at all; it usually won't compile at all or crashes more times than it works; best not to use versions in this state. |
2828
*/
2929

30-
#define DEFINED_VER_STATUS_SHORT "b"
30+
#define DEFINED_VER_STATUS_SHORT "rc"
3131
/**< See table for DEFINED_VER_STATUS */
3232

3333
//Standard Version Type
3434
#define DEFINED_VER_MAJOR 1
3535
/**< The major version number */
3636

37-
#define DEFINED_VER_MINOR 2
37+
#define DEFINED_VER_MINOR 0
3838
/**< The minor version number */
3939

40-
#define DEFINED_VER_BUILD 7
40+
#define DEFINED_VER_BUILD 0
4141
/**< The patch version number */
4242

43-
#define DEFINED_VER_RC_FILEVERSION 1,2,7,0
43+
#define DEFINED_VER_RC_FILEVERSION 1,0,0,4
4444
/**< The number used in the boilerplate.rc file
4545
Follows MAJOR,MINOR,PATCH,BUILD where build is the number of times this version has been built*/
4646

47-
#define DEFINED_VER_RC_FILEVERSION_STRING "1, 2, 7, 0\0"
47+
#define DEFINED_VER_RC_FILEVERSION_STRING "1, 0, 0, 4\0"
4848
/**< Is the same as DEFINED_VER_RC_FILEVERSION but is a null terminated string */
4949

50-
#define DEFINED_VER_FULLVERSION_STRING "1.2.7-Beta"
50+
#define DEFINED_VER_FULLVERSION_STRING "1.0.0-RC"
5151
/**< The full string of the version number */
5252

5353
/*****************************************************************************/

0 commit comments

Comments
 (0)