41 p.x() <
min(a.x(),
b.x())
42 ||
p.x() >
max(a.x(),
b.x())
43 ||
p.y() <
min(a.y(),
b.y())
44 ||
p.y() >
max(a.y(),
b.y())
54 void Foam::CV2D::insertFeaturePoints()
56 featurePoints_.clear();
57 label nVert = number_of_vertices();
59 const PtrList<extendedFeatureEdgeMesh>& feMeshes
67 <<
"Extended Feature Edge Mesh is empty so no feature points will " 69 <<
" Use: featureMethod extendedFeatureEdgeMesh;" <<
nl 75 const extendedFeatureEdgeMesh& feMesh(feMeshes[i]);
76 const edgeList& edges = feMesh.edges();
81 label nConvex = feMesh.concaveStart() - feMesh.convexStart();
82 label nConcave = feMesh.mixedStart() - feMesh.concaveStart();
83 label nMixed = feMesh.nonFeatureStart() - feMesh.mixedStart();
84 label nExternal = feMesh.internalStart() - feMesh.externalStart();
85 label nInternal = feMesh.flatStart() - feMesh.internalStart();
86 label nFlat = feMesh.openStart() - feMesh.flatStart();
87 label nOpen = feMesh.multipleStart() - feMesh.openStart();
88 label nMultiple = edges.
size() - feMesh.multipleStart();
90 Info<<
"Inserting Feature Points:" <<
nl 91 <<
" Convex points: " << nConvex <<
nl 92 <<
" Concave points: " << nConcave <<
nl 93 <<
" Mixed points: " << nMixed <<
nl 94 <<
" External edges: " << nExternal <<
nl 95 <<
" Internal edges: " << nInternal <<
nl 96 <<
" Flat edges: " << nFlat <<
nl 97 <<
" Open edges: " << nOpen <<
nl 98 <<
" Multiple edges: " << nMultiple <<
endl;
107 Info<<
" plane: " << zPlane <<
" " << z_ <<
endl;
112 const edge&
e = feMesh.edges()[edgeI];
119 scalar intersect = zPlane.lineIntersect(line);
121 point2D featPoint = toPoint2D(intersect * (ep1 - ep0) + ep0);
123 if (on2DLine(featPoint, line))
128 cornerNormal.normalise();
132 Info<<
nl <<
" line: " << line <<
nl 133 <<
" vec: " << line.vec() <<
nl 134 <<
" featurePoint: " << featPoint <<
nl 135 <<
" line length: " << line.mag() <<
nl 136 <<
" intersect: " << intersect <<
endl;
141 feMesh.getEdgeStatus(edgeI)
147 featPoint - meshControls().ppDist()*cornerNormal;
151 Info<<
"PREC: " << internalPt <<
nl 152 <<
" : " << featPoint <<
nl 153 <<
" : " << meshControls().ppDist() <<
nl 154 <<
" : " << cornerNormal <<
endl;
157 featurePoints_.push_back
166 label masterPtIndex = nVert++;
170 const vector n3D(fpn[nI][0], fpn[nI][1], 0.0);
172 plane planeN = plane(toPoint3D(featPoint), n3D);
178 * planeN.distance(toPoint3D(internalPt))
182 featurePoints_.push_back
194 Info<<
" side point: " << externalPt <<
endl;
200 Info<<
"Convex Point: " << featPoint <<
nl 201 <<
" corner norm: " << cornerNormal <<
nl 202 <<
" reference: " << internalPt <<
endl;
207 feMesh.getEdgeStatus(edgeI)
213 featPoint + meshControls().ppDist()*cornerNormal;
216 featPoint - meshControls().ppDist()*cornerNormal;
218 label slavePointIndex = 0;
229 int(totalAngle/meshControls().maxQuadAngle()) + 1;
233 int nAddPoints =
min(
max(nQuads - 2, 0), 2);
236 label reflectedMaster = nVert + 2 + nAddPoints;
240 Info<<
"Concave Point: " << featPoint <<
nl 241 <<
" corner norm: " << cornerNormal <<
nl 242 <<
" external: " << externalPt <<
nl 243 <<
" reference: " << refPt <<
nl 244 <<
" angle: " << totalAngle <<
nl 245 <<
" nQuads: " << nQuads <<
nl 246 <<
" nAddPoints: " << nAddPoints <<
endl;
251 const vector n3D(fpn[nI][0], fpn[nI][1], 0.0);
253 plane planeN = plane(toPoint3D(featPoint), n3D);
259 * planeN.distance(toPoint3D(externalPt))
263 featurePoints_.push_back
272 slavePointIndex = nVert++;
276 Info<<
"Internal Point: " << internalPt <<
endl;
284 featurePoints_.push_back
296 Info<<
"ref Point: " << refPt <<
endl;
299 else if (nAddPoints == 2)
302 refPt - ((featPoint - externalPt) & fpn[1])*fpn[1];
304 featurePoints_.push_back
315 refPt - ((featPoint - externalPt) & fpn[0])*fpn[0];
317 featurePoints_.push_back
329 Info<<
"refA Point: " << reflectedAa <<
nl 330 <<
"refb Point: " << reflectedBb <<
endl;
334 featurePoints_.push_back
347 <<
"Feature Edge " << edges[edgeI] <<
nl 348 <<
" points(" <<
points[edges[edgeI].start()]
349 <<
", " <<
points[edges[edgeI].end()] <<
")" <<
nl 350 <<
" is not labelled as either concave or convex, it" 351 <<
" is labelled as (#2 = flat): " 352 << feMesh.getEdgeStatus(edgeI) <<
endl;
358 <<
"Point " << featPoint <<
" is not on the line " 365 reinsertFeaturePoints();
367 if (meshControls().objOutput())
369 writePoints(
"feat_allPoints.obj",
false);
370 writeFaces(
"feat_allFaces.obj",
false);
371 writeFaces(
"feat_faces.obj",
true);
372 writeTriangles(
"feat_triangles.obj",
true);
377 void Foam::CV2D::reinsertFeaturePoints()
381 std::list<Vb>::iterator vit=featurePoints_.begin();
382 vit != featurePoints_.end();
388 toPoint2D(vit->point()),
void size(const label n)
Older name for setAddressableSize.
dimensionedScalar acos(const dimensionedScalar &ds)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1)
vector2D point2D
Point2D is a vector.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Field< vector2D > vector2DField
Forward declarations of the specialisation of Field<T> for vector2D.
List< edge > edgeList
List of edge.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
Vector2D< scalar > vector2D
A 2D vector of scalars obtained from the generic Vector2D.
const point2D & toPoint2D(const Foam::point &) const
Ostream & endl(Ostream &os)
Add newline and flush stream.
An indexed form of CGAL::Triangulation_vertex_base_3<K> used to keep track of the Delaunay vertices i...
#define forAll(list, i)
Loop across all elements in list.
vectorField pointField
pointField is a vectorField.
const dimensionedScalar e
Elementary charge.
line< point, const point & > linePointRef
A line using referred points.
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
constexpr scalar pi(M_PI)
PointFrompoint toPoint(const Foam::point &p)
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
#define WarningInFunction
Report a warning using Foam::Warning.
constexpr scalar radToDeg(const scalar rad) noexcept
Conversion from radians to degrees.
messageStream Info
Information stream (stdout output on master, null elsewhere)