-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port ruby and python from ign-math6 (#5)
Signed-off-by: Louise Poubel <louise@openrobotics.org> Co-authored-by: Jose Luis Rivero <jrivero@osrfoundation.org>
- Loading branch information
Showing
14 changed files
with
184 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ubuntu/debian/tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../ubuntu/debian/python3-ignition-math.install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../ubuntu/debian/ruby-ignition-math.install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../ubuntu/debian/tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ubuntu/debian/python3-ignition-math.install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ubuntu/debian/ruby-ignition-math.install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../ubuntu/debian/tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr/lib/python3/dist-packages/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/lib/ruby/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/sh | ||
# autopkgtest check: Build and run a program against ign-math, to verify that the | ||
# headers and pkg-config file are installed correctly | ||
# (C) 2012 Jose Luis Rivero | ||
# Author: Jose Luis Rivero <jrivero@osrfoundation.org> | ||
|
||
set -e | ||
|
||
WORKDIR=$(mktemp -d) | ||
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM | ||
cd $WORKDIR | ||
cat <<EOF > igntest.c | ||
#include <iostream> | ||
#include <ignition/math.hh> | ||
int main(int argc, char **argv) | ||
{ | ||
// Create a triangle with the following vertices: | ||
// 1: x = -1, y = 0 | ||
// 2: x = 0, y = 1 | ||
// 3: x = 1, y = 0 | ||
ignition::math::Triangled tri( | ||
ignition::math::Vector2d(-1, 0), | ||
ignition::math::Vector2d(0, 1), | ||
ignition::math::Vector2d(1, 0)); | ||
// The individual vertices are accessible through the [] operator | ||
std::cout << "Vertex 1: " << tri[0] << "\n" | ||
<< "Vertex 2: " << tri[1] << "\n" | ||
<< "Vertex 3: " << tri[2] << "\n"; | ||
// Each side of the triangle is also accessible via the Side function | ||
std::cout << "Side 1: " << tri.Side(0) << "\n" | ||
<< "Side 2: " << tri.Side(1) << "\n" | ||
<< "Side 3: " << tri.Side(2) << "\n"; | ||
// It's also possible to set each vertex individually. | ||
tri.Set(0, ignition::math::Vector2d(-10, 0)); | ||
tri.Set(1, ignition::math::Vector2d(0, 20)); | ||
tri.Set(2, ignition::math::Vector2d(10, 2)); | ||
// Or set all the vertices at once. | ||
tri.Set(ignition::math::Vector2d(-1, 0), | ||
ignition::math::Vector2d(0, 1), | ||
ignition::math::Vector2d(1, 0)); | ||
// You can get the perimeter length and area of the triangle | ||
std::cout << "Perimeter=" << tri.Perimeter() | ||
<< " Area=" << tri.Area() << "\n"; | ||
// The Contains functions check if a line or point is inside the triangle | ||
if (tri.Contains(ignition::math::Vector2d(0, 0.5))) | ||
std::cout << "Triangle contains the point 0, 0.5\n"; | ||
else | ||
std::cout << "Triangle does not contain the point 0, 0.5\n"; | ||
// The Intersect function check if a line segment intersects the triangle. | ||
// It also returns the points of intersection | ||
ignition::math::Vector2d pt1, pt2; | ||
if (tri.Intersects(ignition::math::Line2d(-2, 0.5, 2, 0.5), pt1, pt2)) | ||
{ | ||
std::cout << "A line from (-2, 0.5) to (2, 0.5) intersects " | ||
<< "the triangle at the\nfollowing points:\n" | ||
<< "\t Pt1=" << pt1 << "\n" | ||
<< "\t Pt2=" << pt2 << "\n"; | ||
} | ||
else | ||
{ | ||
std::cout << "A line from (-2, 0.5) to (2, 0.5) does not intersect " | ||
<< "the triangle\n"; | ||
} | ||
// There are more functions in Triangle. Take a look at the API; | ||
// http://ignitionrobotics.org/libraries/ign_mat/api | ||
} | ||
EOF | ||
|
||
g++ -o igntest igntest.c `pkg-config --cflags --libs ignition-math7` | ||
echo "build: OK" | ||
[ -x igntest ] | ||
./igntest | ||
echo "run: OK" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Tests: build | ||
Depends: @, pkg-config, build-essential |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
version=3 | ||
http://gazebosim.org/assets/distributions/ignmath-(\d\.\d\.\d)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) | ||
version=4 | ||
opts=filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%@PACKAGE@-$1.tar.gz%,\ | ||
dversionmangle=s/\+(debian|dfsg|ds|deb)\d*$//,repacksuffix=+ds \ | ||
https://github.com/ignitionrobotics/ign-math/tags \ | ||
(?:.*?/)@PACKAGE@.*_(\d[\d.]*)\.tar\.gz |