39 p.x() <
min(a.x(), b.x())
40 || p.x() >
max(a.x(), b.x())
41 || p.y() <
min(a.y(), b.y())
42 || p.y() >
max(a.y(), b.y())
52 void Foam::CV2D::insertFeaturePoints()
54 featurePoints_.clear();
55 label nVert = number_of_vertices();
57 const PtrList<extendedFeatureEdgeMesh>& feMeshes
65 <<
"Extended Feature Edge Mesh is empty so no feature points will " 67 <<
" Use: featureMethod extendedFeatureEdgeMesh;" <<
nl 73 const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
74 const edgeList& edges = feMesh.edges();
79 label nConvex = feMesh.concaveStart() - feMesh.convexStart();
80 label nConcave = feMesh.mixedStart() - feMesh.concaveStart();
81 label nMixed = feMesh.nonFeatureStart() - feMesh.mixedStart();
82 label nExternal = feMesh.internalStart() - feMesh.externalStart();
83 label nInternal = feMesh.flatStart() - feMesh.internalStart();
84 label nFlat = feMesh.openStart() - feMesh.flatStart();
85 label nOpen = feMesh.multipleStart() - feMesh.openStart();
86 label nMultiple = edges.size() - feMesh.multipleStart();
88 Info<<
"Inserting Feature Points:" <<
nl 89 <<
" Convex points: " << nConvex <<
nl 90 <<
" Concave points: " << nConcave <<
nl 91 <<
" Mixed points: " << nMixed <<
nl 92 <<
" External edges: " << nExternal <<
nl 93 <<
" Internal edges: " << nInternal <<
nl 94 <<
" Flat edges: " << nFlat <<
nl 95 <<
" Open edges: " << nOpen <<
nl 96 <<
" Multiple edges: " << nMultiple <<
endl;
105 Info<<
" plane: " << zPlane <<
" " << z_ <<
endl;
110 const edge& e = feMesh.edges()[edgeI];
112 const point& ep0 = points[e.start()];
113 const point& ep1 = points[e.end()];
117 scalar intersect = zPlane.lineIntersect(line);
121 if (on2DLine(featPoint, line))
126 cornerNormal /=
mag(cornerNormal);
130 Info<<
nl <<
" line: " << line <<
nl 131 <<
" vec: " << line.vec() <<
nl 132 <<
" featurePoint: " << featPoint <<
nl 133 <<
" line length: " << line.mag() <<
nl 134 <<
" intersect: " << intersect <<
endl;
139 feMesh.getEdgeStatus(edgeI)
149 Info<<
"PREC: " << internalPt <<
nl 150 <<
" : " << featPoint <<
nl 152 <<
" : " << cornerNormal <<
endl;
155 featurePoints_.push_back
164 label masterPtIndex = nVert++;
168 const vector n3D(fpn[nI][0], fpn[nI][1], 0.0);
170 plane planeN = plane(
toPoint3D(featPoint), n3D);
180 featurePoints_.push_back
192 Info<<
" side point: " << externalPt <<
endl;
198 Info<<
"Convex Point: " << featPoint <<
nl 199 <<
" corner norm: " << cornerNormal <<
nl 200 <<
" reference: " << internalPt <<
endl;
205 feMesh.getEdgeStatus(edgeI)
216 label slavePointIndex = 0;
231 int nAddPoints =
min(
max(nQuads - 2, 0), 2);
234 label reflectedMaster = nVert + 2 + nAddPoints;
238 Info<<
"Concave Point: " << featPoint <<
nl 239 <<
" corner norm: " << cornerNormal <<
nl 240 <<
" external: " << externalPt <<
nl 241 <<
" reference: " << refPt <<
nl 242 <<
" angle: " << totalAngle <<
nl 243 <<
" nQuads: " << nQuads <<
nl 244 <<
" nAddPoints: " << nAddPoints <<
endl;
249 const vector n3D(fpn[nI][0], fpn[nI][1], 0.0);
251 plane planeN = plane(
toPoint3D(featPoint), n3D);
261 featurePoints_.push_back
270 slavePointIndex = nVert++;
274 Info<<
"Internal Point: " << internalPt <<
endl;
282 featurePoints_.push_back
294 Info<<
"ref Point: " << refPt <<
endl;
297 else if (nAddPoints == 2)
300 refPt - ((featPoint - externalPt) & fpn[1])*fpn[1];
302 featurePoints_.push_back
313 refPt - ((featPoint - externalPt) & fpn[0])*fpn[0];
315 featurePoints_.push_back
327 Info<<
"refA Point: " << reflectedAa <<
nl 328 <<
"refb Point: " << reflectedBb <<
endl;
332 featurePoints_.push_back
345 <<
"Feature Edge " << edges[edgeI] <<
nl 346 <<
" points(" << points[edges[edgeI].start()]
347 <<
", " << points[edges[edgeI].end()] <<
")" <<
nl 348 <<
" is not labelled as either concave or convex, it" 349 <<
" is labelled as (#2 = flat): " 350 << feMesh.getEdgeStatus(edgeI) <<
endl;
356 <<
"Point " << featPoint <<
" is not on the line " 363 reinsertFeaturePoints();
375 void Foam::CV2D::reinsertFeaturePoints()
379 std::list<Vb>::iterator vit=featurePoints_.begin();
380 vit != featurePoints_.end();
dimensionedScalar acos(const dimensionedScalar &ds)
void writeFaces(const fileName &fName, bool internalOnly) const
Write dual faces as .obj file.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
vector2D point2D
Point2D is a vector.
scalar radToDeg(const scalar rad)
Conversion from radians to degrees.
Field< vector2D > vector2DField
Forward declarations of the specialisation of Field<T> for vector2D.
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
Unit conversion functions.
Vector2D< scalar > vector2D
vector2D obtained from generic Vector2D
Ostream & endl(Ostream &os)
Add newline and flush stream.
point toPoint3D(const point2D &) const
const cv2DControls & meshControls() const
Vector< scalar > vector
A scalar version of the templated Vector.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
vectorField pointField
pointField is a vectorField.
line< point, const point & > linePointRef
Line using referred points.
scalar ppDist() const
Return the ppDist.
const point2D & toPoint2D(const point &) const
void writeTriangles(const fileName &fName, bool internalOnly) const
Write triangles as .obj file.
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
PointFromPoint2D toPoint(const point2D &) const
dimensioned< scalar > mag(const dimensioned< Type > &)
void writePoints(const fileName &fName, bool internalOnly) const
Write internal points to .obj file.