Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
619 additions
and
28 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
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
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,76 @@ | ||
/*************************************************************************** | ||
* Copyright (c) sliptonic (shopinthewoods@gmail.com) 2020 * | ||
* * | ||
* This file is part of the FreeCAD CAx development system. * | ||
* * | ||
* This library is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Library General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; see the file COPYING.LIB. If not, * | ||
* write to the Free Software Foundation, Inc., 59 Temple Place, * | ||
* Suite 330, Boston, MA 02111-1307, USA * | ||
* * | ||
***************************************************************************/ | ||
|
||
|
||
#include "PreCompiled.h" | ||
|
||
#ifndef _PreComp_ | ||
# include <cinttypes> | ||
# include <iomanip> | ||
# include <boost/algorithm/string.hpp> | ||
# include <boost/lexical_cast.hpp> | ||
#endif | ||
|
||
#include <Base/Vector3D.h> | ||
#include <Base/Writer.h> | ||
#include <Base/Reader.h> | ||
#include <Base/Exception.h> | ||
#include "Voronoi.h" | ||
#include "VoronoiEdge.h" | ||
|
||
using namespace Base; | ||
using namespace Path; | ||
|
||
TYPESYSTEM_SOURCE(Path::VoronoiEdge , Base::Persistence) | ||
|
||
VoronoiEdge::VoronoiEdge(Voronoi::diagram_type *d, long index) | ||
: dia(d) | ||
, index(index) | ||
, ptr(0) | ||
{ | ||
if (dia && long(dia->num_edges()) > index) { | ||
ptr = &(dia->edges()[index]); | ||
} | ||
} | ||
|
||
VoronoiEdge::VoronoiEdge(Voronoi::diagram_type *d, const Voronoi::diagram_type::edge_type *e) | ||
: dia(d) | ||
, index(Voronoi::InvalidIndex) | ||
, ptr(e) | ||
{ | ||
if (d && e) { | ||
index = dia->index(e); | ||
} | ||
} | ||
|
||
VoronoiEdge::~VoronoiEdge() { | ||
} | ||
|
||
bool VoronoiEdge::isBound(void) const { | ||
if (ptr != 0 && dia.isValid() && index != Voronoi::InvalidIndex) { | ||
if (&(dia->edges()[index]) == ptr) { | ||
return true; | ||
} | ||
} | ||
ptr = 0; | ||
return false; | ||
} |
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,54 @@ | ||
/*************************************************************************** | ||
* Copyright (c) sliptonic (shopinthewoods@gmail.com) 2020 * | ||
* * | ||
* This file is part of the FreeCAD CAx development system. * | ||
* * | ||
* This library is free software; you can redistribute it and/or * | ||
* modify it under the terms of the GNU Library General Public * | ||
* License as published by the Free Software Foundation; either * | ||
* version 2 of the License, or (at your option) any later version. * | ||
* * | ||
* This library is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* GNU Library General Public License for more details. * | ||
* * | ||
* You should have received a copy of the GNU Library General Public * | ||
* License along with this library; see the file COPYING.LIB. If not, * | ||
* write to the Free Software Foundation, Inc., 59 Temple Place, * | ||
* Suite 330, Boston, MA 02111-1307, USA * | ||
* * | ||
***************************************************************************/ | ||
#ifndef PATH_VORONOIEDGE_H | ||
#define PATH_VORONOIEDGE_H | ||
|
||
#include <Base/Handle.h> | ||
#include <Base/BaseClass.h> | ||
#include <Base/Vector3D.h> | ||
#include <Base/VectorPy.h> | ||
#include "Voronoi.h" | ||
|
||
namespace Path | ||
{ | ||
|
||
class Voronoi; | ||
|
||
class PathExport VoronoiEdge | ||
: public Base::BaseClass | ||
{ | ||
TYPESYSTEM_HEADER(); | ||
public: | ||
|
||
VoronoiEdge(Voronoi::diagram_type *dia = 0, long index = Voronoi::InvalidIndex); | ||
VoronoiEdge(Voronoi::diagram_type *dia, const Voronoi::diagram_type::edge_type *edge); | ||
~VoronoiEdge(); | ||
|
||
bool isBound(void) const; | ||
|
||
Base::Reference<Voronoi::diagram_type> dia; | ||
long index; | ||
mutable const Voronoi::diagram_type::edge_type *ptr; | ||
}; | ||
|
||
} | ||
#endif |
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,101 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd"> | ||
<PythonExport | ||
Father="BaseClassPy" | ||
Name="VoronoiEdgePy" | ||
Twin="VoronoiEdge" | ||
TwinPointer="VoronoiEdge" | ||
Include="Mod/Path/App/Voronoi.h" | ||
FatherInclude="Base/BaseClassPy.h" | ||
Namespace="Path" | ||
FatherNamespace="Base" | ||
Constructor="true" | ||
RichCompare="true" | ||
Delete="true"> | ||
<Documentation> | ||
<Author Licence="LGPL" Name="sliptonic" EMail="shopinthewoods@gmail.com" /> | ||
<UserDocu>Edge of a Voronoi diagram</UserDocu> | ||
</Documentation> | ||
<Attribute Name="Color" ReadOnly="false"> | ||
<Documentation> | ||
<UserDocu>Assigned color of the receiver.</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Color" Type="Int"/> | ||
</Attribute> | ||
<!-- | ||
<Attribute Name="Cell" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>cell the edge belongs to</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Cell" Type="Object"/> | ||
</Attribute> | ||
--> | ||
<Attribute Name="Vertices" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>Begin and End voronoi vertex</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Vertices" Type="List"/> | ||
</Attribute> | ||
<Attribute Name="Next" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>CCW next edge whithin voronoi cell</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Next" Type="Object"/> | ||
</Attribute> | ||
<Attribute Name="Prev" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>CCW previous edge whithin voronoi cell</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Prev" Type="Object"/> | ||
</Attribute> | ||
<Attribute Name="RotatedNext" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>Rotated CCW next edge whithin voronoi cell</UserDocu> | ||
</Documentation> | ||
<Parameter Name="RotatedNext" Type="Object"/> | ||
</Attribute> | ||
<Attribute Name="RotatedPrev" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>Rotated CCW previous edge whithin voronoi cell</UserDocu> | ||
</Documentation> | ||
<Parameter Name="RotatedPrev" Type="Object"/> | ||
</Attribute> | ||
<Attribute Name="Twin" ReadOnly="true"> | ||
<Documentation> | ||
<UserDocu>Twin edge</UserDocu> | ||
</Documentation> | ||
<Parameter Name="Twin" Type="Object"/> | ||
</Attribute> | ||
<Methode Name="isFinite" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns true if both vertices are finite</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="isInfinite" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns true if the end vertex is infinite</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="isLinear" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns true if edge is straight</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="isCurved" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns true if edge is curved</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="isPrimary" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns false if edge goes through endpoint of the segment site</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
<Methode Name="isSecondary" Const="true"> | ||
<Documentation> | ||
<UserDocu>Returns true if edge goes through endpoint of the segment site</UserDocu> | ||
</Documentation> | ||
</Methode> | ||
--> | ||
</PythonExport> | ||
</GenerateModel> |
Oops, something went wrong.