Skip to content

Commit

Permalink
Merge pull request #36 from open-space-collective/users/lucas/python-…
Browse files Browse the repository at this point in the history
…style

Improve python style
  • Loading branch information
lucas-bremond authored Jan 5, 2020
2 parents 86dd327 + 2b85a9f commit ab898ce
Show file tree
Hide file tree
Showing 36 changed files with 567 additions and 567 deletions.
42 changes: 21 additions & 21 deletions bindings/python/docs/Reference/Geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@
"source": [
"angle = Angle(1.0, Angle.Unit.Radian)\n",
"\n",
"angle = Angle.Radians(1.0)\n",
"angle = Angle.Degrees(1.0)\n",
"angle = Angle.Arcminutes(1.0)\n",
"angle = Angle.Arcseconds(1.0)\n",
"angle = Angle.Revolutions(1.0)"
"angle = Angle.radians(1.0)\n",
"angle = Angle.degrees(1.0)\n",
"angle = Angle.arcminutes(1.0)\n",
"angle = Angle.arcseconds(1.0)\n",
"angle = Angle.revolutions(1.0)"
]
},
{
Expand Down Expand Up @@ -150,7 +150,7 @@
"metadata": {},
"outputs": [],
"source": [
"angle.isDefined() ;"
"angle.is_defined() ;"
]
},
{
Expand All @@ -159,7 +159,7 @@
"metadata": {},
"outputs": [],
"source": [
"angle.getUnit() ;"
"angle.get_unit() ;"
]
},
{
Expand All @@ -168,13 +168,13 @@
"metadata": {},
"outputs": [],
"source": [
"angle.inUnit(Angle.Unit.Degree) ;\n",
"angle.in_unit(Angle.Unit.Degree) ;\n",
"\n",
"angle.inRadians() ;\n",
"angle.inDegrees() ;\n",
"angle.inArcminutes() ;\n",
"angle.inArcseconds() ;\n",
"angle.inRevolutions() ;"
"angle.in_radians() ;\n",
"angle.in_degrees() ;\n",
"angle.in_arcminutes() ;\n",
"angle.in_arcseconds() ;\n",
"angle.in_revolutions() ;"
]
},
{
Expand All @@ -183,8 +183,8 @@
"metadata": {},
"outputs": [],
"source": [
"angle.toString() ;\n",
"angle.toString(3) ;"
"angle.to_string() ;\n",
"angle.to_string(3) ;"
]
},
{
Expand Down Expand Up @@ -1538,7 +1538,7 @@
"metadata": {},
"outputs": [],
"source": [
"quaternion.isNear(quaternion, Angle.Radians(0.0)) ;"
"quaternion.isNear(quaternion, Angle.radians(0.0)) ;"
]
},
{
Expand Down Expand Up @@ -1703,7 +1703,7 @@
"metadata": {},
"outputs": [],
"source": [
"rotation_vector = RotationVector(numpy.array((0.0, 0.0, 1.0)), Angle.Degrees(45.0)) ;"
"rotation_vector = RotationVector(numpy.array((0.0, 0.0, 1.0)), Angle.degrees(45.0)) ;"
]
},
{
Expand All @@ -1730,7 +1730,7 @@
"metadata": {},
"outputs": [],
"source": [
"RotationVector.X(Angle.Degrees(45.0)) ;"
"RotationVector.X(Angle.degrees(45.0)) ;"
]
},
{
Expand All @@ -1739,7 +1739,7 @@
"metadata": {},
"outputs": [],
"source": [
"RotationVector.Y(Angle.Degrees(45.0)) ;"
"RotationVector.Y(Angle.degrees(45.0)) ;"
]
},
{
Expand All @@ -1748,7 +1748,7 @@
"metadata": {},
"outputs": [],
"source": [
"RotationVector.Z(Angle.Degrees(45.0)) ;"
"RotationVector.Z(Angle.degrees(45.0)) ;"
]
},
{
Expand Down Expand Up @@ -1893,4 +1893,4 @@
},
"nbformat": 4,
"nbformat_minor": 2
}
}
32 changes: 16 additions & 16 deletions bindings/python/docs/Reference/Geometry/2D/Objects/Polygon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"metadata": {},
"outputs": [],
"source": [
"Polygon.Undefined() ;"
"Polygon.undefined() ;"
]
},
{
Expand Down Expand Up @@ -113,21 +113,21 @@
"metadata": {},
"outputs": [],
"source": [
"polygon.isDefined() ;\n",
"polygon.intersectsPolygon(polygon) ;\n",
"polygon.containsPoint(Point(0.0, 0.0)) ;\n",
"polygon.containsPointSet(PointSet([Point(0.0, 0.0)])) ;\n",
"polygon.getInnerRingCount() ;\n",
"polygon.getEdgeCount() ;\n",
"polygon.getVertexCount() ;\n",
"polygon.getOuterRing() ;\n",
"polygon.getInnerRingAt(0) ;\n",
"polygon.getEdgeAt(0) ;\n",
"polygon.getVertexAt(0) ;\n",
"# polygon.getEdges() ;\n",
"polygon.getVertices() ;\n",
"polygon.toString() ;\n",
"polygon.applyTransformation(Transformation.Identity()) ;"
"polygon.is_defined() ;\n",
"polygon.intersects_polygon(polygon) ;\n",
"polygon.contains_point(Point(0.0, 0.0)) ;\n",
"polygon.contains_point_set(PointSet([Point(0.0, 0.0)])) ;\n",
"polygon.get_inner_ring_count() ;\n",
"polygon.get_edge_count() ;\n",
"polygon.get_vertex_count() ;\n",
"polygon.get_outer_ring() ;\n",
"polygon.get_inner_ring_at(0) ;\n",
"polygon.get_edge_at(0) ;\n",
"polygon.get_vertex_at(0) ;\n",
"# polygon.get_edges() ;\n",
"polygon.get_vertices() ;\n",
"polygon.to_string() ;\n",
"polygon.apply_transformation(Transformation.identity()) ;"
]
},
{
Expand Down
18 changes: 9 additions & 9 deletions bindings/python/docs/Reference/Objects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
"source": [
"real_interval = RealInterval(0.0, 1.0, RealInterval.Type.Closed) ;\n",
"\n",
"RealInterval.Undefined() ;\n",
"RealInterval.Closed(0.0, 1.0) ;"
"RealInterval.undefined() ;\n",
"RealInterval.closed(0.0, 1.0) ;"
]
},
{
Expand Down Expand Up @@ -113,7 +113,7 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.isDefined() ;"
"real_interval.is_defined() ;"
]
},
{
Expand All @@ -122,7 +122,7 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.isDegenerate() ;"
"real_interval.is_degenerate() ;"
]
},
{
Expand All @@ -140,7 +140,7 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.containsReal(0.0) ;"
"real_interval.contains_real(0.0) ;"
]
},
{
Expand All @@ -149,7 +149,7 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.containsInterval(real_interval) ;"
"real_interval.contains_interval(real_interval) ;"
]
},
{
Expand All @@ -158,8 +158,8 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.getLowerBound() ;\n",
"real_interval.getUpperBound() ;"
"real_interval.get_lower_bound() ;\n",
"real_interval.get_upper_bound() ;"
]
},
{
Expand All @@ -168,7 +168,7 @@
"metadata": {},
"outputs": [],
"source": [
"real_interval.toString() ;"
"real_interval.to_string() ;"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ inline void OpenSpaceToolkitMathematicsPy_Geometry_2D_Object
.def(self_ns::str(self_ns::self))
.def(self_ns::repr(self_ns::self))

.def("isDefined", &Object::isDefined)
.def("is_defined", &Object::isDefined)
.def("intersects", &Object::intersects)
.def("contains", &Object::contains)

.def("toString", &Object::toString)
.def("applyTransformation", &Object::applyTransformation)
.def("to_string", &Object::toString)
.def("apply_transformation", &Object::applyTransformation)

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ inline void OpenSpaceToolkitMathematicsPy_Geometry_2D_Object
.def(self_ns::str(self_ns::self))
.def(self_ns::repr(self_ns::self))

.def("isDefined", &LineString::isDefined)
.def("isEmpty", &LineString::isEmpty)
.def("isNear", &LineString::isNear)
.def("is_defined", &LineString::isDefined)
.def("is_empty", &LineString::isEmpty)
.def("is_near", &LineString::isNear)

.def("getPointCount", &LineString::getPointCount)
.def("getPointClosestTo", &LineString::getPointClosestTo)
.def("toString", &LineString::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_LineString_toString_overloads())
.def("applyTransformation", &LineString::applyTransformation)
.def("get_point_count", &LineString::getPointCount)
.def("get_point_closest_to", &LineString::getPointClosestTo)
.def("to_string", &LineString::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_LineString_toString_overloads())
.def("apply_transformation", &LineString::applyTransformation)

.def("Empty", &LineString::Empty).staticmethod("Empty")
.def("empty", &LineString::Empty).staticmethod("empty")

.def("__len__", &LineString::getPointCount)
.def("__getitem__", +[] (const LineString& aLineString, const size_t anIndex) -> const Point& { return aLineString.accessPointAt(anIndex) ; }, return_internal_reference<>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ inline void OpenSpaceToolkitMathematicsPy_Geometry_2D_Object

.def("__repr__", +[] (const Point& aPoint) -> std::string { return aPoint.toString() ; })

.def("isDefined", &Point::isDefined)
.def("isNear", &Point::isNear)
.def("is_defined", &Point::isDefined)
.def("is_near", &Point::isNear)

.def("x", &Point::x, return_value_policy<reference_existing_object>())
.def("y", &Point::y, return_value_policy<reference_existing_object>())
.def("asVector", &Point::asVector)
.def("distanceTo", &Point::distanceTo)
.def("toString", &Point::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_Point_toString_overloads())
.def("applyTransformation", &Point::applyTransformation)

.def("Undefined", &Point::Undefined).staticmethod("Undefined")
.def("Origin", &Point::Origin).staticmethod("Origin")
.def("Vector", &Point::Vector).staticmethod("Vector")
.def("as_vector", &Point::asVector)
.def("distance_to", &Point::distanceTo)
.def("to_string", &Point::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_Point_toString_overloads())
.def("apply_transformation", &Point::applyTransformation)

.def("undefined", &Point::Undefined).staticmethod("undefined")
.def("origin", &Point::Origin).staticmethod("origin")
.def("vector", &Point::Vector).staticmethod("vector")

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ inline void OpenSpaceToolkitMathematicsPy_Geometry_2D_Object
.def(self_ns::str(self_ns::self))
.def(self_ns::repr(self_ns::self))

.def("isDefined", &PointSet::isDefined)
.def("isEmpty", &PointSet::isEmpty)
.def("isNear", &PointSet::isNear)
.def("is_defined", &PointSet::isDefined)
.def("is_empty", &PointSet::isEmpty)
.def("is_near", &PointSet::isNear)

.def("getSize", &PointSet::getSize)
.def("getPointClosestTo", &PointSet::getPointClosestTo)
.def("toString", &PointSet::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_PointSet_toString_overloads())
.def("applyTransformation", &PointSet::applyTransformation)
.def("get_size", &PointSet::getSize)
.def("get_point_closest_to", &PointSet::getPointClosestTo)
.def("to_string", &PointSet::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_PointSet_toString_overloads())
.def("apply_transformation", &PointSet::applyTransformation)

.def("Empty", &PointSet::Empty).staticmethod("Empty")
.def("empty", &PointSet::Empty).staticmethod("empty")

.def("__iter__", boost::python::range(static_cast<PointSet::ConstIterator (PointSet::*)() const> (&PointSet::begin), static_cast<PointSet::ConstIterator (PointSet::*)() const> (&PointSet::end)))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,25 @@ inline void OpenSpaceToolkitMathematicsPy_Geometry_2D_Object
.def(self_ns::str(self_ns::self))
.def(self_ns::repr(self_ns::self))

.def("isDefined", &Polygon::isDefined)
.def("intersectsPolygon", +[] (const Polygon& aPolygon, const Polygon& anotherPolygon) -> bool { return aPolygon.intersects(anotherPolygon) ; })
.def("containsPoint", +[] (const Polygon& aPolygon, const Point& aPoint) -> bool { return aPolygon.contains(aPoint) ; })
.def("containsPointSet", +[] (const Polygon& aPolygon, const PointSet& aPointSet) -> bool { return aPolygon.contains(aPointSet) ; })

.def("getInnerRingCount", &Polygon::getInnerRingCount)
.def("getEdgeCount", &Polygon::getEdgeCount)
.def("getVertexCount", &Polygon::getVertexCount)
.def("getOuterRing", &Polygon::getOuterRing)
.def("getInnerRingAt", &Polygon::getInnerRingAt)
.def("getEdgeAt", &Polygon::getEdgeAt)
.def("getVertexAt", &Polygon::getVertexAt)
.def("getEdges", &Polygon::getEdges)
.def("getVertices", &Polygon::getVertices)
.def("toString", &Polygon::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_Polygon_toString_overloads())
// .def("unionWith", &Polygon::unionWith)
.def("applyTransformation", &Polygon::applyTransformation)

.def("Undefined", &Polygon::Undefined).staticmethod("Undefined")
.def("is_defined", &Polygon::isDefined)
.def("intersects_polygon", +[] (const Polygon& aPolygon, const Polygon& anotherPolygon) -> bool { return aPolygon.intersects(anotherPolygon) ; })
.def("contains_point", +[] (const Polygon& aPolygon, const Point& aPoint) -> bool { return aPolygon.contains(aPoint) ; })
.def("contains_point_set", +[] (const Polygon& aPolygon, const PointSet& aPointSet) -> bool { return aPolygon.contains(aPointSet) ; })

.def("get_inner_ring_count", &Polygon::getInnerRingCount)
.def("get_edge_count", &Polygon::getEdgeCount)
.def("get_vertex_count", &Polygon::getVertexCount)
.def("get_outer_ring", &Polygon::getOuterRing)
.def("get_inner_ring_at", &Polygon::getInnerRingAt)
.def("get_edge_at", &Polygon::getEdgeAt)
.def("get_vertex_at", &Polygon::getVertexAt)
.def("get_edges", &Polygon::getEdges)
.def("get_vertices", &Polygon::getVertices)
.def("to_string", &Polygon::toString, OpenSpaceToolkitMathematicsPy_Geometry_2D_Objects_Polygon_toString_overloads())
// .def("union_with", &Polygon::unionWith)
.def("apply_transformation", &Polygon::applyTransformation)

.def("undefined", &Polygon::Undefined).staticmethod("undefined")

;

Expand Down
Loading

0 comments on commit ab898ce

Please sign in to comment.