API

C++ API

template<typename Scalar>
class _Polygon
#include <Polygon.h>

: Polygon class

Note

: we do not name the class as Polygon to avoid confusion with Polygon defined in windows.h

Subclassed by Cross< Scalar >

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef Matrix<int, 3, 1> Vector3i
typedef shared_ptr<Triangle<Scalar>> pTriangle
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef shared_ptr<VTex<Scalar>> pVTex

Public Functions

_Polygon()
_Polygon(const _Polygon &poly)
~_Polygon()
void setVertices(vector<Vector3> _vers)
size_t push_back(Vector3 pt)
size_t push_back(Vector3 pt, Vector2 tex)
void reverseVertices()
void setPolyType(int _polyType)
void setPolyType(PolygonType _polyType)
void translatePolygon(Vector3 transVec)
void translatePolygonTex(Vector2 transVec)
void clear()
Vector3 pos(int index)
Vector2 tex(int index)
bool at_boundary(int edge_index) const
bool checkEquality(const _Polygon &poly) const
void print() const
size_t size() const
vector<Vector3> getVertices() const
vector<Vector2> getVerticesTex() const
int getPolyType() const
Vector3 center() const
Vector3 normal() const
Vector3 computeFitedPlaneNormal() const
Scalar area() const
Scalar average_edge() const
Scalar max_radius() const
void computeFrame(Vector3 &x_axis, Vector3 &y_axis, Vector3 &origin) const
vector<Scalar> computeBaryCentric(Vector2 pt) const
vector<Scalar> computeBaryCentric(Vector2 sta, Vector2 end, Vector2 pt) const
void triangulateNaive(vector<pTriangle> &tris) const
void triangulate(vector<pTriangle> &tris) const
int getPtVerID(Vector3 point) const

Public Members

vector<pVertex> vers
vector<pVTex> texs
vector<bool> edge_at_boundary

Private Members

PolygonType polyType
template<typename Scalar>
class AABBTree_Line

Public Types

typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX
typedef Matrix<int, Eigen::Dynamic, Eigen::Dynamic> MatrixXi
typedef Matrix<Scalar, 2, 1> Vector2
typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

void init(MatrixX V, MatrixX T, MatrixXi F)
bool findIntersec(const Line<Scalar> &line, Vector2 &tex2D, Vector3 &pos3D)

Search for an intersection between a given line and the lines defined in AABB tree.

Return

true/false if an instersection is found

Parameters
  • line:

  • tex2D:

  • pos3D:

  • node:

bool findIntersecFromNode(const Line<Scalar> &line, Vector2 &tex2D, Vector3 &pos3D, shared_ptr<Node> node)

Search for an intersection between a given line and the lines defined in AABB tree from a given node.

Return

true/false if an instersection is found

Parameters
  • line:

  • tex2D:

  • pos3D:

  • node:

bool checkLineBoxIntersec(const Line<Scalar> &line, const Box<Scalar> &box)

Find if a 2D line is intersecting with a given box.

Return

Parameters
  • line:

  • box:

bool checkRayBoxIntersec(const Vector2 &ray, const Vector2 &origin, const Box<Scalar> &box)

Find if there is a ray-box intersection.

Return

See

: https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-box-intersection

Parameters
  • ray:

  • origin:

  • box:

bool checkLineLineIntersec(const Line<Scalar> &l0, const Line<Scalar> &l1, Vector2 &pt)

Search for the intersection between two lines.

Return

See

: http://flassari.is/2008/11/line-line-intersection-in-cplusplus/

Parameters
  • l0: line1

  • l1: line2

  • pt: intersection coordinates

Public Members

vector<shared_ptr<Node>> nodes
vector<weak_ptr<Node>> roots
template<typename Scalar>
class AugmentedVectorCreator : public TopoObject
#include <AugmentedVectorCreator.h>

: Create CrossMesh by Input the polygonal mesh and tiltAngle

Public Types

typedef shared_ptr<CrossMesh<Scalar>> pCrossMesh
typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh
typedef shared_ptr<Cross<Scalar>> pCross
typedef weak_ptr<Cross<Scalar>> wpCross
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

AugmentedVectorCreator(shared_ptr<InputVarList> var)
~AugmentedVectorCreator()
void createAugmentedVectors(Scalar tiltAngle, pCrossMesh crossMesh)

Create crossMesh by setting alterative tiltAngle in polyMesh.

Note

This is the main function

void updateAugmentedVectors(Scalar tiltAngle, pCrossMesh crossMesh)
void InitMeshTiltNormalsResolveConflicts(pCrossMesh crossMesh, Scalar tiltAngle)

Distribute the sign of each tilt angle.

bool UpdateMeshTiltRange(pCrossMesh crossMesh)

Public Static Functions

void InitMeshTiltNormals(pCrossMesh crossMesh)

Set initial tilt angle for each cross.

Note

: the initial tilt angle is 0.

class Bezier::AxisAlignedBoundingBox

Public Functions

AxisAlignedBoundingBox(const Point &p0, const Point &p1, const Point &p2, const Point &p3)
AxisAlignedBoundingBox(const ExtremePoints &xPoints)
float minX() const
float maxX() const
float minY() const
float maxY() const
float width() const
float height() const
float area() const
Point &operator[](size_t idx)
Point operator[](size_t idx) const

Public Static Functions

constexpr size_t size()

Private Members

Point points[4]
template<typename Scalar>
class BaseMeshCreator : public TopoObject
#include <BaseMeshCreator.h>

Mapping the 2D pattern into the 3D surface.

Return

the base polygonal mesh

Public Types

typedef shared_ptr<PolyMesh_AABBTree<Scalar>> pPolyMeshAABB
typedef weak_ptr<PolyMesh_AABBTree<Scalar>> wpPolyMeshAABB
typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh
typedef weak_ptr<PolyMesh<Scalar>> wpPolyMesh
typedef shared_ptr<CrossMesh<Scalar>> pCrossMesh
typedef weak_ptr<CrossMesh<Scalar>> wpCrossMesh
typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef weak_ptr<_Polygon<Scalar>> wpPolygon
typedef shared_ptr<Cross<Scalar>> pCross
typedef weak_ptr<Cross<Scalar>> wpCross
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef Matrix<Scalar, 4, 4> Matrix4
typedef std::unordered_map<Cross<Scalar>*, int> mapCrossInt

Public Functions

BaseMeshCreator(pPolyMeshAABB _polyMesh, pCrossMesh _pattern2D, shared_ptr<InputVarList> varList)
BaseMeshCreator(shared_ptr<InputVarList> varList)
~BaseMeshCreator()
void computeBaseCrossMesh(Matrix<Scalar, 4, 4> textureMat, pPolyMesh &baseMesh2D, pCrossMesh &crossMesh, bool previewMode = false)

: main function for mapping the 2D pattern into 3D surface

Note

: it requires polyMesh with texture.

Parameters
  • [in] polyMesh: input 3D guide surface

  • [in] pattern2D: input 2D pattern

  • [in] inverTextureMat: Map from 2D pattern space to surface texture space

  • [out] baseMesh2D: output the base 2D mesh

  • [out] baseMesh: output the base mesh

void computeInternalCross(Matrix4 textureMat, pPolyMesh &baseMesh2D, pCrossMesh &crossMesh)
void computeBoundaryCross(Matrix4 textureMat, pPolyMesh &baseMesh2D, pCrossMesh &crossMesh)
void removeSmallCrosses(pCrossMesh crossMesh)
void recomputeBoundary(pCrossMesh crossMesh)
void removeDanglingCross(pCrossMesh crossMesh)
Vector2 getTextureCoord(Vector2 point, Matrix4 textureMat)

: scale the 2D pattern position into UV space

bool mapTexPointBackToSurface(Vector2 ptTexCoord, Vector3 &ptSurfCoord)

: project the 2D ptTexCoord into the Surface

Return

: the 3D position of 2D pattern vertices

void splitIntoConsecutivePolygons(const vector<Line<Scalar>> &line, const vector<bool> &inside, tbb::concurrent_vector<pPolygon> &polyList)

Public Members

vector<pVertex> pattern2D_vertices_on_polyMesh
tbb::concurrent_vector<pPolygon> boundary_pattern2D
wpPolyMeshAABB polyMesh
wpCrossMesh pattern2D
const float viewSize = 2.0
template<size_t N>
class Bezier::Bezier

Public Functions

Bezier()
Bezier(const std::vector<Point> &controlPoints)
Bezier(const Bezier<N> &other)
size_t order() const
size_t size() const
Bezier<N - 1> derivative() const
double valueAt(float t, size_t axis) const
Point valueAt(float t) const
Tangent tangentAt(float t, bool normalize = true) const
Normal normalAt(float t, bool normalize = true) const
void translate(const Vec2 &distance)
void translate(float dx, float dy)
void rotate(double angle, Vec2 pivot = Vec2(0, 0))
ExtremeValues derivativeZero(size_t intervals = BEZIER_DEFAULT_INTERVALS, double epsilon = BEZIER_FUZZY_EPSILON, size_t maxIterations = BEZIER_DEFAULT_MAX_ITERATIONS) const
ExtremePoints extremePoints() const
AxisAlignedBoundingBox aabb() const
AxisAlignedBoundingBox aabb(const ExtremePoints &xPoints) const
TightBoundingBox tbb() const
Point &operator[](size_t idx)
Point operator[](size_t idx) const

Public Static Attributes

const BinomialCoefficients<N> binomialCoefficients = BinomialCoefficients<N>()
const PolynomialCoefficients<N> polynomialCoefficients = PolynomialCoefficients<N>()

