Skip to content

Commit d1c2318

Browse files
committed
Finish kill tab devils.
It will be easy I thought! One hour later, I had this: https://stackoverflow.com/questions/11094383/how-can-i-convert-tabs-to-spaces-in-every-file-of-a-directory/52136507#52136507 Will I ever get anything done? Place your bets.
1 parent f56acbd commit d1c2318

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+801
-805
lines changed

bullet/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ Tested on Bullet 2.83, Ubuntu 16.04.
1515
1. [Gravity collision](gravity_collision.cpp)
1616
1. [Which collision](which_collision.cpp)
1717
1. Tools
18-
1. [plot](plot)
19-
1. [Bibliography](bibliography.md)
18+
1. [plot](plot)
19+
1. [Bibliography](bibliography.md)
2020
1. [TODO](TODO.md)

bullet/TODO.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- TODO what happens then?
1212
- from <https://github.com/bulletphysics/bullet3/blob/2.83/examples/ExampleBrowser/OpenGLGuiHelper.cpp#L447> renderScene
1313
- `m_guiHelper` is set called from OpenGLExampleBrowser to a OpenGLGuiHelper
14-
- CommonRigidBodyBase::renderScene() calls `m_guiHelper->render(m_dynamicsWorld);`
14+
- CommonRigidBodyBase::renderScene() calls `m_guiHelper->render(m_dynamicsWorld);`
1515
- `BasicExample:: CommonRigidBodyBase::renderScene();` calls `CommonRigidBodyBase::renderScene();`
1616
- colors just alternate between 4 values: <https://github.com/bulletphysics/bullet3/blob/2.83/examples/ExampleBrowser/OpenGLGuiHelper.cpp#L117>
1717
- user input

bullet/gravity_collision.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ int main() {
9090

9191
#endif
9292
collisionShapes.push_back(groundShape);
93-
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
94-
btRigidBody::btRigidBodyConstructionInfo rbInfo(0, myMotionState, groundShape, btVector3(0, 0, 0));
95-
btRigidBody* body = new btRigidBody(rbInfo);
96-
body->setRestitution(groundRestitution);
97-
dynamicsWorld->addRigidBody(body);
93+
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
94+
btRigidBody::btRigidBodyConstructionInfo rbInfo(0, myMotionState, groundShape, btVector3(0, 0, 0));
95+
btRigidBody* body = new btRigidBody(rbInfo);
96+
body->setRestitution(groundRestitution);
97+
dynamicsWorld->addRigidBody(body);
9898
}
9999

100100
// Object.
@@ -118,8 +118,8 @@ int main() {
118118
btDefaultMotionState *myMotionState = new btDefaultMotionState(startTransform);
119119
btRigidBody *body = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(
120120
mass, myMotionState, colShape, localInertia));
121-
body->setRestitution(objectRestitution);
122-
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
121+
body->setRestitution(objectRestitution);
122+
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
123123
dynamicsWorld->addRigidBody(body);
124124
}
125125

bullet/two_objects.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ int main() {
7979
btDefaultMotionState *myMotionState = new btDefaultMotionState(startTransform);
8080
btRigidBody *body = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(
8181
mass, myMotionState, colShape, localInertia));
82-
body->setRestitution(objectRestitution);
83-
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
84-
body->setAngularVelocity(btVector3(initialAngularVelocityX, initialAngularVelocityY, initialAngularVelocityZ));
82+
body->setRestitution(objectRestitution);
83+
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
84+
body->setAngularVelocity(btVector3(initialAngularVelocityX, initialAngularVelocityY, initialAngularVelocityZ));
8585
dynamicsWorld->addRigidBody(body);
8686
}
8787

@@ -106,9 +106,9 @@ int main() {
106106
btDefaultMotionState *myMotionState = new btDefaultMotionState(startTransform);
107107
btRigidBody *body = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(
108108
mass, myMotionState, colShape, localInertia));
109-
body->setRestitution(objectRestitution);
110-
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
111-
body->setAngularVelocity(btVector3(initialAngularVelocityX, initialAngularVelocityY, initialAngularVelocityZ));
109+
body->setRestitution(objectRestitution);
110+
body->setLinearVelocity(btVector3(initialLinearVelocityX, initialLinearVelocityY, initialLinearVelocityZ));
111+
body->setAngularVelocity(btVector3(initialAngularVelocityX, initialAngularVelocityY, initialAngularVelocityZ));
112112
dynamicsWorld->addRigidBody(body);
113113
}
114114

