File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Previous Tutorial: \ref install
7
7
This tutorial describes how to get started using Gazebo Math with C++.
8
8
9
9
We will run through an example that determines the distance between two
10
- points in 3D space. Start by creating a bare-bones main file using the
10
+ points in 3D space. Start by creating a bare-bones ` main.cpp ` file using the
11
11
editor of your choice.
12
12
13
13
``` {.cpp}
@@ -67,6 +67,19 @@ int main()
67
67
}
68
68
```
69
69
70
+ To compile this code on UNIX with pkg-config, use the following command:
71
+
72
+ ``` {.bash}
73
+ c++ $(pkg-config --cflags gz-math7) main.cpp -o main
74
+ ~~~
75
+
76
+ The program can then be run as:
77
+
78
+ ```{.bash}
79
+ $ ./main
80
+ Distance from 1 3 5 to 2 4 6 is 1.73205
81
+ ~~~
82
+
70
83
## Bonus: Vector2 Example
71
84
72
85
The following is an example program that uses Vector2 to perform some simple
Original file line number Diff line number Diff line change @@ -73,3 +73,9 @@ def main():
73
73
if __name__ == " __main__" :
74
74
main()
75
75
```
76
+
77
+ Running this program should result in the following output:
78
+
79
+ ``` {.bash}
80
+ Distance from 1 3 5 to 2 4 6 is 1.7320508075688772
81
+ ```
You can’t perform that action at this time.
0 commit comments