42 #include "PolyLinePlugin.hh" 62 emit log(
LOGERR,tr(
"Unable to get object"));
68 std::vector< ACG::Vec3d > linePoints;
75 emit log(
LOGERR,tr(
"Unable to get mesh"));
80 TriMesh::EdgeHandle eh =
getCuttedEdge( *mesh, _planeNormal, _planePoint );
82 if ( !eh.is_valid() ) {
83 emit log(
LOGERR,tr(
"Unable to find initial cut edge."));
87 TriMesh::FaceHandle fh = mesh->face_handle( mesh->halfedge_handle(eh, 0) );
90 fh = mesh->face_handle( mesh->halfedge_handle(eh, 1) );
100 emit log(
LOGERR,tr(
"Unable to get mesh"));
105 PolyMesh::EdgeHandle eh =
getCuttedEdge( *mesh, _planeNormal, _planePoint );
107 if ( !eh.is_valid() ) {
108 emit log(
LOGERR,tr(
"Unable to find initial cut edge."));
112 PolyMesh::FaceHandle fh = mesh->face_handle( mesh->halfedge_handle(eh, 0) );
115 fh = mesh->face_handle( mesh->halfedge_handle(eh, 1) );
121 if ( linePoints.empty() ) {
122 emit log(
LOGERR,tr(
"No points from cut found."));
130 if (_polyLineId == -1)
133 polyLineId = _polyLineId;
144 for ( uint i = 0 ; i < linePoints.size(); ++i )
145 currentPolyLine->
line()->
add_point( (PolyLine::Point) linePoints[i] );
148 currentPolyLine->
target(
true);
166 std::vector<int> lines;
174 emit log(
LOGERR,tr(
"Unable to get object"));
180 std::vector< std::vector< ACG::Vec3d > > linePoints;
187 emit log(
LOGERR,tr(
"Unable to get mesh"));
199 emit log(
LOGERR,tr(
"Unable to get mesh"));
209 if ( linePoints.empty() ) {
210 emit log(
LOGERR,tr(
"No cut lines found."));
215 for (
unsigned int i = 0 ; i < linePoints.size(); ++i ) {
217 if ( linePoints[i].empty() )
235 for (
unsigned int j = 0 ; j < linePoints[i].size(); ++j )
236 currentPolyLine->
line()->
add_point( (PolyLine::Point) linePoints[i][j] );
239 currentPolyLine->
target(
true);
241 lines.push_back(polyLineId);
void add_point(const Point &_p)
Append a point to the polyline.
IdList generatePolyLinesFromCut(int _objectId, Vector _planePoint, Vector _planeNormal)
Generates a polyLine of a plane intersection.
void set_closed(const bool _c)
Set if the polyline should be closed and therefore forms a loop.
std::vector< std::vector< ACG::Vec3d > > getMultipleIntersectionPoints(MeshT *_mesh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint)
get all points from the intersection between mesh and plane
PolyLine * line()
return a pointer to the line
bool dataType(DataType _type) const
std::vector< ACG::Vec3d > getIntersectionPoints(MeshT *_mesh, uint _fh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint, bool &_closed)
get the points from the closest connected intersection between mesh and plane
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
MeshT::EdgeHandle getCuttedEdge(MeshT &_mesh, ACG::Vec3d &_planeNormal, ACG::Vec3d &_planePoint)
get an edge of the mesh that is cut by the plane
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void clear()
Clear the current polyline.
int generatePolyLineFromCut(int _objectId, Vector _planePoint, Vector _planeNormal, int _polyLineId=-1)
Generates a polyLine of a plane intersection.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
#define DATA_TRIANGLE_MESH
PolyLineObject * polyLineObject(BaseObjectData *_object)
Cast an BaseObject to a PolyLineObject if possible.