Private Functions

ExtremeValues derivativeZero1() const
ExtremeValues derivativeZero2() const
ExtremeValues derivativeZero3() const
ExtremeValues newtonRhapson(size_t intervals = BEZIER_DEFAULT_INTERVALS, double epsilon = BEZIER_FUZZY_EPSILON, size_t maxIterations = BEZIER_DEFAULT_MAX_ITERATIONS) const

Private Members

Point mControlPoints[N + 1]
template<size_t N>
class Bezier::BinomialCoefficients

Public Functions

BinomialCoefficients()
const size_t operator[](size_t idx) const

Public Static Functions

constexpr size_t size()

Private Members

float mCoefficients[size()]
template<typename Scalar>
struct Box

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

Box()
Box(const Line<Scalar> &line)
Box(const Box<Scalar> &b0, const Box<Scalar> &b1)
Box &operator=(const Box &box)
void print()
void computeCenter()
void computeSize()
void executeTransform(Vector3 transVec, Vector3 scale)
Scalar computeQuadArea()

Public Members

Vector3 minPt
Vector3 maxPt
Vector3 cenPt
Vector3 size
template<typename Scalar>
class ContactGraph : public TopoObject

Public Types

typedef shared_ptr<ContactGraphNode<Scalar>> pContactGraphNode
typedef shared_ptr<ContactGraphEdge<Scalar>> pContactGraphEdge
typedef weak_ptr<ContactGraphEdge<Scalar>> wpContactGraphEdge
typedef weak_ptr<ContactGraphNode<Scalar>> wpContactGraphNode
typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef weak_ptr<_Polygon<Scalar>> wpPolygon
typedef Matrix<Scalar, 3, 1> Vector3
typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh

Public Functions

ContactGraph(const shared_ptr<InputVarList> &varList)

Class constructor.

Template Parameters
  • Scalar:

Parameters
  • varList:

~ContactGraph()

Class destructor.

Template Parameters
  • Scalar:

bool buildFromMeshes(const vector<pPolyMesh> &meshes, vector<bool> &atBoundary, Scalar eps = 0.002, bool convexhull = true)

build the graph from a list of polygonal meshes

Return

Template Parameters
  • Scalar:

Parameters
  • meshes:

  • atBoundary:

  • eps:

  • convexhull: : merges faces which on a same plane by its convexhull

void addNode(pContactGraphNode _node)

Template Parameters
  • Scalar:

Parameters
  • _node:

void addContact(pContactGraphNode _nodeA, pContactGraphNode _nodeB, pContactGraphEdge _edge)

Template Parameters
  • Scalar:

Parameters
  • _nodeA:

  • _nodeB:

  • _edge:

void mergeNode(pContactGraphNode _nodeA, pContactGraphNode _nodeB)

merging nodeA and nodeB. they should move together.

Template Parameters
  • Scalar:

Parameters
  • _nodeA_nodeB:

void finalize()

Assign nodeID to the graph. Must be called after updating the graph.

Template Parameters
  • Scalar:

void getContactMesh(pPolyMesh &mesh)

return the all contact polygons as a mesh

Template Parameters
  • Scalar:

Parameters
  • mesh:

Public Members

vector<pContactGraphNode> nodes
vector<pContactGraphEdge> edges
vector<pContactGraphEdge> contact_edges
vector<std::pair<wpContactGraphNode, wpContactGraphNode>> merged_nodes
vector<wpContactGraphNode> dynamic_nodes

Private Functions

bool clusterFacesofInputMeshes(Scalar eps)

extract all polygonal faces from the meshes_input and cluster the faces which are on a same plane.

Return

Template Parameters
  • Scalar:

Parameters
  • eps:

void listPotentialContacts(vector<bool> &atBoundary)

find all pairs of faces which are on a same plane. Their normals have to be on opposite directions

Template Parameters
  • Scalar:

Parameters
  • atBoundary:

void computeContacts()

Parallel compute contacts. Though faces in the ‘contact_pairs’ are on the same plane, checking whether they are overlap needs the 2D poly-poly intersection tool.

Template Parameters
  • Scalar:

void buildNodes(vector<bool> &atBoundary)

add each part as a node into the graph

Template Parameters
  • Scalar:

Parameters
  • atBoundary:

void buildEdges()

for all pairs of potential contact faces, if their contact_graphedges is not empty, then we add this edge into the graph

Template Parameters
  • Scalar:

void computeConvexHullofEdgePolygons()

simplified the contact between two nodes, only compute their convex-hull

Template Parameters
  • Scalar:

Private Members

vector<pPolyMesh> meshes_input
vector<polygonal_face> contact_faces
vector<pairIJ> contact_pairs
vector<pContactGraphEdge> contact_graphedges
template<typename Scalar>
class ContactGraphEdge
#include <ContactGraphEdge.h>

: Stores which parts are contacted and the contact’s geometry

Public Types

typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

ContactGraphEdge(pPolygon &_polygon, Vector3 &_normal)
ContactGraphEdge(vector<pPolygon> &_polygons, Vector3 &_normal)
Vector3 getContactNormal(int partID)

Return

the contact normal starts from partID

void get_norm_fric_for_block(int partID, Vector3 &normal, Vector3 &ufric, Vector3 &vfric)
int num_points()
size_t size()
bool check_on_same_plane(shared_ptr<ContactGraphEdge<Scalar>> e)

Public Members

vector<pPolygon> polygons
Vector3 normal
int partIDA
int partIDB
template<typename Scalar>
class ContactGraphNode
#include <ContactGraphNode.h>

Graph node records one part’s geometry and contacts with its neighbors.

Public Types

typedef shared_ptr<ContactGraphNode<Scalar>> pContactGraphNode
typedef shared_ptr<ContactGraphEdge<Scalar>> pContactGraphEdge
typedef weak_ptr<ContactGraphEdge<Scalar>> wpContactGraphEdge
typedef weak_ptr<ContactGraphNode<Scalar>> wpContactGraphNode
using ContactNeighbor = pair<wpContactGraphNode, wpContactGraphEdge>
typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

ContactGraphNode(bool _isBoundary, Vector3 _centroid, Vector3 _centerofmass, float _mass)
float height()

Public Members

bool isBoundary
Vector3 centroid
Vector3 centerofmass
float mass
vector<ContactNeighbor> neighbors
int staticID
int dynamicID
template<typename Scalar>
class ConvexBlock : public TopoObject

Public Types

typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh
typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef weak_ptr<Cross<Scalar>> wpCross
typedef shared_ptr<Cross<Scalar>> pCross
typedef shared_ptr<HypPlane<Scalar>> pHypPlane
typedef shared_ptr<HypVertex<Scalar>> pHypVertex
typedef Matrix<Scalar, 2, 1> Vector2
typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

ConvexBlock(pCross cross, Vector2 _cutter_heights)
ConvexBlock(const ConvexBlock &part)
~ConvexBlock()
void clear()
void print()
void computeCorners()
void computeHyperPlanes()
void computeFaces()
bool checkGeometry()
bool compute()
bool at_boundary()

Public Members

wpCross cross
pPolyMesh polyMesh
Vector2 cutter_heights
int partID

Private Members

vector<pHypPlane> hypList
vector<pHypVertex> corners
template<typename Scalar>
class ConvexHull2D

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef std::vector<Matrix<Scalar, 3, 1>> ListVector3

Public Functions

ConvexHull2D()
void compute(const ListVector3 &in, ListVector3 &out)
void compute(const ListVector3 &in, Vector3 normal, ListVector3 &out)

Private Functions

Scalar cross(const Vector3 &O, const Vector3 &A, const Vector3 &B)
void sortXY(ListVector3 &Array)
template<typename Scalar>
class ConvexHull3D

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef std::vector<Matrix<Scalar, 3, 1>> ListVector3
typedef std::vector<Matrix<int, 3, 1>> ListVector3i

Public Functions

void compute(ListVector3 &pointList, ListVector3 &ver, ListVector3i &tri)
void compute(ListVector3 &pointList, Matrix<Scalar, Dynamic, Dynamic> &V, Matrix<int, Dynamic, Dynamic> &F)
template<typename Scalar>
class Cross : public _Polygon<Scalar>, public TopoObject

Public Types

typedef shared_ptr<Cross<Scalar>> pCross
typedef weak_ptr<Cross<Scalar>> wpCross
typedef Eigen::Matrix<Scalar, 3, 1> Vector3
typedef shared_ptr<VPoint<Scalar>> pVertex

Public Functions

Cross(const _Polygon<Scalar> &polygon, std::shared_ptr<InputVarList> var)
Cross(const Cross<Scalar> &cross)
Cross(std::shared_ptr<InputVarList> var)
~Cross()
void print() const override
void clear()
shared_ptr<OrientPoint<Scalar>> ori(int index)
pCross nei(int index)
void initTiltNormals()

Compute Initial Tilt Normal, the rotation angle is 0.

void updateTiltNormalsRoot(float tiltAngle)

: Initially update all oriPoints in this cross

1) alternatively update the sign by following the order as oriPoints

2) the sign of first orient point is positive

void updateTiltNormals(float tiltAngle, const std::unordered_map<Cross<Scalar>*, bool> &crossVisited)

: Update oriPoints in this cross

1) Apply breadth first search

2) The sign of some orient point could be changed in order to resolve conflict

3) In odd polygon, neighboring orient point could have same sign

int getEdgeIDSharedWithCross(const Cross<Scalar> *ncross)

: found the EdgeID (order in oriPoints) which correspond crossID is currCrossID

