Skip to content

Commit

Permalink
Merge pull request #3978 from mlampert/feature/path-voronoi-vcarve-re…
Browse files Browse the repository at this point in the history
…factor

Path: Feature/path voronoi vcarve refactor
  • Loading branch information
sliptonic committed Oct 26, 2020
2 parents 0fdd157 + 1e687bb commit 66d3f7b
Show file tree
Hide file tree
Showing 12 changed files with 632 additions and 318 deletions.
1 change: 1 addition & 0 deletions src/Mod/Path/App/Voronoi.h
Expand Up @@ -58,6 +58,7 @@ namespace Path

// types
typedef double coordinate_type;
typedef boost::polygon::voronoi_vertex<double> vertex_type;
typedef boost::polygon::point_data<coordinate_type> point_type;
typedef boost::polygon::segment_data<coordinate_type> segment_type;
typedef boost::polygon::voronoi_diagram<double> voronoi_diagram_type;
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/App/VoronoiCellPy.xml
Expand Up @@ -5,7 +5,7 @@
Name="VoronoiCellPy"
Twin="VoronoiCell"
TwinPointer="VoronoiCell"
Include="Mod/Path/App/Voronoi.h"
Include="Mod/Path/App/VoronoiCell.h"
FatherInclude="Base/BaseClassPy.h"
Namespace="Path"
FatherNamespace="Base"
Expand Down
19 changes: 9 additions & 10 deletions src/Mod/Path/App/VoronoiCellPyImp.cpp
Expand Up @@ -27,19 +27,18 @@
# include <boost/algorithm/string.hpp>
#endif

#include "Base/Exception.h"
#include "Base/GeometryPyCXX.h"
#include "Base/PlacementPy.h"
#include "Base/Vector3D.h"
#include "Base/VectorPy.h"
#include "Mod/Path/App/Voronoi.h"
#include "Mod/Path/App/VoronoiCell.h"
#include "Mod/Path/App/VoronoiCellPy.h"
#include "Mod/Path/App/VoronoiEdge.h"
#include "Mod/Path/App/VoronoiEdgePy.h"
#include <Base/Exception.h>
#include <Base/GeometryPyCXX.h>
#include <Base/PlacementPy.h>
#include <Base/Vector3D.h>
#include <Base/VectorPy.h>

// files generated out of VoronoiCellPy.xml
#include "VoronoiCellPy.cpp"
#include "Mod/Path/App/VoronoiCellPy.cpp"

using namespace Path;

Expand Down Expand Up @@ -75,14 +74,14 @@ int VoronoiCellPy::PyInit(PyObject* args, PyObject* /*kwd*/)


PyObject* VoronoiCellPy::richCompare(PyObject *lhs, PyObject *rhs, int op) {
PyObject *cmp = Py_False;
PyObject *cmp = (op == Py_EQ) ? Py_False : Py_True;
if ( PyObject_TypeCheck(lhs, &VoronoiCellPy::Type)
&& PyObject_TypeCheck(rhs, &VoronoiCellPy::Type)
&& op == Py_EQ) {
&& (op == Py_EQ || op == Py_NE)) {
const VoronoiCell *vl = static_cast<VoronoiCellPy*>(lhs)->getVoronoiCellPtr();
const VoronoiCell *vr = static_cast<VoronoiCellPy*>(rhs)->getVoronoiCellPtr();
if (vl->index == vr->index && vl->dia == vr->dia) {
cmp = Py_True;
cmp = (op == Py_EQ) ? Py_True : Py_False;
}
}
Py_INCREF(cmp);
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Path/App/VoronoiEdgePy.xml
Expand Up @@ -5,7 +5,7 @@
Name="VoronoiEdgePy"
Twin="VoronoiEdge"
TwinPointer="VoronoiEdge"
Include="Mod/Path/App/Voronoi.h"
Include="Mod/Path/App/VoronoiEdge.h"
FatherInclude="Base/BaseClassPy.h"
Namespace="Path"
FatherNamespace="Base"
Expand Down Expand Up @@ -100,9 +100,9 @@
<UserDocu>Returns true if edge goes through endpoint of the segment site</UserDocu>
</Documentation>
</Methode>
<Methode Name="toGeom" Const="true">
<Methode Name="toShape" Const="true">
<Documentation>
<UserDocu>Returns a geom representation of the edge (line segment or arc of parabola)</UserDocu>
<UserDocu>Returns a shape for the edge</UserDocu>
</Documentation>
</Methode>
<Methode Name="getDistances" Const="true">
Expand Down

0 comments on commit 66d3f7b

Please sign in to comment.