bullet/which_collision.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ int main() {
6565
btCollisionShape* groundShape;
6666
groundShape = new btStaticPlaneShape(btVector3(0, 1, 0), -1);
6767
collisionShapes.push_back(groundShape);
68-
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
69-
btRigidBody::btRigidBodyConstructionInfo rbInfo(0, myMotionState, groundShape, btVector3(0, 0, 0));
70-
btRigidBody* body = new btRigidBody(rbInfo);
71-
body->setRestitution(groundRestitution);
72-
dynamicsWorld->addRigidBody(body);
68+
btDefaultMotionState* myMotionState = new btDefaultMotionState(groundTransform);
69+
btRigidBody::btRigidBodyConstructionInfo rbInfo(0, myMotionState, groundShape, btVector3(0, 0, 0));
70+
btRigidBody* body = new btRigidBody(rbInfo);
71+
body->setRestitution(groundRestitution);
72+
dynamicsWorld->addRigidBody(body);
7373
}
7474

7575
// Objects.
@@ -87,7 +87,7 @@ int main() {
8787
btDefaultMotionState *myMotionState = new btDefaultMotionState(startTransform);
8888
btRigidBody *body = new btRigidBody(btRigidBody::btRigidBodyConstructionInfo(
8989
mass, myMotionState, colShape, localInertia));
90-
body->setRestitution(objectRestitution);
90+
body->setRestitution(objectRestitution);
9191
dynamicsWorld->addRigidBody(body);
9292
objects.push_back(body);
9393
}

cpp-from-c/cpp.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ int f(float i) {
99
}
1010

1111
int f_int(int i) {
12-
return f(i);
12+
return f(i);
1313
}
1414

1515
int f_float(float i) {
16-
return f(i);
16+
return f(i);
1717
}

eigen/svd.cpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ using Eigen::MatrixXf;
1414
using Eigen::Vector3f;
1515

1616
int main() {
17-
MatrixXf m(3,2);
18-
m <<
19-
1.0, 2.0,
20-
3.0, 4.0,
21-
5.0, 6.0
22-
;
23-
JacobiSVD<MatrixXf> svd(m, ComputeFullU | ComputeFullV);
24-
auto e = svd.singularValues();
25-
// TODO. e needs to be 3x2, what is the nicest way? Almost there, but this changes value positions.
26-
//MatrixXf e(svd.singularValues().asDiagonal());
27-
//e.resize(m.rows(), m.cols());
28-
cout << "E" << endl << e << endl << endl;
29-
auto u = svd.matrixU();
30-
cout << "U" << endl << u << endl << endl;
31-
cout << "UU'" << endl << u.adjoint() * u << endl << endl;
32-
auto v = svd.matrixV();
33-
cout << "V" << endl << v << endl << endl;
34-
cout << "VV'" << endl << v * v.adjoint() << endl << endl;
35-
//cout << "UEV" << endl << u * e * v << endl << endl;
36-
cout << "least squares" << endl << svd.solve(Vector3f(1, 0, 0)) << endl << endl;
17+
MatrixXf m(3,2);
18+
m <<
19+
1.0, 2.0,
20+
3.0, 4.0,
21+
5.0, 6.0
22+
;
23+
JacobiSVD<MatrixXf> svd(m, ComputeFullU | ComputeFullV);
24+
auto e = svd.singularValues();
25+
// TODO. e needs to be 3x2, what is the nicest way? Almost there, but this changes value positions.
26+
//MatrixXf e(svd.singularValues().asDiagonal());
27+
//e.resize(m.rows(), m.cols());
28+
cout << "E" << endl << e << endl << endl;
29+
auto u = svd.matrixU();
30+
cout << "U" << endl << u << endl << endl;
31+
cout << "UU'" << endl << u.adjoint() * u << endl << endl;
32+
auto v = svd.matrixV();
33+
cout << "V" << endl << v << endl << endl;
34+
cout << "VV'" << endl << v * v.adjoint() << endl << endl;
35+
//cout << "UEV" << endl << u * e * v << endl << endl;
36+
cout << "least squares" << endl << svd.solve(Vector3f(1, 0, 0)) << endl << endl;
3737
}