get the edgeID shared between two crosses or NOT_FOUND

Return

EdgeID the local index of a polygon vertex

Template Parameters
  • Scalar:

Parameters
  • ncross: the 2nd cross

int getEdgeIDOfGivenVertexID(int vertexID)

get the local index of a vertex in a given polygon

fixme: edgeID is not a well chosen name. We should think of changing.

Return

EdgeID the local index of a polygon vertex

Template Parameters
  • Scalar:

Parameters
  • vertexID:

int getCrossIDsSharedWithCross(const Cross<Scalar> *ncross, vector<int> &shared_crossIDs)

Fills up a vector with the IDs of crosses shared between this cross and another one. A cross is shared if in contact with both other crosses.

Return

The size this crossIDs vector or NOT_FOUND

Template Parameters
  • Scalar:

Parameters
  • ncross: the cross you want to check

  • shared_crossIDs: the vector of crossIDs

int getPrevEdgeID(int edgeID)

search for the previous local index of local index

fixme: edgeID is not a well chosen name. We should think of changing.

Return

the previous local index

Template Parameters
  • Scalar:

Parameters
  • edgeID: the input local index

bool checkNeighborAtBoundary(int nID)

Public Members

int crossID
bool atBoundary
vector<wpCross> neighbors
vector<shared_ptr<OrientPoint<Scalar>>> oriPoints
template<typename Scalar>
class CrossMesh : private PolyMesh<Scalar>

Public Types

using pCross = shared_ptr<Cross<Scalar>>
using wpCross = weak_ptr<Cross<Scalar>>
using pPolygon = shared_ptr<_Polygon<Scalar>>
using pTriangle = shared_ptr<Triangle<Scalar>>
typedef Eigen::Matrix<Scalar, 3, 1> Vector3
typedef Eigen::Matrix<Scalar, 2, 1> Vector2
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef shared_ptr<VTex<Scalar>> pVTex
typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh

Public Functions

CrossMesh(std::shared_ptr<InputVarList> var)
CrossMesh(const CrossMesh &_cross)
CrossMesh(const PolyMesh<Scalar> &polyMesh)
~CrossMesh()
void setPolyMesh(const PolyMesh<Scalar> &polyMesh)
void update()
void setBaseMesh2D(shared_ptr<PolyMesh<Scalar>> _baseMesh2D)
void createConnectivity()
void print() const
bool parse(const nlohmann::json &mesh_json)
nlohmann::json dump() const
void clear()
void push_back(pCross _cross)
void set_cross(size_t index, pCross _cross)
pCross cross(size_t index)
void erase(size_t index)
void erase_nullptr()
size_t size() const
const vector<wpCross> &getVertexCrosses(int verID)
pPolyMesh getPolyMesh() const
vector<int> getBoundaryCrossIDs() const
void updateCrossID()
Scalar computeAverageCrossSize() const

Public Members

pPolyMesh baseMesh2D

Private Functions

pCross getNeighbor(pCross cross, pVertex v0, pVertex v1) const

Private Members

vector<pCross> crossList
vector<vector<wpCross>> vertexCrossList
template<typename Scalar>
class CrossMeshCreator : public TopoObject
#include <CrossMeshCreator.h>

CrossMesh = BaseMesh + AugmentedVector

Public Types

typedef shared_ptr<PolyMesh_AABBTree<Scalar>> pPolyMeshAABB
typedef weak_ptr<PolyMesh_AABBTree<Scalar>> wpPolyMeshAABB
typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh
typedef weak_ptr<PolyMesh<Scalar>> wpPolyMesh
typedef shared_ptr<CrossMesh<Scalar>> pCrossMesh
typedef weak_ptr<CrossMesh<Scalar>> wpCrossMesh
typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef weak_ptr<_Polygon<Scalar>> wpPolygon
typedef shared_ptr<Cross<Scalar>> pCross
typedef weak_ptr<Cross<Scalar>> wpCross
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef shared_ptr<VTex<Scalar>> pVTex
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef Matrix<Scalar, 4, 4> Matrix4
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX
typedef Matrix<int, Eigen::Dynamic, Eigen::Dynamic> MatrixXi
typedef std::unordered_map<Cross<Scalar>*, int> mapCrossInt

Public Functions

CrossMeshCreator(const CrossMeshCreator &_model)
CrossMeshCreator(shared_ptr<InputVarList> var)
~CrossMeshCreator()
void clear()
bool loadSurface(const char *objFileName)

: load a .obj model from file

Parameters
  • objFileName: .obj file path

  • texturedModel: True if use the texture

bool setReferenceSurface(pPolyMesh surface)
bool setPatternMesh(pPolyMesh surface)
bool setCrossMesh(pCrossMesh crossmesh)
bool updatePatternMesh()

: function to create the 2D tiling pattern by using the method in PatternCreator.cpp/.h

bool createCrossMeshFromRSnPattern(bool previewMode, Matrix4 textureMat)

: main function to create base CrossMesh

Parameters
  • texturedModel: True if the geometry of cross mesh is unknown. False if the polymesh just need to be assigned the tilt angle

  • previewMode: True if unnecessary operations are dismissed.

bool createAugmentedVectors()

: function to update the augmented vectors of each edge in cross mesh

bool updateAugmentedVectors()

: function to update the augmented vectors of each edge in cross mesh

bool updateCrossMeshBoundary(const vector<int> &boundary_crossIDs)

: function to update the boundary of the crossmesh

bool computeAugmentedRange()

: function to update the valid range of augmented vector

Matrix4 computeTextureMat_backwards_compatible(Matrix4 interactMat)

Public Members

pPolyMeshAABB referenceSurface
pCrossMesh crossMesh
pCrossMesh pattern2D

Private Functions

void recomputeTexture()
struct InterlockingSolver::EquilibriumData

Public Members

stdvec_Vector3 force
stdvec_Vector3 torque
stdvec_Vector3 contact_points
vector<pairIJ> partIJ
class Bezier::ExtremePoints

Public Functions

bool add(float x, float y)
bool add(const Point &extremePoint)
size_t size() const
bool empty() const
Point &operator[](size_t idx)
Point operator[](size_t idx) const

Private Members

std::vector<Point> points
struct Bezier::ExtremeValue

Public Functions

ExtremeValue(float t, size_t axis)
bool fuzzyEquals(const ExtremeValue &other) const

Public Members

const float t
const size_t axis
class Bezier::ExtremeValues

Public Functions

bool add(float t, size_t axis)
bool add(const ExtremeValue &val)
size_t size() const
ExtremeValue &operator[](size_t idx)
ExtremeValue operator[](size_t idx) const

Private Members

std::vector<ExtremeValue> values
template<typename Scalar>
struct HypEdge

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Members

int edgeID
Vector3 point
Vector3 normal
int planeIDs[2]
template<typename Scalar>
struct HypPlane

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

double getD()

Public Members

int planeID
Vector3 point
Vector3 normal
Scalar radius
template<typename Scalar>
struct HypVertex

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Members

int verID
Vector3 point
int planeIDs[3]
struct InputMeshNormalizeData

Public Members

Vector3f trans
float scale
class InputVar

Subclassed by InputVarBool, InputVarFloat, InputVarInt, InputVarIntList, InputVarMatrix4d

Public Functions

InputVar()
~InputVar()
InputVar &operator<<(string name)
void operator=(string name)
void clear_value()

Public Members

vector<string> var_names
string series_name
string label
bool visible
bool update
varGUIType var_gui_type
varValueType var_value_type
std::function<void()> func
class InputVarBool : public InputVar

Public Functions

InputVarBool(bool val)
~InputVarBool()
void clear_value()

Public Members

int value
int default_value
class InputVarFloat : public InputVar

Public Functions

InputVarFloat(float val, Vector2f _bound = Vector2f(0, 0))
~InputVarFloat()
void clear_value()

Public Members

float value
float default_value
Vector2f bound
class InputVarInt : public InputVar

Public Functions

InputVarInt(int val, Vector2f _bound = Vector2f(0, 0))
~InputVarInt()
void clear_value()

Public Members

int value
int default_value
Vector2f bound
class InputVarIntList : public InputVar

Public Functions

InputVarIntList(vector<int> val)

Public Members

vector<int> value
class InputVarList

Public Functions

InputVarList()
int getInt(string name)
bool getBool(string name)
float getFloat(string name)
Eigen::Matrix4d getMatrix4d(string name)
vector<int> getIntList(string name)
vector<shared_ptr<InputVar>> findSeries(string name)
InputVar *find(string name)
InputVar &add(int value, string name, string label)
InputVar &add(int value, Vector2f bound, string name, string label)
InputVar &add(float value, string name, string label)
InputVar &add(float value, Vector2f bound, string name, string label)
InputVar &add(bool value, string name, string label)
InputVar &add(vector<int> value, string name, string label)
InputVar &add(Eigen::Matrix4d value, string name, string label)
InputVar &add(shared_ptr<InputVar> var)
void clear()

Public Members

int index
std::vector<shared_ptr<InputVar>> varLists
map<std::string, InputVar*> varMap
string filename
class InputVarManager

Public Functions

std::tuple<nlohmann::json, std::string> getJSON(InputVar *var)
shared_ptr<InputVar> readJSON(const nlohmann::json &json_node, const string name)
void write(InputVar *var, pugi::xml_node &node)
void read(InputVar *var, pugi::xml_node &node)
class InputVarMatrix4d : public InputVar

Public Functions

InputVarMatrix4d(Eigen::Matrix4d val)
InputVarMatrix4d(vector<double> val)
vector<double> to_vector_double()

