mirror of
https://github.com/nasa/trick.git
synced 2025-03-10 22:44:25 +00:00
Describe rootfinding example in README. #1070
This commit is contained in:
parent
23f04ffea2
commit
b9f25646e8
@ -54,8 +54,11 @@ int main ( int argc, char* argv[]) {
|
||||
double dt = 0.01;
|
||||
double t = 0.0;
|
||||
SA::RK2Integrator integ(dt, 6, state_var_p, state_var_p, calc_derivs, NULL);
|
||||
RootFinder root_finder(0.00000000001, Negative);
|
||||
integ.add_Rootfinder(&root_finder, &impact);
|
||||
|
||||
// Uncomment the following two lines to have the RootFinder detect impact.
|
||||
// RootFinder root_finder(0.00000000001, Negative);
|
||||
// integ.add_Rootfinder(&root_finder, &impact);
|
||||
|
||||
init_state(cannon);
|
||||
print_header();
|
||||
print_state( t, cannon);
|
||||
|
@ -9,3 +9,22 @@ $ python plot_trajectory.py
|
||||
```
|
||||
|
||||

|
||||
|
||||
```
|
||||
$ make
|
||||
$ ./Cannonball
|
||||
```
|
||||
|
||||
Next edit, and uncomment the indicated lines, recompile, and run. You should see:
|
||||
|
||||
```
|
||||
5.070, 219.5374398594, 0.6674655000, 43.3012701892, -24.7367000000, 0.0000000000, -9.8100000000
|
||||
5.080, 219.9704525612, 0.4196080000, 43.3012701892, -24.8348000000, 0.0000000000, -9.8100000000
|
||||
5.090, 220.4034652631, 0.1707695000, 43.3012701892, -24.9329000000, 0.0000000000, -9.8100000000
|
||||
---------------------------------------------------------------
|
||||
Impact at t = 5.0968399592 x = 220.6996441856 y = 0.0000000000.
|
||||
---------------------------------------------------------------
|
||||
5.100, 220.6996441856, 0.0000000001, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000
|
||||
5.110, 220.6996441856, 0.0000000001, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000
|
||||
5.120, 220.6996441856, 0.0000000001, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user