Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
30965c09
Commit
30965c09
authored
Jul 06, 2015
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Friction simulation
parent
8c91b9b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
2 deletions
+22
-2
friction.dart
packages/newton/lib/src/friction.dart
+1
-1
newton_test.dart
packages/newton/test/newton_test.dart
+21
-1
No files found.
packages/newton/lib/src/friction.dart
View file @
30965c09
...
...
@@ -17,7 +17,7 @@ class Friction extends Simulation {
_v
=
velocity
;
double
x
(
double
time
)
=>
_x
+
_v
+
Math
.
pow
(
_drag
,
time
)
/
_dragNaturalLog
-
_v
/
_dragNaturalLog
;
_x
+
_v
*
Math
.
pow
(
_drag
,
time
)
/
_dragNaturalLog
-
_v
/
_dragNaturalLog
;
double
dx
(
double
time
)
=>
_v
*
Math
.
pow
(
_drag
,
time
);
...
...
packages/newton/test/newton_test.dart
View file @
30965c09
...
...
@@ -8,4 +8,24 @@ import 'package:test/test.dart';
import
'package:newton/newton.dart'
;
void
main
(
)
{}
typedef
bool
SimulationTestHandler
(
int
millis
);
void
main
(
)
{
test
(
'test_friction'
,
()
{
var
friction
=
new
Friction
(
0.3
,
100.0
,
400.0
);
expect
(
friction
.
isDone
(
0.0
),
false
);
expect
(
friction
.
x
(
0.0
),
100
);
expect
(
friction
.
dx
(
0.0
),
400.0
);
expect
(
friction
.
x
(
1.0
)
>
330
&&
friction
.
x
(
1.0
)
<
335
,
true
);
expect
(
friction
.
dx
(
1.0
),
120.0
);
expect
(
friction
.
dx
(
2.0
),
36.0
);
expect
(
friction
.
dx
(
3.0
),
10.8
);
expect
(
friction
.
dx
(
4.0
)
<
3.5
,
true
);
expect
(
friction
.
isDone
(
5.0
),
true
);
expect
(
friction
.
x
(
5.0
)
>
431
&&
friction
.
x
(
5.0
)
<
432
,
true
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment