|
[Sponsors] |
November 13, 2008, 11:25 |
I've been experimenting with t
|
#1 |
New Member
Robert Manning
Join Date: Mar 2009
Posts: 12
Rep Power: 17 |
I've been experimenting with triSurfaceSearch to see if a set of points are inside a box. However, the following code reports that points are both inside and outside the box while all the points generated are inside. I can also post the stl that I am using.
--- Code --- #include "topoSetSource.H" #include "cellSet.H" #include "volFields.H" #include "triSurface.H" #include "Random.H" #include "triSurfaceSearch.H" using namespace Foam; int main(int argc, char *argv[]) { //Random Random rndGen(label(0)); // Temp variables scalar currentx; scalar currenty; scalar currentz; scalar randnum; // Point list pointField cellPoints(10,vector::zero); // Random point in cell vector currentpoint = vector::zero; forAll(cellPoints,pointsi) { randnum = rndGen.scalar01(); currentx = (randnum-0.5)*0.57735*2; randnum = rndGen.scalar01(); currenty = (randnum-0.5)*0.57735*2; randnum = rndGen.scalar01(); currentz = (randnum-0.5)*0.57735*2; currentpoint = Vector<scalar>(currentx,currenty,currentz); cellPoints[pointsi] = currentpoint; } // Select Surface triSurface surf("gamma.stl"); triSurfaceSearch querySurf(surf); // determine if points inside surface boolList pointInside(querySurf.calcInside(cellPoints)); forAll(pointInside, pointI) { bool isInside = pointInside[pointI]; cout << cellPoints[pointI].x() << " " << cellPoints[pointI].y() << " " << cellPoints[pointI].z(); if (isInside) cout << " Inside\n"; else cout << " Outside\n"; } return 0; } |
|
November 13, 2008, 12:04 |
Check the surface with e.g. su
|
#2 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
Check the surface with e.g. surfaceCheck. Is it closed and manifold (i.e. has every edge two faces?). Only then does inside/outside make sense. If it is, yes please post the surface.
|
|
November 13, 2008, 21:25 |
I receive the following from s
|
#3 |
New Member
Robert Manning
Join Date: Mar 2009
Posts: 12
Rep Power: 17 |
I receive the following from surfaceCheck:
Reading surface from "gamma.stl" ... Statistics: Triangles : 96 Vertices : 50 Bounding Box : (0 0 0) (0.01 0.01 0.01) Region Size ------ ---- gamma2_out 96 Surface has no illegal triangles. Triangle quality (equilateral=1, collapsed=0): 0 .. 0.05 : 0 0.05 .. 0.1 : 0 0.1 .. 0.15 : 0 0.15 .. 0.2 : 0 0.2 .. 0.25 : 0 0.25 .. 0.3 : 0 0.3 .. 0.35 : 0 0.35 .. 0.4 : 0 0.4 .. 0.45 : 0 0.45 .. 0.5 : 0 0.5 .. 0.55 : 0 0.55 .. 0.6 : 0 0.6 .. 0.65 : 0 0.65 .. 0.7 : 0 0.7 .. 0.75 : 0 0.75 .. 0.8 : 1 0.8 .. 0.85 : 0 0.85 .. 0.9 : 0 0.9 .. 0.95 : 0 0.95 .. 1 : 0 min 0.7698 for triangle 0 max 0.7698 for triangle 0 Dumping bad quality faces to "badFaces" Paste this into the input for surfaceSubset Edges: min 0.00353553 for edge 1 points (0.0075 0.0075 0.01)(0.005 0.01 0.01) max 0.005 for edge 0 points (0.0025 0.0075 0.01)(0.0075 0.0075 0.01) Checking for points less than 1E-6 of bounding box ((0.01 0.01 0.01) meter) apart. Found 0 nearby points. Surface is closed. All edges connected to two faces. Number of unconnected parts : 1 Number of zones (connected area with consistent normal) : 96 More than one normal orientation. Checking self-intersection. Surface is not self-intersecting End |
|
November 13, 2008, 21:34 |
I determined the problem. My
|
#4 |
New Member
Robert Manning
Join Date: Mar 2009
Posts: 12
Rep Power: 17 |
I determined the problem. My surface had normals that were pointing inward and others outward. It seems that surfaceCheck does not recognize this situation.
|
|
November 14, 2008, 04:37 |
surfaceCheck says:
Number o
|
#5 |
Senior Member
Mattijs Janssens
Join Date: Mar 2009
Posts: 1,419
Rep Power: 26 |
surfaceCheck says:
Number of zones (connected area with consistent normal) : 96 More than one normal orientation. ;-) |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|