ffmpeg/build.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ Only a few codecs are included by default.
2121
Build with `H264` support:
2222

2323
sudo apt-get install libx264-dev
24-
./configure \
25-
--enable-gpl \
26-
--enable-parser=h264 \
27-
--enable-libx264 \
28-
--enable-encoder=libx264 \
29-
--enable-decoder=h264
24+
./configure \
25+
--enable-gpl \
26+
--enable-parser=h264 \
27+
--enable-libx264 \
28+
--enable-encoder=libx264 \
29+
--enable-decoder=h264 \
30+
;
3031

3132
`--enable-gpl` is required here, because `libx264` <http://www.videolan.org/developers/x264.html> from VideoLAN is GPL. I think this option excludes non-GPL compatible codecs. Lol, this domain is so patent ridden that it is necessary to manage that from the build script. See also: <https://www.ffmpeg.org/legal.html>
3233

flex-bison/bison/h.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef struct {
1414
typedef struct {
1515
int oper; /* operator */
1616
int nops; /* number of operands */
17-
struct nodeTypeTag **op; /* operands */
17+
struct nodeTypeTag **op; /* operands */
1818
} oprNodeType;
1919

2020
typedef struct nodeTypeTag {

flex-bison/bison/y.y

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ void freeNode(nodeType *p)
214214
if (p->type == typeOpr) {
215215
for (i = 0; i < p->opr.nops; i++)
216216
freeNode(p->opr.op[i]);
217-
free (p->opr.op);
217+
free (p->opr.op);
218218
}
219219
free (p);
220220
}

flex-bison/cpp/bison.y

+16-16
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@ int yylex(void);
55
%}
66

77
%union{
8-
int int_val;
9-
string* op_val;
8+
int int_val;
9+
string* op_val;
1010
}
1111

12-
%start input
12+
%start input
1313

14-
%token <int_val> INTEGER_LITERAL
15-
%type <int_val> exp
16-
%left PLUS
17-
%left MULT
14+
%token <int_val> INTEGER_LITERAL
15+
%type <int_val> exp
16+
%left PLUS
17+
%left MULT
1818

1919
%%
2020

21-
input: /* empty */
22-
| exp { cout << $1 << endl; }
23-
;
21+
input: /* empty */
22+
| exp { cout << $1 << endl; }
23+
;
2424

25-
exp: INTEGER_LITERAL { $$ = $1; }
26-
| exp PLUS exp { $$ = $1 + $3; }
27-
| exp MULT exp { $$ = $1 * $3; }
28-
;
25+
exp: INTEGER_LITERAL { $$ = $1; }
26+
| exp PLUS exp { $$ = $1 + $3; }
27+
| exp MULT exp { $$ = $1 * $3; }
28+
;
2929

3030
%%
3131

3232
int yyerror(string s)
3333
{
34-
extern int yylineno; // defined and maintained in lex.c
35-
extern char *yytext; // defined and maintained in lex.c
34+
extern int yylineno; // defined and maintained in lex.c
35+
extern char *yytext; // defined and maintained in lex.c
3636

3737
cerr << "ERROR: " << s << " at symbol \"" << yytext;
3838
cerr << "\" on line " << yylineno << endl;

flex-bison/cpp/flex.l

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ int yyerror(char *s);
55
//int yylineno = 1;
66
%}
77

8-
digit [0-9]
9-
int_const {digit}+
8+
digit [0-9]
9+
int_const {digit}+
1010

1111
%%
1212

13-
{int_const} { yylval.int_val = atoi(yytext); return INTEGER_LITERAL; }
14-
"+" { yylval.op_val = new std::string(yytext); return PLUS; }
15-
"*" { yylval.op_val = new std::string(yytext); return MULT; }
13+
{int_const} { yylval.int_val = atoi(yytext); return INTEGER_LITERAL; }
14+
"+" { yylval.op_val = new std::string(yytext); return PLUS; }
15+
"*" { yylval.op_val = new std::string(yytext); return MULT; }
1616

17-
[ \t]* {}
18-
[\n] { yylineno++; }
17+
[ \t]* {}
18+
[\n] { yylineno++; }
1919

20-
. { std::cerr << "SCANNER "; yyerror(""); exit(1); }
20+
. { std::cerr << "SCANNER "; yyerror(""); exit(1); }

fortran-from-c/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ How to call Fortran code from C.
1616