Public Members

Eigen::Matrix4d value
struct InteractData

Public Members

double angle
double x
double y
double scale
struct InterlockingSolver::InterlockingData

Public Members

stdvec_Vector3 traslation
stdvec_Vector3 rotation
stdvec_Vector3 center
template<typename Scalar>
class InterlockingSolver : public TopoObject

Subclassed by InterlockingSolver_Clp< Scalar >, InterlockingSolver_Ipopt< Scalar >

Public Types

typedef Matrix<double, 3, 1> Vector3
typedef Matrix<double, 1, 2> RowVector2
typedef Matrix<double, 1, 4> RowVector4
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> EigenSpMat
typedef Eigen::Triplet<double> EigenTriple
typedef std::vector<Vector3, Eigen::aligned_allocator<Vector3>> stdvec_Vector3
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef weak_ptr<ContactGraphNode<Scalar>> wpContactGraphNode

Public Functions

InterlockingSolver(shared_ptr<ContactGraph<Scalar>> _graph, shared_ptr<InputVarList> varList)
void computeEquilibriumMatrix(Eigen::MatrixXd &mat, bool withFriction = false)
Scalar computeEquilibriumMatrixConditonalNumber()
void computeTranslationalInterlockingMatrix(vector<EigenTriple> &tri, Eigen::Vector2i &size)
void computeRotationalInterlockingMatrix(vector<EigenTriple> &tri, Eigen::Vector2i &size)
void computeRotationalInterlockingMatrixDense(Eigen::MatrixXd &mat)
void computeTranslationalInterlockingMatrixDense(Eigen::MatrixXd &mat)
void computeRotationalInterlockingMatrixSparse(EigenSpMat &mat)
void appendAuxiliaryVariables(vector<EigenTriple> &tri, Eigen::Vector2i &size)
void appendMergeConstraints(vector<EigenTriple> &tri, Eigen::Vector2i &size, bool isRotation)
bool isTranslationalInterlocking(shared_ptr<InterlockingData> &data)
bool isRotationalInterlocking(shared_ptr<InterlockingData> &data)
bool isEquilibrium(Vector3 gravity, shared_ptr<EquilibriumData> &data)

Public Members

shared_ptr<ContactGraph<Scalar>> graph

Protected Functions

void get_force_from_norm_fric(Vector3 n, Vector3 u, Vector3 v, RowVector2 &fkx, RowVector2 &fky, RowVector2 &fkz)
void get_force_from_norm_fric(Vector3 n, Vector3 u, Vector3 v, RowVector4 &fkx, RowVector4 &fky, RowVector4 &fkz)
void get_moment_from_norm_fric_vertex(Vector3 n, Vector3 u, Vector3 v, Vector3 r, RowVector2 &mx, RowVector2 &my, RowVector2 &mz)
void get_moment_from_norm_fric_vertex(Vector3 n, Vector3 u, Vector3 v, Vector3 r, RowVector4 &mx, RowVector4 &my, RowVector4 &mz)
void get_A_j_k(int partID, int edgeID, Eigen::MatrixXd &Ajk, bool withFriction = false)
template<typename Scalar>
class InterlockingSolver_Clp : public InterlockingSolver<Scalar>

Public Types

typedef shared_ptr<typename InterlockingSolver<Scalar>::InterlockingData> pInterlockingData
typedef Eigen::SparseMatrix<Scalar, Eigen::ColMajor> EigenSpMat
typedef Eigen::Triplet<Scalar> EigenTriple
typedef shared_ptr<ContactGraph<Scalar>> pContactGraph
typedef shared_ptr<ContactGraphNode<Scalar>> pContactGraphNode
typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

InterlockingSolver_Clp(pContactGraph _graph, shared_ptr<InputVarList> varList, CLP_SOLVER_TYPE _type = SIMPLEX)
bool isTranslationalInterlocking(pInterlockingData &data)
bool isRotationalInterlocking(pInterlockingData &data)
bool checkSpecialCase(pInterlockingData &data, vector<EigenTriple> copy_tris, bool rotationalInterlockingCheck, Eigen::Vector2i copy_size)
bool solve(pInterlockingData &data, vector<EigenTriple> &tris, bool rotationalInterlockingCheck, int num_row, int num_col, int num_var)
bool solveSimplex(pInterlockingData &data, bool rotationalInterlockingCheck, int num_row, int num_col, int num_var, const CoinPackedMatrix &matrix, const double *colLower, const double *colUpper, const double *objective, const double *rowLower, const double *rowUpper)
bool solveBarrier(pInterlockingData &data, bool rotationalInterlockingCheck, int num_row, int num_col, int num_var, const CoinPackedMatrix &matrix, const double *colLower, const double *colUpper, const double *objective, const double *rowLower, const double *rowUpper)
void unpackSolution(InterlockingSolver_Clp::pInterlockingData &data, bool rotationalInterlockingCheck, const double *solution, int num_var)

Public Members

CLP_SOLVER_TYPE type
template<typename Scalar>
class InterlockingSolver_Ipopt : public InterlockingSolver<Scalar>

Public Types

typedef shared_ptr<typename InterlockingSolver<Scalar>::InterlockingData> pInterlockingData
typedef Eigen::SparseMatrix<double, Eigen::ColMajor> EigenSpMat
typedef Eigen::Triplet<double> EigenTriple
typedef shared_ptr<ContactGraph<Scalar>> pContactGraph
typedef shared_ptr<ContactGraphNode<Scalar>> pContactGraphNode
typedef Eigen::Matrix<double, 3, 1> Vector3

Public Functions

InterlockingSolver_Ipopt(pContactGraph _graph, shared_ptr<InputVarList> varList)
bool isTranslationalInterlocking(pInterlockingData &data)
bool isRotationalInterlocking(pInterlockingData &data)
bool checkSpecialCase(pInterlockingData &data, vector<EigenTriple> copy_tris, bool rotationalInterlockingCheck, Eigen::Vector2i copy_size)
bool solve(pInterlockingData &data, vector<EigenTriple> &tris, bool rotationalInterlockingCheck, int num_row, int num_col, int num_var)
void unpackSolution(InterlockingSolver_Ipopt::pInterlockingData &data, bool rotationalInterlockingCheck, const double *solution, int num_var)
struct IOData

Public Functions

IOData()

Public Members

shared_ptr<InputVarList> varList
shared_ptr<PolyMesh<double>> reference_surface
shared_ptr<PolyMesh<double>> pattern_mesh
shared_ptr<CrossMesh<double>> cross_mesh
vector<int> boundary_crossIDs
vector<int> pickPartIDs
double interactMatrix[16]
InteractData interact_delta
InputMeshNormalizeData normalizedData
class IpoptProblem : public TNLP
#include <InterlockingSolver_Ipopt.h>

Interface between Ipopt NLP interface and TopoLite Interlocking Solver.

  • NLP provides an easy interface to Ipopt.

  • tris is equal to a sparse matrix A, which size is [num_row x num_col]

  • our variables are [x, t], a row vector.

  • x: (size: num_var) is the instant translational and rotational velocity.

  • t: (size: num_col - num_var) is the auxiliary variable.

The optimization is formulated as:

        max (\sum_{i = 0}^{num_var} t_i) + \lambda M
s.t. A.X + * >= T 0 =< x_i =< 1 x_i are real 0 <= <= 1

  • Ideally if the structure is interlocking, the objective value should be zero.

  • In practice, due to numerical error, we have to allow a small tolerance for the objective value.

  • Wang, Z. et al. (2019). ACM Transactions on Graphics, 38(6), 1–13. https://doi.org/10.1145/3355089.3356489

  • Wang, Z. (2019). Supplementary Material. ACM Transactions on Graphics, 38(6), 3–5.

Methods to block default compiler methods.

The compiler automatically generates the following three methods. Since the default compiler implementation is generally not what you want (for all but the most simple classes), we usually put the declarations of these methods in the private section and never implement them. This prevents the compiler from implementing an incorrect “default” behavior without us knowing. (See Scott Meyers book, “Effective C++”)

IpoptProblem(const IpoptProblem&)
IpoptProblem &operator=(const IpoptProblem&)

Public Types

typedef Eigen::Matrix<Number, Eigen::Dynamic, 1> RVectorXd
typedef Eigen::SparseMatrix<Number, Eigen::ColMajor> EigenSpMat

Public Functions

IpoptProblem()

Default constructor

~IpoptProblem() override

Default destructor

bool get_nlp_info(Index &n, Index &m, Index &nnz_jac_g, Index &nnz_h_lag, IndexStyleEnum &index_style) override

Get infos about problem dimensions.

Parameters
  • n: number of variables

  • m: number of constraints eq/ineq

  • nnz_jac_g: non-zero elements in constaints Jacobian

  • nnz_h_lag: non-zero elements in Lagrangian and Hessian

  • index_style: C or Fortran style

bool initialize(EigenSpMat &mat)

Set infos about problem dimensions. The following vars are set:

Parameters
  • mat: initial B matrix elements before adding big M contribution to it

bool get_bounds_info(Index n, Number *x_l, Number *x_u, Index m, Number *g_l, Number *g_u) override

Get the problem bounds conditions.

Parameters
  • n: number of variables

  • x_l: lower bounds for the variables

  • x_u: upper bounds for the variables

  • m: number of constraints eq/ineq

  • g_l: lower bounds for the constraints

  • g_u: upper bounds for the constraints

void set_vectors_dimensions()
void append_bigm_variables(EigenSpMat &mat)

Compute B = B_interlock + t0.

/ B00 … B1n | 1 \ B = | … … … | 1 | \ Bm1 … Bmn | 1 /

bool set_bounds_info()

Set the problem bounds conditions. The following vars are set.

bool get_starting_point(Index n, bool init_x, Number *x, bool init_z, Number *z_L, Number *z_U, Index m, bool init_lambda, Number *lambda) override

Get the starting point for solving the pb Cannot be used for our problem. If we know a starting point, it is not interlocking.

Parameters
  • n: number of variables

  • init_x:

  • x:

  • init_z:

  • z_L:

  • z_U:

  • m:

  • init_lambda:

  • lambda:

bool eval_f(Index n, const Number *x, bool new_x, Number &obj_value) override

Return

Parameters
  • n: number of variables

  • x: variables values

  • new_x:

  • obj_value: value of the objective function

bool eval_grad_f(Index n, const Number *x, bool new_x, Number *grad_f) override

Method to return the gradient of the objective.

Return

Parameters
  • n: number of variables

  • x: variables values

  • new_x:

  • grad_f: gradient vector values

bool eval_g(Index n, const Number *x, bool new_x, Index m, Number *g) override

Method to return the constraint residuals Computes g = B * X.

Return

Parameters
  • n: number of variables

  • x: variables values

  • new_x:

  • m: number of constraints

  • g: constraints residuals

bool eval_jac_g(Index n, const Number *x, bool new_x, Index m, Index nele_jac, Index *iRow, Index *jCol, Number *values) override

Method to return: 1) The structure of the jacobian (if “values” is NULL) 2) The values of the jacobian (if “values” is not NULL)

bool eval_h(Index n, const Number *x, bool new_x, Number obj_factor, Index m, const Number *lambda, bool new_lambda, Index nele_hess, Index *iRow, Index *jCol, Number *values) override

Method to return: 1) The structure of the hessian of the lagrangian (if “values” is NULL) 2) The values of the hessian of the lagrangian (if “values” is not NULL)

void finalize_solution(SolverReturn status, Index n, const Number *x, const Number *z_L, const Number *z_U, Index m, const Number *g, const Number *lambda, Number obj_value, const IpoptData *ip_data, IpoptCalculatedQuantities *ip_cq) override

This method is called when the algorithm is complete so the TNLP can store/write the solution

Public Members

Index n_var

Dimensions of the problem

Index n_var_real
Index n_constraints
Index non_zero_jacobian_elements
Index non_zero_hessian_elements
IndexStyleEnum index_style
RVectorXd x_l

Bounds for variables x and constraints g (l:lower, u:upper)

RVectorXd x_u
RVectorXd g_l
RVectorXd g_u
EigenSpMat b_coeff

Coefficients matrix

RVectorXd x

Objective value, x and x_solution vectors

RVectorXd x_solution
Number obj_value
Number max_abs_t
Number big_m

big M

class JsonIOReader

Public Functions

JsonIOReader(const std::string _input_path, shared_ptr<IOData> _data)
bool read()
bool readParameter(const nlohmann::json &parameter_json)
bool readPatternMesh(const nlohmann::json &mesh_json)
bool readReferenceMesh(const nlohmann::json &mesh_json)
bool readCrossMesh(const nlohmann::json &mesh_json)

Public Members

path input_path
weak_ptr<IOData> data
class JsonIOWriter

Public Functions

JsonIOWriter(const std::string _output_path, shared_ptr<IOData> _data)
void write()
nlohmann::json getParameterJson()

Public Members

path output_path
weak_ptr<IOData> data
template<typename Scalar>
struct Line

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

Line()
Line(Vector3 pt1, Vector3 pt2)
Line(Vector2 pt1, Vector2 pt2)

Public Members

Vector3 point1
Vector3 point2
struct AABBTree_Line::Node

Public Members

Box<Scalar> box
Line<Scalar> line2D
Line<Scalar> line3D

weak_ptr<Node> children[2]

template<typename Scalar>
struct OrientPoint

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

OrientPoint(const nlohmann::json &oript_json)
OrientPoint(Vector3 _point, Vector3 _normal)
OrientPoint(Vector3 _point, Vector3 _normal, Vector3 _axis)
void updateAngle(Scalar _angle)

Update rotation_angle (always positive) + define normal

void print()
nlohmann::json dump()
void parse(const nlohmann::json &oript_json)

Public Members

Vector3 point
Vector3 normal
Vector3 rotation_axis
Vector3 rotation_base
Scalar rotation_angle
int tiltSign
int oriptID
Vector2 tilt_range
Vector2 sided_range

Public Static Functions

Vector3 rotateVecAroundAxis(Vector3 normal, Vector3 rotAxis, Scalar rotAngle)

: Compute vector rotation

Return

vector after rotation

Parameters
  • [in] normal: based vector

  • [in] rotAxis: rotation axis

  • [in] rotAngle: rotation angle

template<typename Scalar>
class PatternCreator : public TopoObject

Public Types

typedef shared_ptr<PolyMesh<Scalar>> pPolyMesh
typedef shared_ptr<_Polygon<Scalar>> pPolygon
typedef shared_ptr<CrossMesh<Scalar>> pCrossMesh
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef std::set<Vector3, pVertex_compare> setVertex

Public Functions