1717
Fortran memory:
1818

19-
a(1,1) a(2,1) a(1,2) a(2,2) a(1,3) a(2,3)
19+
a(1,1) a(2,1) a(1,2) a(2,2) a(1,3) a(2,3)
2020

2121
C memory:
2222

23-
a[0][0] a[0][1] a[0][2] a[1][0] a[1][1] a[1][2]
23+
a[0][0] a[0][1] a[0][2] a[1][0] a[1][1] a[1][2]
2424

2525
- Fortran strings contain length. TODO: how?
2626

gcc/cpp-invocation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ This is mostly useful for learning purposes only.
5555

5656
Using `cpp` directly:
5757

58-
cpp c.c
58+
cpp c.c
5959

6060
Outputs the preprocessed file to stdout.
6161

gdb/commands.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ If there is no debugging information with attached source code, run until anothe
218218

219219
Sample output if there are multiple instructions for the current line:
220220

221-
0x0000000000400593 24 printf("%d\n", f3(0));
221+
0x0000000000400593 24 printf("%d\n", f3(0));
222222

223223
Which contains the:
224224

@@ -232,7 +232,7 @@ If there is no source code:
232232

233233
If each instruction corresponds to a single line:
234234

235-
9 i += 1;
235+
9 i += 1;
236236

237237
the address number is not shown.
238238

lapack/c.c

+31-31
Original file line numberDiff line numberDiff line change
@@ -64,43 +64,43 @@ int main(void) {
6464
float x2[2], b2[2], c2[2];
6565
float a2x2[2][2];
6666

67-
/* cblas */
68-
{
67+
/* cblas */
68+
{
6969
x2[0] = 1.0;
7070
x2[1] = -2.0;
7171
assert_eqd(cblas_snrm2(2, x2, 1), sqrt(5.0), err);
7272
}
7373

74-
/* lapacke */
75-
{
76-
/* sgesv
77-
*
78-
* Matrix vector multiply.
79-
*/
80-
{
81-
a2x2[0][0] = 1.0;
82-
a2x2[1][0] = 2.0;
83-
a2x2[0][1] = 3.0;
84-
a2x2[1][1] = 4.0;
85-
b2[0] = 5.;
86-
b2[1] = 11.;
74+
/* lapacke */
75+
{
76+
/* sgesv
77+
*
78+
* Matrix vector multiply.
79+
*/
80+
{
81+
a2x2[0][0] = 1.0;
82+
a2x2[1][0] = 2.0;
83+
a2x2[0][1] = 3.0;
84+
a2x2[1][1] = 4.0;
85+
b2[0] = 5.;
86+
b2[1] = 11.;
8787

88-
info = LAPACKE_sgesv(
89-
LAPACK_COL_MAJOR,
90-
2,
91-
1,
92-
&a2x2[0][0],
93-
2,
94-
&ipiv2[0],
95-
&b2[0],
96-
2
97-
);
98-
c2[0] = 1.0;
99-
c2[1] = 2.0;
100-
assert_eqi(info, 0);
101-
assert_eqd(b2[0], c2[0], err);
102-
assert_eqd(b2[1], c2[1], err);
103-
}
88+
info = LAPACKE_sgesv(
89+
LAPACK_COL_MAJOR,
90+
2,
91+
1,
92+
&a2x2[0][0],
93+
2,
94+
&ipiv2[0],
95+
&b2[0],
96+
2
97+
);
98+
c2[0] = 1.0;
99+
c2[1] = 2.0;
100+
assert_eqi(info, 0);
101+
assert_eqd(b2[0], c2[0], err);
102+
assert_eqd(b2[1], c2[1], err);
103+
}
104104
}
105105

106106
return EXIT_SUCCESS;

opencl/binary_shader.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ int main(int argc, char **argv) {
5050
clFinish(common.command_queue);
5151
clEnqueueReadBuffer(common.command_queue, buffer, CL_TRUE, 0, sizeof(input), input, 0, NULL, NULL);
5252

53-
/* Assertions. */
53+
/* Assertions. */
5454
assert(input[0] == 2);
5555
assert(input[1] == 3);
5656

57-
/* Cleanup. */
57+
/* Cleanup. */
5858
clReleaseMemObject(buffer);
5959
common_deinit(&common);
6060
return EXIT_SUCCESS;

0 commit comments

Comments
 (0)