PatternCreator()
PatternCreator(shared_ptr<InputVarList> var)
~PatternCreator()
void create2DPattern(PatternType patternID, int patternRadius, pCrossMesh &out)
void createPolygonRoot(int edgeNum, Scalar edgeLen, pPolygon &out)
void computeNeighbors(PatternType crosstype, pPolygon poly, vector<pPolygon> &out)
bool checkPolygonExistance(pPolygon poly, const setVertex &vertices_set)
void addToVerticesSet(pPolygon poly, setVertex &vertices_set)
Vector3 rotateVector(Vector3 rotCenter, Vector3 rotAxis, Scalar rotAngle, Vector3 tagtPt)
void ComputeNeighbor_Square(pPolygon poly, pPolygon &out)
void ComputeNeighbor_Hexagon(pPolygon poly, pPolygon &out)
void ComputeNeighbor_Octagon_Square(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Hexagon_Rhombus(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Dodecagon(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Dodecagon_Hexagon_Square(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Square_Rhombus(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Pentagon_Cross(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Pentagon_Snow(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Pentagon_Mirror(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Rhombus(pPolygon poly, int edgeID, pPolygon &out)
void ComputeNeighbor_Octagon_Square_Colinear(pPolygon poly, int edgeID, pPolygon &out)
Matrix<Scalar, 3, 1> ComputeTileTranslation(pPolygon neighbor, Vector3 tagtStaPt, Vector3 tagtEndPt)
Matrix<Scalar, 3, 1> ComputeTileTranslation_OCTAGON_SQUARE_COLINEAR(pPolygon poly, int edgeID)
void CreatePolygon_Square(pPolygon &out, Scalar edgeLen, int polyType = POLY_SQUARE_THETA_45)
void CreatePolygon_Hexagon(pPolygon &out, Scalar edgeLen, int polyType = POLY_HEXAGON_TYPE_0)
void CreatePolygon_Octagon(pPolygon &out, Scalar edgeLen, int polyType)
void CreatePolygon_Dodecagon(pPolygon &out, Scalar edgeLen)
void CreatePolygon_Rhombus(pPolygon &out, Scalar edgeLen, int polyType = POLY_RHOMBUS_THETA_0)
void CreatePolygon_Pentagon_Cross(pPolygon &out, Scalar edgeLen, int polyType = POLY_PENTAGON_CROSS_TYPE_0)
void CreatePolygon_Pentagon_Snow(pPolygon &out, Scalar edgeLen, int polyType = POLY_PENTAGON_SNOW_TYPE_0)
void CreatePolygon_Pentagon_Mirror(pPolygon &out, Scalar edgeLen, int polyType = POLY_PENTAGON_MIRROR_TYPE_0)
vector<vector<double>> PyCreateMesh_2DPattern(int patternID, int patternRadius)
template<typename Scalar>
struct Plane

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

Plane()
Plane &operator=(const Plane &plane)
Scalar computePtPtDistance(Vector3 tagtPt)
int computePtPlnIntersec(Vector3 tagtPt)
int checkLnPlnIntersec(Line<Scalar> line)
int computeLnLnIntersec(Line<Scalar> line, Vector3 &crossPt)

Public Members

Vector3 point
Vector3 normal
struct ContactGraph::plane_contact_compare

Public Functions

bool operator()(const polygonal_face &A, const polygonal_face &B) const
template<typename Scalar>
struct Point

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

Point()
Point &operator=(const Point &pt)

Public Members

Vector3 pos
Vector3 nor
Vector3 color
Scalar curv
int dist
struct ContactGraph::polygonal_face

Public Members

Matrix<Scalar, 3, 1> nrm
double D
int partID
int groupID
wpPolygon polygon
double eps
template<typename Scalar>
class PolyMesh : public TopoObject

Subclassed by CrossMesh< Scalar >, PolyMesh_AABBTree< Scalar >

Public Types

using pPolygon = shared_ptr<_Polygon<Scalar>>
using wpPolygon = weak_ptr<_Polygon<Scalar>>
using pTriangle = shared_ptr<Triangle<Scalar>>
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef shared_ptr<VPoint<Scalar>> pVertex
typedef shared_ptr<VTex<Scalar>> pVTex
typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX
typedef Matrix<int, Eigen::Dynamic, Eigen::Dynamic> MatrixXi

Public Functions

PolyMesh(std::shared_ptr<InputVarList> var)
PolyMesh(const PolyMesh &_mesh)
~PolyMesh()
void clear()
void update()
std::pair<Matrix<Scalar, 3, 1>, Scalar> normalize()
void fromEigenMesh(const MatrixX &V, const MatrixX &T, const MatrixXi &F)
void setPolyLists(vector<pPolygon> _polyList)
bool parse(const nlohmann::json &mesh_json)

: parse from json file

Return

: whether read the json object successfully

Parameters
  • mesh_json: json object of the mesh

bool readOBJModel(const char *fileName, bool normalized)

: Read OBJ File (from file)

Parameters
  • fileName: filename of an input file

  • normalized: scale the mode into [-1, 1] x [-1, 1] x [-1, 1] box;

bool readOBJModel(const vector<vector<double>> &V, const vector<vector<double>> &TC, const vector<vector<int>> &F, const vector<vector<int>> &FTC, bool normalized)

: Read OBJ File (from matrix)

Parameters
  • V: vertice’s position arrary

  • TC: vertex texture coordinates array

  • F: face index (tri or polygon)

  • FTC: texture face index (tri or polygon)

  • normalized: scale the mode into [-1, 1] x [-1, 1] x [-1, 1] box;

void removeDuplicatedVertices(double eps = FLOAT_ERROR_LARGE)
void mergeFaces(double eps = 1e-3)
void computeVertexList()
void computeTextureList()
void translateMesh(Vector3 move)
void scaleMesh(Vector3 scale)
void rotateMesh(Vector3 rotCenter, Vector3 rotAxis, Scalar rotAngle)
void print() const
vector<Vector3> getVertices() const
shared_ptr<PolyMesh<Scalar>> getTextureMesh() const
void writeOBJModel(const char *objFileName, bool triangulate = false) const
nlohmann::json dump() const
void convertToTriMesh(vector<pTriangle> &triList) const
void convertPosToEigenMesh(MatrixX &V, MatrixXi &F, Eigen::VectorXi &C)
void convertTexToEigenMesh(MatrixX &V, MatrixXi &F, Eigen::VectorXi &C)
void convertPosTexToEigenMesh(MatrixX &V, MatrixX &T, MatrixXi &F)
Box<Scalar> bbox() const
Box<Scalar> texBBox() const
Vector3 centroid() const
Scalar volume() const
Vector3 lowestPt() const
size_t size()
vector<Line<Scalar>> getWireFrame() const

Public Members

vector<pPolygon> polyList
bool texturedModel
vector<pVertex> vertexList
vector<pVTex> textureList

Private Functions

Scalar computeVolume(vector<pTriangle> triList) const
Vector3 computeCentroid(vector<pTriangle> triList) const
Vector3 computeExtremeVertex(Vector3 rayDir) const
template<typename Scalar>
class PolyMesh_AABBTree : public PolyMesh<Scalar>

Public Types

typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX
typedef Matrix<int, Eigen::Dynamic, Eigen::Dynamic> MatrixXi
typedef Matrix<Scalar, 2, 1> Vector2
typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, Eigen::Dynamic, 1> VectorX
typedef shared_ptr<_Polygon<Scalar>> pPolygon

Public Functions

PolyMesh_AABBTree(const PolyMesh<Scalar> &_mesh)

Parameters
  • _mesh:

void buildTexTree()

build a texture tree

void buildPosTree()
pPolygon findTexPoint(VectorX pt)

Search if a point represented by a Vector2d belongs to a given texture polygon. If the point is on a shared edge between polygons then, one of these polygons is returned.

Return

a texture polygon or nullptr

Parameters
  • ptis: a 2 dimension point

bool findBoundaryIntersec(const Line<Scalar> &line, Vector2 &tex2D, Vector3 &pos3D)
Vector3d findMeshNearestPoint(Vector3 pt)

Public Members

igl::AABB<MatrixX, 2> texTree
igl::AABB<MatrixX, 3> posTree
AABBTree_Line<Scalar> lineTree
MatrixX pV
MatrixX tV
MatrixXi pF
MatrixXi tF
Eigen::VectorXi tC
Eigen::VectorXi pC
template<size_t N>
class Bezier::PolynomialCoefficients

Public Functions

PolynomialCoefficients()
double valueAt(size_t pos, float t) const
const PolynomialPair &operator[](size_t idx) const

Public Static Functions

constexpr size_t size()

Private Members

PolynomialPair mPolynomialPairs[size()]
struct Bezier::PolynomialPair

Public Functions

double valueAt(float t) const

Public Members

size_t t = 0
size_t one_minus_t = 0
template<typename Scalar>
class PolyPolyBoolean : private TopoObject

Public Functions

PolyPolyBoolean(shared_ptr<InputVarList> varList)
void computePolygonsUnion(PolysVector3 &polys, PolysVector3 &polysUnion)
void computePolygonsIntersection(const PolyVector3 &polyA, const PolyVector3 &polyB, PolyVector3 &polyIntsec)
void computePolygonsIntersection(const PolyVector3 &polyA, const PolyVector3 &polyB, PolysVector3 &polyIntsec)
bool check2DPolygonsIntersection(const PolyVector2 &polyA, const PolyVector2 &polyB, Scalar &area)
void printPolygon(const PolyVector3 &poly)
void cleanPath(PolyVector3 &polyIntsec)
void computeFrame(const PolyVector3 &poly, Vector3 &xaxis, Vector3 &yaxis, Vector3 &origin)
Scalar computeScale(const PolysVector3 &poly, Vector3 &xaxis, Vector3 &yaxis, Vector3 &origin)
Scalar computeScale(const PolysVector2 &poly)
Vector3 computeNormal(const PolyVector3 &poly)
Vector3 computeCenter(const PolyVector3 &poly)
ClipperLib::Path projectToNormalPlane(const PolyVector3 &poly, Vector3 xaxis, Vector3 yaxis, Vector3 origin, Scalar Scale)
PolyVector3 projectTo3D(const ClipperLib::Path &path, Vector3 xaxis, Vector3 yaxis, Vector3 origin, Scalar scale)

Private Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2
typedef vector<Vector3> PolyVector3
typedef vector<vector<Vector3>> PolysVector3
typedef vector<Vector2> PolyVector2
typedef vector<vector<Vector2>> PolysVector2
struct PatternCreator::pVertex_compare

Public Functions

bool operator()(const Vector3 &A, const Vector3 &B) const
struct PolyMesh::sort_vertex

Public Members

Vector3 pos
int vID
double eps
shared_ptr<VPoint<Scalar>> ptr
struct PolyMesh::sort_vertex_compare

Public Functions

bool operator()(const sort_vertex &A, const sort_vertex &B) const
template<typename Scalar>
class StrucCreator : public TopoObject

Public Types

typedef shared_ptr<CrossMesh<Scalar>> pCrossMesh
typedef shared_ptr<ConvexBlock<Scalar>> pConvexBlock
typedef shared_ptr<Cross<Scalar>> pCross
typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

StrucCreator(shared_ptr<InputVarList> var)
~StrucCreator()
bool compute(pCrossMesh crossMesh)

Public Members

vector<pConvexBlock> blocks
class Bezier::TightBoundingBox

Public Functions

TightBoundingBox(const ExtremePoints &xPoints, const Vec2 &translation, double rotation)
float minX() const
float maxX() const
float minY() const
float maxY() const
float area() const
float width() const
float height() const
Point &operator[](size_t idx)
Point operator[](size_t idx) const

Public Static Functions

constexpr size_t size()

Private Members

Point points[4]
class TopoObject

Subclassed by AugmentedVectorCreator< Scalar >, BaseMeshCreator< Scalar >, ContactGraph< Scalar >, ConvexBlock< Scalar >, Cross< Scalar >, CrossMeshCreator< Scalar >, InterlockingSolver< Scalar >, PatternCreator< Scalar >, PolyMesh< Scalar >, PolyPolyBoolean< Scalar >, StrucCreator< Scalar >

Public Functions

TopoObject()
TopoObject(shared_ptr<InputVarList> _var)
TopoObject(const TopoObject &obj)
shared_ptr<InputVarList> getVarList() const
void setVarList(shared_ptr<InputVarList> var)
bool checkCoherency()

Private Members

shared_ptr<InputVarList> varList
template<typename Scalar>
struct Triangle

Public Types

typedef Matrix<Scalar, 3, 1> Vector3
typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

Triangle()
Triangle(Vector3 _v0, Vector3 _v1, Vector3 _v2)
Triangle(Vector2 _v0, Vector2 _v1, Vector2 _v2)
Triangle(Vector3 _v0, Vector3 _v1, Vector3 _v2, bool b0, bool b1, bool b2)
void init(Vector3 _v0, Vector3 _v1, Vector3 _v2)
Triangle &operator=(const Triangle &tri)
bool checkEqual(const Triangle<Scalar> &tri)
void print()
Vector3 computeBBoxMinPt()
Vector3 computeBBoxMaxPt()
Vector3 computeCenter()
Scalar computeArea()
Scalar computeSignedArea()
Vector3 computeNormal()
void correctNormal(Vector3 tagtNormal)

Public Members

Vector3 v[3]
int vIndices[3]
bool edge_at_boundary[3]
class Bezier::Vec2

Public Functions

Vec2()
Vec2(float x, float y)
Vec2(float x, float y, bool normalize)
Vec2(const Vec2 &other)
Vec2(const Vec2 &other, bool normalize)
void set(float x, float y)
void set(const Vec2 &other)
double length() const
void normalize()
void translate(float dx, float dy)
void translate(const Vec2 &distance)
void rotate(double angle, const Vec2 &pivot = Vec2(0, 0))
float angle() const
float angleDeg() const
float operator[](size_t axis) const
float &operator[](size_t axis)
Vec2 operator+(const Vec2 &other) const
Vec2 operator-(const Vec2 &other) const
Vec2 operator-() const
Vec2 operator*(double scale) const
Vec2 operator/(double scale) const
Vec2 operator/(const Vec2 &other) const
bool fuzzyEquals(const Vec2 &other) const
bool isWithinZeroAndOne() const

Public Members

float x
float y

Public Static Attributes

constexpr size_t size = 2
template<typename Scalar>
class VPoint

Public Types

typedef Matrix<Scalar, 3, 1> Vector3

Public Functions

VPoint()
VPoint(const Vector3 &_pos)

Public Members

Vector3 pos
int verID
template<typename Scalar>
class VTex

Public Types

typedef Matrix<Scalar, 2, 1> Vector2

Public Functions

VTex()
VTex(const Vector2 &_texCoord)

Public Members

Vector2 texCoord
int texID
class XMLIO_backward

Public Functions

bool XMLReader(const std::string xmlFileName, IOData &data)
void XMLReader_GUISettings(pugi::xml_node &xml_root, IOData &data)
bool XMLReader_ReferenceSurface(pugi::xml_node &xml_root, const std::string xmlFileName_path, IOData &data)
bool XMLReader_CrossMesh(pugi::xml_node &xml_root, const std::string xmlFileName_path, IOData &data)
void XMLReader_Boundary(pugi::xml_node &xml_root, IOData &data)

Private Functions

Vector3d readXYZ(std::string xyz_str)
vector<std::string> split(const std::string str_text, const char separator) const
Eigen::Matrix4d toEigenMatrix(double *interactMatrix)
namespace Bezier

Typedefs

typedef Vec2 Point
typedef Vec2 Normal
typedef Vec2 Tangent
typedef AxisAlignedBoundingBox AABB
typedef TightBoundingBox TBB
namespace Bezier::Math

Functions

double faculty(size_t n)
double binomial(size_t n, size_t k)
bool isWithinZeroAndOne(float x)
namespace Eigen
namespace Ipopt
namespace std
namespace filesystem
file CMakeLists.txt

Functions

add_subdirectory (CrossMesh) add_subdirectory(Interlocking) add_subdirectory(IO) add_subdirectory(Mesh) add_subdirectory(Utility) add_subdirectory(Structure) set(TpCoreFiles $
file CMakeLists.txt
file CMakeLists.txt
file CMakeLists.txt
file CMakeLists.txt
file CMakeLists.txt
file CMakeLists.txt
file AugmentedVectorCreator.cpp
#include “AugmentedVectorCreator.h”
file AugmentedVectorCreator.h
#include “Mesh/PolyMesh.h”#include “Mesh/CrossMesh.h”#include “Mesh/Cross.h”#include “Utility/TopoObject.h”#include <tbb/tbb.h>#include <utility>#include <queue>#include <unordered_map>
file BaseMeshCreator.cpp
#include “BaseMeshCreator.h”
file BaseMeshCreator.h
#include <vector>#include <unordered_map>#include <tbb/tbb.h>#include “TopoLite/Mesh/PolyMesh_AABBTree.h”#include “Mesh/CrossMesh.h”
file CrossMeshCreator.cpp
#include “CrossMeshCreator.h”#include “tbb/tbb.h”
file CrossMeshCreator.h
#include “TopoLite/Utility/TopoObject.h”#include “TopoLite/Mesh/CrossMesh.h”#include “TopoLite/Mesh/PolyMesh_AABBTree.h”#include “BaseMeshCreator.h”#include “AugmentedVectorCreator.h”#include “PatternCreator.h”#include “Eigen/Dense”#include <vector>#include “igl/lscm.h”#include <memory>
file PatternCreator.cpp
#include “Utility/HelpDefine.h”#include “CrossMesh/BaseMeshCreator.h”#include “CrossMesh/PatternCreator.h”#include “Mesh/Polygon.h”#include “Mesh/PolyMesh.h”#include <queue>
file PatternCreator.h
#include <vector>#include “Mesh/CrossMesh.h”

Enums

enum PatternType

Values:

enumerator CROSS_SQUARE = 1
enumerator CROSS_RHOMBUS = 2
enumerator CROSS_SQUARE_RHOMBUS = 3
enumerator CROSS_HEXAGON = 4
enumerator CROSS_HEXAGON_RHOMBUS = 5
enumerator CROSS_DODECAGON_HEXAGON_QUAD = 6
enumerator CROSS_OCTAGON_SQUARE = 7
enumerator CROSS_OCTAGON_SQUARE_COLINEAR = 8
enumerator CROSS_DODECAGON = 9
enumerator CROSS_PENTAGON_CROSS = 10
enumerator CROSS_PENTAGON_SNOW = 11
enumerator CROSS_PENTAGON_MIRROR = 12

Variables

const int MAX_PATTERN_TYPE = 12
file ContactGraph.cpp
#include “ContactGraph.h”#include “Utility/ConvexHull2D.h”

Functions

void TemporaryFunction_ContactGraph()
file ContactGraph.h
#include “ContactGraphNode.h”#include “Mesh/PolyMesh.h”#include “Utility/TopoObject.h”#include “Utility/PolyPolyBoolean.h”#include <string>#include <map>#include <iostream>#include <algorithm>#include <set>#include <tbb/tbb.h>#include <cmath>

Typedefs

using pairIJ = std::pair<int, int>
file ContactGraphDefine.h
file ContactGraphEdge.h
#include <Eigen/Dense>#include “Utility/HelpDefine.h”#include <Mesh/Polygon.h>
file ContactGraphNode.h
#include “ContactGraphEdge.h”#include <map>#include <memory>
file InterlockingSolver.cpp
#include “InterlockingSolver.h”

Functions

void TemporaryFunction_InterlockingSolver()
file InterlockingSolver.h
#include <Eigen/Sparse>#include <Eigen/SparseCore>#include <Eigen/Dense>#include “ContactGraph.h”#include “Utility/TopoObject.h”
file InterlockingSolver_Clp.cpp
#include “InterlockingSolver_Clp.h”#include “tbb/tbb.h”#include <Eigen/SparseQR>#include “ClpInterior.hpp”#include “ClpSimplex.hpp”#include “ClpCholeskyDense.hpp”

Functions

void TemporaryFunction_InterlockingSolver_Clp()
file InterlockingSolver_Clp.h
#include “InterlockingSolver.h”#include “ClpSimplex.hpp”#include “CoinHelperFunctions.hpp”

Enums

enum CLP_SOLVER_TYPE

Values:

enumerator SIMPLEX
enumerator BARRIER
file InterlockingSolver_Ipopt.cpp
#include <cassert>#include <iostream>#include “tbb/tbb.h”#include “InterlockingSolver_Ipopt.h”#include <Eigen/SparseQR>#include “Utility/SparseOperations.h”#include <IpIpoptApplication.hpp>

Defines

HAVE_CSTDDEF

Functions

void TemporaryFunction_InterlockingSolver_Ipopt()

Variables

const double COIN_DBL_MAX = std::numeric_limits<double>::max()
file InterlockingSolver_Ipopt.h
#include “IpTNLP.hpp”#include “InterlockingSolver.h”#include “CoinHelperFunctions.hpp”#include <Eigen/SparseQR>

Defines

HAVE_CSTDDEF
file InputVar.cpp
#include “InputVar.h”

Functions

void InitVar_backward(InputVarList *varList)
void InitVar(InputVarList *varList)
file InputVar.h
#include <string>#include <map>#include <pugixml.hpp>#include <nlohmann/json.hpp>#include <vector>#include <Eigen/Dense>#include <memory>#include <iostream>

Enums

enum varValueType

Values:

enumerator VAR_VALUE_NONE
enumerator VAR_VALUE_BOOL
enumerator VAR_VALUE_INT
enumerator VAR_VALUE_FLOAT
enumerator VAR_VALUE_INTLIST
enumerator VAR_VALUE_MATRIX4D
enum varGUIType

Values:

enumerator GUI_NONE
enumerator GUI_SLIDERFLOAT
enumerator GUI_SLIDERINT
enumerator GUI_CHECKBOX
enumerator GUI_TEXTBOX

Functions

void InitVar_backward(InputVarList *varList)
void InitVar(InputVarList *varList)
file IOData.h
#include “TopoLite/IO/InputVar.h”#include “TopoLite/Mesh/CrossMesh.h”
file JsonIOReader.cpp
#include “JsonIOReader.h”#include <fstream>
file JsonIOReader.h
#include “TopoLite/Utility/HelpDefine.h”#include “IO/IOData.h”#include <string>#include <nlohmann/json.hpp>#include <filesystem>
file JsonIOWriter.cpp
#include “JsonIOWriter.h”#include <fstream>
file JsonIOWriter.h
#include “TopoLite/Utility/HelpDefine.h”#include “IO/IOData.h”#include <string>#include <nlohmann/json.hpp>#include <filesystem>
file XMLIO_backward.cpp
#include “XMLIO_backward.h”#include “CrossMesh/CrossMeshCreator.h”
file XMLIO_backward.h
#include <iostream>#include <unordered_map>#include <string>#include <pugixml.hpp>#include “IOData.h”#include <filesystem>
file Cross.cpp
#include “Utility/HelpDefine.h”#include “Cross.h”
file Cross.h
#include “TopoLite/Utility/GeometricPrimitives.h”#include “TopoLite/Utility/TopoObject.h”#include <unordered_map>#include “Polygon.h”#include <vector>#include <memory>#include <Eigen/Dense>
file CrossMesh.cpp
#include “Utility/HelpDefine.h”#include “CrossMesh.h”
file CrossMesh.h
#include “TopoLite/Mesh/PolyMesh.h”#include “Cross.h”
file Polygon.cpp
#include “Utility/GeometricPrimitives.h”#include “Utility/HelpDefine.h”#include “Polygon.h”#include <igl/triangle/triangulate.h>#include <iostream>#include <set>
file Polygon.h
#include “TopoLite/Utility/GeometricPrimitives.h”#include <Eigen/Dense>#include <vector>#include <memory>#include <string.h>

Enums

enum PolygonType

Values:

enumerator POLY_NONE = 0
enumerator POLY_SQUARE_THETA_45 = 1
enumerator POLY_SQUARE_THETA_15 = 2
enumerator POLY_SQUARE_THETA_75 = 3
enumerator POLY_RHOMBUS_THETA_0 = 4
enumerator POLY_RHOMBUS_THETA_90 = 5
enumerator POLY_RHOMBUS_THETA_120 = 6
enumerator POLY_RHOMBUS_THETA_240 = 7
enumerator POLY_HEXAGON_TYPE_0 = 8
enumerator POLY_HEXAGON_TYPE_1 = 9
enumerator POLY_OCTAGON_REGULAR = 10
enumerator POLY_OCTAGON_COLINEAR = 11
enumerator POLY_DODECAGON = 12
enumerator POLY_PENTAGON_CROSS_TYPE_0 = 13
enumerator POLY_PENTAGON_CROSS_TYPE_1 = 14
enumerator POLY_PENTAGON_CROSS_TYPE_2 = 15
enumerator POLY_PENTAGON_CROSS_TYPE_3 = 16
enumerator POLY_PENTAGON_SNOW_TYPE_0 = 17
enumerator POLY_PENTAGON_SNOW_TYPE_1 = 18
enumerator POLY_PENTAGON_SNOW_TYPE_2 = 19
enumerator POLY_PENTAGON_SNOW_TYPE_3 = 20
enumerator POLY_PENTAGON_SNOW_TYPE_4 = 21
enumerator POLY_PENTAGON_SNOW_TYPE_5 = 22
enumerator POLY_PENTAGON_MIRROR_TYPE_0 = 23
enumerator POLY_PENTAGON_MIRROR_TYPE_1 = 24
enumerator POLY_RHOMBUS_TYPE_0 = 25
enumerator POLY_RHOMBUS_TYPE_1 = 26
file PolyMesh.cpp
#include “Utility/HelpDefine.h”#include “igl/boundary_loop.h”#include “igl/readOBJ.h”#include “Polygon.h”#include “PolyMesh.h”#include <unordered_map>#include <queue>#include <set>
file PolyMesh.h
#include “TopoLite/Utility/GeometricPrimitives.h”#include “TopoLite/Utility/TopoObject.h”#include “TopoLite/Utility/PolyPolyBoolean.h”#include “Polygon.h”#include <Eigen/Dense>#include <nlohmann/json.hpp>
file PolyMesh_AABBTree.h
#include <Eigen/Dense>#include “Mesh/PolyMesh.h”#include <igl/AABB.h>#include <igl/boundary_loop.h>
file ConvexBlock.cpp
#include “Utility/HelpDefine.h”#include “Utility/GeometricPrimitives.h”#include “Mesh/Cross.h”#include “Utility/ConvexHull2D.h”#include “Mesh/PolyMesh.h”#include “ConvexBlock.h”
file ConvexBlock.h
#include <vector>#include “Utility/GeometricPrimitives.h”#include “Mesh/Cross.h”#include “Mesh/PolyMesh.h”
file StrucCreator.cpp
#include “StrucCreator.h”#include <tbb/tbb.h>
file StrucCreator.h
#include <vector>#include “ConvexBlock.h”#include “Mesh/CrossMesh.h”
file Bezier.h
#include <assert.h>#include <math.h>#include <vector>#include <limits>

Defines

BEZIER_SIZE_T_FORMAT
BEZIER_FUZZY_EPSILON
BEZIER_DEFAULT_INTERVALS
BEZIER_DEFAULT_MAX_ITERATIONS
file ConvexHull2D.h
#include <Eigen/Dense>#include <vector>#include “HelpDefine.h”
file ConvexHull3D.h
#include <Eigen/Dense>#include <QuickHull.hpp>
file GeometricPrimitives.h
#include “TopoLite/Utility/HelpDefine.h”#include <nlohmann/json.hpp>#include <vector>#include <Eigen/Dense>#include <cmath>

Defines

POINT_PLANE_UNKWONN
POINT_PLANE_INTERSECT
POINT_PLANE_POSITIVE_SIDE
POINT_PLANE_NEGATIVE_SIDE
LINE_PLANE_UNKWONN
LINE_PLANE_INTERSECT
LINE_PLANE_POSITIVE_SIDE
LINE_PLANE_NEGATIVE_SIDE
FACE_PLANE_UNKWONN
FACE_PLANE_INTERSECT
FACE_PLANE_POSITIVE_SIDE
FACE_PLANE_NEGATIVE_SIDE
file HelpDefine.h
#include <math.h>

Defines

UNITTEST_DATAPATH
ELEMENT_OUT_LIST
FILE_NAME_LENGTH
BUFFER_LENGTH
MIN_INT
MAX_INT
MIN_FLOAT
MAX_FLOAT
FLOAT_ERROR_SMALL
FLOAT_ERROR_LARGE
CLIPPER_INTERGER_SCALE
errexit(s)
errexit2(s1, s2)
_MAX_STR_SIZE
_MAX_LINE_SIZE
_MAX_PATH_SIZE
_ERROR
_ERROR1
_ERROR2
_OKAY
_TRUE
_FALSE
_TOGGLE(bool)
_ToRadian(X)
_ToDegree(X)
_EPSILON
_MAX(a, b)
_MIN(a, b)
_IN_BETWEEN(v, a, b)
M_PI
SURFACE_CylinderA60
SURFACE_CylinderA80
SURFACE_HyperbolicA90
SURFACE_SeaShell
SURFACE_SphereA60
SURFACE_Torus
SURFACE_Spindle
DBG_DOTP_EPSILON
CO_PLANAR_THRES
MODEL_HEXAGON
MODEL_HEXAGON_5x5
MODEL_HEXAGON_10
MODEL_SQUARE
MODEL_SQUARE_5X5
MODEL_SQUARE_10
CROSS_L
MOBILITY_SCORE_MAX
MOBILITY_SCORE_DIFF
NONE_CROSS
NONE_PART
NONE_GROUP
NONE_ELEMENT
NONE_FACE
NOT_FOUND
MOBILITY_SPHERE_R
CROSS_THETA
TILT_SIGN_NONE
TILT_SIGN_POSITIVE
TILT_SIGN_NEGATIVE
INIT_WORLD_POSITION
INIT_WORLD_ROT_AXIS
INIT_WORLD_ROT_ANGLE
INIT_WORLD_SCALE
INIT_WORLD_AXES_POSITION
INIT_WORLD_AXES_ROT_AXIS
INIT_WORLD_AXES_ROT_ANGLE
DRAW_POINT
DRAW_LINE
DRAW_FLAT
DRAW_SMOOTH
file PolyPolyBoolean.h
#include <clipper.hpp>#include <cmath>#include <Eigen/Dense>#include “TopoObject.h”#include “HelpDefine.h”
file SparseOperations.h
#include <Eigen/Sparse>#include <iostream>

Typedefs

typedef Eigen::SparseMatrix<double> SpMat
typedef Eigen::Triplet<double> T

Functions

template<typename Scalar>
void create_identity_SparseMat(SparseMatrix<Scalar> &m, int dim)

Create a identity SparseMat object.

Template Parameters
  • Scalar:

Parameters
  • m: the matrix the create

  • dim: the dimensions of the matrix.

template<typename Scalar>
void stack_col_SparseMat(const SparseMatrix<Scalar> &B, const SparseMatrix<Scalar> &I, SparseMatrix<Scalar> &C)

Concatenate B and I horizontally.

/ B00 B01 B02 | I00 I01 \ C = | B10 B11 B12 | I10 I11 | \ B20 B21 B22 | I20 I21 /

Template Parameters
  • Scalar:

Parameters
  • B: Left sparse matrix

  • I: Right sparse matrix

  • C: Final sparse matrix

void stack_row_SparseMat(SpMat &B, SpMat &I, SpMat &C)

Concatenate B and I vertically.

/ B00 B01 B02 \ | B10 B11 B12 | C = ———- | I00 I01 I02 | \ I10 I11 I12 /

Template Parameters
  • Scalar:

Parameters
  • B: Left sparse matrix

  • I: Right sparse matrix

  • C: Final sparse matrix

template<typename Scalar>
void print_SparseMatTriplets(const SparseMatrix<Scalar> &A)

Print out the triplets row, col, value.

Parameters
  • A: the sparse matrix to print

template<typename Scalar>
void print_SparseMatTriplets(const SparseMatrix<Scalar> &A, const int precision = 0)

Print out as a dense matrix.

Parameters
  • A: the sparse matrix to print

file TopoAssert.h
file TopoObject.h
#include “TopoLite/IO/InputVar.h”#include “TopoAssert.h”
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/CrossMesh
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/Interlocking
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/IO
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/Mesh
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/Structure
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite
dir /home/docs/checkouts/readthedocs.org/user_builds/topolite/checkouts/latest/src/TopoLite/Utility

Python API

Danger

This will be automatically generated with cpp code source. Need to be set up.